답안 #74960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
74960 2018-09-07T18:23:02 Z Vardanyan 돌 무게 재기 (IZhO11_stones) C++14
0 / 100
2 ms 376 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 f = false;
        if(a.size()<b.size()){
            f = true;
            swap(a,b);
        }
        set<int,greater<int> >::iterator it1 = a.begin(),it2 = b.begin();
        bool x = true;
        for(;it2!=b.end();it1++,it2++){
            if(*(it1)>*(it2)) continue;
            x = false;
            break;
        }
        if(x){
            if(!f){
                printf(">\n");
            }
            else printf("<\n");
        }
        else{
            printf("?\n");
        }
        if(f) swap(a,b);
    }
    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 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -