답안 #17890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17890 2016-01-13T05:37:42 Z Erzhann 돌 무게 재기 (IZhO11_stones) C++14
40 / 100
1000 ms 4484 KB
/*
  /\     /\
  | ).|.( |
  |  >-<  |
  =========
It's Adilkhan99 miaaaaaau     
*/
#include<bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define f first
#define s second
#define name ""
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
using namespace std;
                                             
const int MaxN = int (2e5) + 256;
const int INF = int(1e9); 
const int mod = (int)(1e9) + 7;
int n, a[MaxN], m, t;
set<int> s, S;
bool u[MaxN], U[MaxN];
 
int main () {
    scanf("%d", &n);
    for(int i = 1; i <= n; ++i){
        int x, y; scanf("%d%d", &x, &y);
        if(y == 2){
            if(!u[x]){
                S.insert(-x);
                U[x] = 1;
            }else{
                s.erase(-x);                   
                u[x] = 0;
            }  
        }
        else{
            if(!U[x]){
                s.insert(-x);
                u[x] = 1;
            }else{
                S.erase(-x);
                U[x] = 0;
            }
        }
        auto I = s.begin();
        auto J = S.begin();
        bool ok = 0, ok1 = 0;
        if(s.size() > S.size())
            ok = 1;
        if(S.size() > s.size())
            ok1 = 1;
        while(I != s.end() && J != S.end()){
            if(ok && ok1){
                break;
            }
            if(-(*I) > -(*J))
                ok = 1;
            if(-(*I) < -(*J))
                ok1 = 1;
            I++;
            J++;
        }
        if(ok && ok1)
            puts("?");
        else if(ok)
            puts(">");
        else puts("<");     
    } 
return 0;
}       
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2900 KB Output is correct - 73 tokens
2 Correct 0 ms 2900 KB Output is correct - 89 tokens
3 Correct 0 ms 2900 KB Output is correct - 221 tokens
4 Correct 0 ms 2900 KB Output is correct - 21 tokens
5 Correct 0 ms 2900 KB Output is correct - 369 tokens
6 Correct 0 ms 2900 KB Output is correct - 492 tokens
7 Correct 0 ms 2900 KB Output is correct - 945 tokens
8 Correct 0 ms 2900 KB Output is correct - 1237 tokens
9 Correct 0 ms 2900 KB Output is correct - 1105 tokens
10 Correct 22 ms 3296 KB Output is correct - 8921 tokens
11 Execution timed out 1000 ms 4484 KB Program timed out
12 Execution timed out 1000 ms 4220 KB Program timed out
13 Execution timed out 1000 ms 3956 KB Program timed out
14 Execution timed out 1000 ms 3956 KB Program timed out
15 Execution timed out 1000 ms 3824 KB Program timed out
16 Execution timed out 1000 ms 3824 KB Program timed out
17 Execution timed out 1000 ms 4088 KB Program timed out
18 Execution timed out 1000 ms 3824 KB Program timed out
19 Execution timed out 1000 ms 3824 KB Program timed out
20 Execution timed out 1000 ms 3956 KB Program timed out
21 Execution timed out 1000 ms 3824 KB Program timed out
22 Execution timed out 1000 ms 3824 KB Program timed out
23 Execution timed out 1000 ms 3824 KB Program timed out
24 Execution timed out 1000 ms 3824 KB Program timed out
25 Execution timed out 1000 ms 3824 KB Program timed out