Submission #24406

# Submission time Handle Problem Language Result Execution time Memory
24406 2017-06-07T08:26:03 Z Extazy Weighting stones (IZhO11_stones) C++14
0 / 100
0 ms 2024 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1<<17;

int n;
set < int, greater < int > > s[2];
set < int, greater < int > >::iterator it0,it1;
int cnt;

int main() {
    int i,x,y;

    scanf("%d", &n);
    for(i=1;i<=n;i++) {
        scanf("%d %d", &x, &y);
        s[y-1].insert(x);
        if(s[0].empty()) printf("<\n");
        else if(s[1].empty()) printf(">\n");
        else if(*s[0].begin()>*s[1].begin()) {
            if(s[0].size()<s[1].size()) {
                printf("?\n");
                continue;
            }
            cnt=0;
            for(it0=s[0].begin(),it1=s[1].begin();it0!=s[0].end() && it1!=s[1].end();it0++,it1++) {
                if(*it0>*it1) ++cnt;
                else break;
                if(cnt>1000) {
                    cnt=s[1].size();
                    break;
                }
            }
            if(cnt==(int)(s[1].size())) printf(">\n");
            else printf("?\n");
        }
        else {
            cnt=0;
            for(it0=s[0].begin(),it1=s[1].begin();it0!=s[0].end() && it1!=s[1].end();it0++,it1++) {
                if(s[1].size()<s[0].size()) {
                    printf("?\n");
                    continue;
                }
                if(*it0<*it1) ++cnt;
                else break;
                if(cnt>1000) {
                    cnt=s[0].size();
                    break;
                }
            }
            if(cnt==(int)(s[0].size())) printf("<\n");
            else printf("?\n");
        }
    }

    return 0;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
stones.cpp:17:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &x, &y);
                               ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2024 KB Output isn't correct
2 Halted 0 ms 0 KB -