답안 #74961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
74961 2018-09-07T18:33:21 Z Vardanyan 돌 무게 재기 (IZhO11_stones) C++14
0 / 100
1000 ms 2856 KB
//#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;

int main(){
    set<int,greater<int> > a,b;
    int n;
    scanf("%d",&n);
    for(int i = 1;i<=n;i++){
        int r,s;
        scanf("%d%d",&r,&s);
        if(s == 1) a.insert(r);
        else b.insert(r);
        bool f1 = false,f2 = false;
        if(a.size()>=b.size()){
            f1 = true;
            set<int,greater<int> >::iterator it1 = a.begin(),it2 = b.begin();
            for(;it2!=b.end();it1++,it2++){
                if(*(it1)>*(it2)) continue;
                f1 = false;
                break;
            }
        }
        if(b.size()>=a.size()){
            f2 = true;
             set<int,greater<int> >::iterator it1 = a.begin(),it2 = b.begin();
            for(;it1!=a.end();it1++,it2++){
                if(*(it2)>*(it1)) continue;
                f2 = false;
                break;
            }
        }
        if(f1){
            printf(">\n");
        }
        else if(f2){
            printf("<\n");
        }
        else printf("?\n");
    }
    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
stones.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&r,&s);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 480 KB Output is correct
3 Correct 2 ms 480 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 2 ms 480 KB Output is correct
6 Correct 2 ms 612 KB Output is correct
7 Correct 3 ms 612 KB Output is correct
8 Correct 3 ms 612 KB Output is correct
9 Correct 4 ms 612 KB Output is correct
10 Correct 26 ms 1004 KB Output is correct
11 Execution timed out 1084 ms 2856 KB Time limit exceeded
12 Halted 0 ms 0 KB -