# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1027570 | 2024-07-19T07:41:13 Z | vjudge1 | Trampoline (info1cup20_trampoline) | C++17 | 73 ms | 70232 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, 20>> p(t+1); for(auto &[i, l]: tram) cin >> i >> l; sort(tram.begin(), tram.end()); vector<array<int, 2>> ol; int pos=0; for(int i=t-1; i>=0; i--){ auto [r, c]=tram[i]; if(i<n-1&&tram[i+1][0]!=r){ ol.clear(); for(int j=i+1; j<n; j++){ if(tram[j][0]==r+1){ ol.push_back({tram[j][1], j}); } } pos=ol.size()-1; } while(pos>0&&ol[pos-1][0]>=c) pos--; if(pos<0){ p[i][0]=i; } else{ p[i][0]=ol[pos][1]; } } // hepsinin 1 switchte gittiği yer? for(int l=1; l<20; 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=19; 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 | Runtime error | 4 ms | 3676 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 69 ms | 70224 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 73 ms | 70232 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 2136 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 72 ms | 70224 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |