# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1029264 | 2024-07-20T14:33:09 Z | berr | Trampoline (info1cup20_trampoline) | C++17 | 253 ms | 56920 KB |
#include <bits/stdc++.h> using namespace std; #define int long long void f(){ #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); // f(); int n, m, t; cin >> n >> m >> t; vector<array<int, 2>> tram(t); vector<array<int, 25>> p(t+1); for(auto &[i, l]: tram) cin >> i >> l; sort(tram.begin(), tram.end()); vector<array<int, 2>> ol; int pos=-1; for(int i=t-1; i>=0; i--){ auto [r, c]=tram[i]; if(i<t-1&&tram[i+1][0]!=r){ ol.clear(); for(int j=i+1; j<t; j++){ if(tram[j][0]==r+1){ ol.push_back({tram[j][1], j}); } else break; } pos=ol.size()-1; } while(pos>0&&ol[pos-1][0]>=c) pos--; if(pos<0||ol[pos][0]<c){ p[i][0]=i; } else{ p[i][0]=ol[pos][1]; } } for(int l=1; l<25; l++){ for(int i=0; i<t; i++){ p[i][l]=p[p[i][l-1]][l-1]; } } int q; cin >> q; while(q--){ int x, y; cin >> x >> y; int pos=lower_bound(tram.begin(), tram.end(), (array<int, 2>){x, y})-tram.begin(); int ex, ey; cin >> ex >> ey; if(ex==x){ if(y<=ey) cout<<"Yes"; else cout<<"No"; } else if(ex<x){ cout<<"No"; } else if(tram.size()==pos) cout<<"No"; else if(tram[pos][0]!=x) cout<<"No"; else{ int dif=ex-x-1; for(int j=24; j>=0; j--){ if((1<<j)<=dif){ pos=p[pos][j]; dif-=(1<<j); } } if(tram[pos][0]==ex-1&&tram[pos][1]<=ey){ cout<<"Yes"; } else cout<<"No"; } cout<<"\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2140 KB | 200 token(s): yes count is 21, no count is 179 |
2 | Correct | 3 ms | 2652 KB | 200 token(s): yes count is 70, no count is 130 |
3 | Correct | 3 ms | 1884 KB | 197 token(s): yes count is 25, no count is 172 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 81 ms | 44572 KB | 4000 token(s): yes count is 99, no count is 3901 |
2 | Correct | 73 ms | 44364 KB | 4000 token(s): yes count is 91, no count is 3909 |
3 | Correct | 75 ms | 44112 KB | 4000 token(s): yes count is 4000, no count is 0 |
4 | Correct | 71 ms | 44572 KB | 4000 token(s): yes count is 1991, no count is 2009 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 165 ms | 56920 KB | 200000 token(s): yes count is 110486, no count is 89514 |
2 | Correct | 166 ms | 56264 KB | 200000 token(s): yes count is 114664, no count is 85336 |
3 | Correct | 171 ms | 55256 KB | 200000 token(s): yes count is 86232, no count is 113768 |
4 | Correct | 175 ms | 55148 KB | 200000 token(s): yes count is 94603, no count is 105397 |
5 | Correct | 171 ms | 55116 KB | 200000 token(s): yes count is 94148, no count is 105852 |
6 | Correct | 177 ms | 54996 KB | 200000 token(s): yes count is 97163, no count is 102837 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1644 KB | 5000 token(s): yes count is 3238, no count is 1762 |
2 | Correct | 4 ms | 1628 KB | 5000 token(s): yes count is 3837, no count is 1163 |
3 | Correct | 4 ms | 1628 KB | 5000 token(s): yes count is 4104, no count is 896 |
4 | Correct | 5 ms | 1884 KB | 5000 token(s): yes count is 3934, no count is 1066 |
5 | Correct | 4 ms | 1628 KB | 5000 token(s): yes count is 3384, no count is 1616 |
6 | Correct | 4 ms | 1900 KB | 5000 token(s): yes count is 3390, no count is 1610 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 250 ms | 55008 KB | 200000 token(s): yes count is 171404, no count is 28596 |
2 | Correct | 229 ms | 54992 KB | 200000 token(s): yes count is 161254, no count is 38746 |
3 | Correct | 190 ms | 55248 KB | 200000 token(s): yes count is 117455, no count is 82545 |
4 | Correct | 253 ms | 54864 KB | 200000 token(s): yes count is 182118, no count is 17882 |
5 | Correct | 198 ms | 56776 KB | 200000 token(s): yes count is 167565, no count is 32435 |
6 | Correct | 192 ms | 56348 KB | 200000 token(s): yes count is 156797, no count is 43203 |
7 | Correct | 197 ms | 56348 KB | 200000 token(s): yes count is 156797, no count is 43203 |
8 | Correct | 196 ms | 55672 KB | 200000 token(s): yes count is 122100, no count is 77900 |
9 | Correct | 241 ms | 54984 KB | 200000 token(s): yes count is 139670, no count is 60330 |
10 | Correct | 240 ms | 55004 KB | 200000 token(s): yes count is 165806, no count is 34194 |
11 | Correct | 247 ms | 54996 KB | 200000 token(s): yes count is 175646, no count is 24354 |
12 | Correct | 181 ms | 56264 KB | 200000 token(s): yes count is 134695, no count is 65305 |
13 | Correct | 182 ms | 56916 KB | 200000 token(s): yes count is 126733, no count is 73267 |
14 | Correct | 217 ms | 54992 KB | 200000 token(s): yes count is 155290, no count is 44710 |
15 | Correct | 193 ms | 56384 KB | 200000 token(s): yes count is 129674, no count is 70326 |