# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1038528 | pera | 돌 무게 재기 (IZhO11_stones) | C++17 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
vector<int> col(N) , cnt(2);
set<int> S;
vector<char> u = {'>' , '<' , '?'};
void UPD(int x){
S.insert(x);
auto it = S.lower_bound(x);
if(it != S.begin()){
cnt[col[x]] += (col[x] == col[*prev(it)]);
}
if(S.upper_bound(x) != S.end()){
cnt[col[x]] += (col[x] == col[*next(it)]);
}
if(it != S.begin() && S.upper_bound(x) != S.end()){
cnt[col[*prev(it)]] -= (col[*prev(it)] == col[*next(it)]);
}
}
int main(){
cin >> n;
for(int i = 1;i <= n;i ++){
int r;
cin >> r;
cin >> col[r];
--col[r];
UPD(r);
if(cnt[0] > 0 && cnt[1] > 0){
cout << u[2] << endl;
continue;
}
if(cnt[0] + cnt[1] == 0){
cout << u[col[*--S.end()]] << endl;
continue;
}
int v = 0;
while(cnt[v] == 0){
++v;
}
if(v == col[*--S.end()]){
cout << u[v] << endl;
continue;
}
cout << u[2] << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |