| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 168102 | GioChkhaidze | 돌 무게 재기 (IZhO11_stones) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
ll n,idx,type,A,B,G[N][3];
void Upd(int x,int type) {
while (x<=n) {
G[x][type]++;
x+=(x & -x);
}
}
ll Get(int x,int type) {
ll res=G[x][type];
while (x>0) {
res+=G[x][type];
x-=(x & -x);
}
return res;
}
main () {
scanf("%d",&n);
G[0][1]=G[0][2]=1;
for (int i=1; i<=n; i++) {
scanf("%d%d",&idx,&type);
Upd(idx,type);
if (type==1) {
A+=Get(idx-1,2);
B+=Get(n,2)-Get(idx-1,2);
}
else {
B+=Get(idx-1,1);
A+=Get(n,1)-Get(idx-1,1);
}
if (A>B) printf(">\n");
else
if (A<B) printf("<\n");
else printf("?\n");
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
