TOPIC

TimeLimit Exceeded?

Kayque Damasceno asked 2 years ago

Estou fazendo algo de errado? =x

#include <iostream>
#include <stdio.h>
using namespace std;

int main(int argc, char** argv)
{
    int X, Y, M;
    int A, B;

    while(scanf("%d %d %d", &X, &Y, &M)!=EOF)
    {
        while(M-- > 0)
        {
            scanf("%d %d", &A, &B);

            int contador = 0;
            if ( A<=X && B<=Y)
                contador++;
            if(A<=Y && B<=X)
                contador++;

            if(contador!=0)
                cout << "Sim" << endl;
            else
            {
                cout << "Nao" << endl;
            }

        }
    }
    return 0;
}

Remember not post solutions. Your post may be reviewed by our moderators.

  • feodorv replied 2 years ago

    You can try

     while(scanf("%d %d %d", &X, &Y, &M)==3)