# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
410762 | maximath_1 | 돌 무게 재기 (IZhO11_stones) | C++11 | 71 ms | 4412 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define kyou using
#define mo namespace
#define kawaii std
kyou mo kawaii;
#define ll long long
#define ld long double
#define endl "\n"
const int MX = 100005;
const int LG = (int)log2(MX) + 1;
const int BLOCK = 205;
const int inf = 1000000069;
const ll inf_ll = 8000000000000000069ll;
const ld inf_ld = (ld)inf_ll;
const ld eps = 1e-9;
const ll mod = 1000000007;
const int alpha = 30;
const int dxh[] = {1, 1, -1, -1, 2, 2, -2, -2};
const int dyh[] = {2, -2, 2, -2, 1, -1, 1, -1}; // horse
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0}; // adj
const int dz[] = {0, 0, 0, 0, 1, -1}; // 3d
const int dxd[] = {1, 1, 1, 0, -1, -1, -1, 0};
const int dyd[] = {1, 0, -1, -1, -1, 0, 1, 1}; // diag
mt19937 rng(time(NULL));
bool untied = 0;
void setIn(string s){freopen(s.c_str(), "r", stdin);}
void setOut(string s){freopen(s.c_str(), "w", stdout);}
void unsyncIO(){cin.tie(0) -> sync_with_stdio(0);}
void setIO(string s = ""){
if(!untied) unsyncIO(), untied = 1;
if(s.size()){
setIn(s + ".in");
setOut(s + ".out");
}
}
int mn[MX * 4], mx[MX * 4], lz[MX * 4];
void prop(int nd, int cl, int cr){
if(lz[nd] != 0){
mn[nd] += lz[nd];
mx[nd] += lz[nd];
if(cl != cr){
lz[nd * 2] += lz[nd];
lz[nd * 2 + 1] += lz[nd];
}
lz[nd] = 0;
}
}
void upd(int nd, int cl, int cr, int lf, int rg, int val){
prop(nd, cl, cr);
if(lf > rg || cl > cr || cr < lf || rg < cl) return;
if(lf <= cl && cr <= rg){
lz[nd] += val;
prop(nd, cl, cr);
return;
}
upd(2 * nd, cl, (cl + cr) / 2, lf, rg, val);
upd(2 * nd + 1, (cl + cr) / 2 + 1, cr, lf, rg, val);
mn[nd] = min(mn[2 * nd], mn[2 * nd + 1]);
mx[nd] = max(mx[2 * nd], mx[2 * nd + 1]);
}
int main(){
setIO();
int n; cin >> n;
for(int a, b, i = 0; i < n; i ++){
cin >> a >> b;
upd(1, 1, n, 1, a, 2 * b - 3);
if(mx[1] <= 0) cout << ">\n";
else if(mn[1] >= 0) cout << "<\n";
else cout << "?\n";
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |