Submission #24403

# Submission time Handle Problem Language Result Execution time Memory
24403 2017-06-07T08:20:22 Z Extazy Weighting stones (IZhO11_stones) C++14
0 / 100
1000 ms 3740 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()) {
            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==(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(*it0<*it1) ++cnt;
                else 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 Correct 0 ms 2024 KB Output is correct
2 Correct 0 ms 2024 KB Output is correct
3 Correct 0 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 0 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Correct 0 ms 2024 KB Output is correct
8 Correct 0 ms 2156 KB Output is correct
9 Correct 0 ms 2156 KB Output is correct
10 Correct 29 ms 2420 KB Output is correct
11 Execution timed out 1000 ms 3740 KB Execution timed out
12 Halted 0 ms 0 KB -