# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369946 | 2021-02-22T19:28:27 Z | A_D | Trampoline (info1cup20_trampoline) | C++14 | 485 ms | 35924 KB |
#include <bits/stdc++.h> #define int long long #define ii pair<int,int> #define F first #define S second #define du long double using namespace std; const int N=4e5+1000; const int l=20; int nxt[N][l]; vector<ii> vec; main() { int r,c,n; cin>>r>>c>>n; for(int i=1;i<=n;i++){ int a,b; scanf("%lld",&a); scanf("%lld",&b); vec.push_back({a,b}); } sort(vec.begin(),vec.end()); int sz=vec.size(); for(int i=0;i<l;i++)nxt[sz][i]=sz; for(int i=0;i<sz;i++){ int nx=lower_bound(vec.begin(),vec.end(),make_pair(vec[i].F+1,vec[i].S))-vec.begin(); if(nx!=sz&&vec[nx].F!=vec[i].F+1){ nx=sz; } nxt[i][0]=nx; } for(int j=1;j<l;j++){ for(int i=0;i<sz;i++){ nxt[i][j]=nxt[nxt[i][j-1]][j-1]; } } vec.push_back({1e10,1e10}); // for(int i=0;i<vec.size();i++)cout<<i<<" "<<vec[i].F<<" "<<vec[i].S<<endl; // cout<<endl; /*for(int i=0;i<sz;i++){ for(int j=0;j<l;j++){ cout<<nxt[i][j]<<" "; } cout<<endl; }*/ int t; cin>>t; while(t--){ int x1,x2,y1,y2; scanf("%lld",&x1); scanf("%lld",&y1); scanf("%lld",&x2); scanf("%lld",&y2); if(y2<y1||x2<x1){ // cout<<1; printf("No\n"); continue; } if(x1==x2){ printf("Yes\n"); continue; } int i=lower_bound(vec.begin(),vec.end(),make_pair(x1,y1))-vec.begin(); for(int j=l-1;j>=0;j--){ if(((x2-x1-1)&(1<<j))){ if(i != sz) i = nxt[i][j]; } } // cout<<i<<endl; int l=vec[i].S; if(vec[i].S<=y2){ printf("Yes\n"); continue; } int r=nxt[i][0]; r=vec[r].S; // cout<<i<<endl; if(l<=y2&&y2<=r){ printf("Yes\n"); continue; } printf("No\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 2044 KB | 200 token(s): yes count is 21, no count is 179 |
2 | Correct | 6 ms | 2152 KB | 200 token(s): yes count is 70, no count is 130 |
3 | Incorrect | 4 ms | 1644 KB | expected NO, found YES [52nd token] |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 152 ms | 35084 KB | 4000 token(s): yes count is 99, no count is 3901 |
2 | Correct | 150 ms | 34900 KB | 4000 token(s): yes count is 91, no count is 3909 |
3 | Correct | 148 ms | 35028 KB | 4000 token(s): yes count is 4000, no count is 0 |
4 | Correct | 149 ms | 34980 KB | 4000 token(s): yes count is 1991, no count is 2009 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 331 ms | 35668 KB | expected NO, found YES [5147th token] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 1308 KB | 5000 token(s): yes count is 3238, no count is 1762 |
2 | Correct | 7 ms | 1308 KB | 5000 token(s): yes count is 3837, no count is 1163 |
3 | Correct | 7 ms | 1308 KB | 5000 token(s): yes count is 4104, no count is 896 |
4 | Correct | 9 ms | 1308 KB | 5000 token(s): yes count is 3934, no count is 1066 |
5 | Correct | 10 ms | 1308 KB | 5000 token(s): yes count is 3384, no count is 1616 |
6 | Correct | 7 ms | 1308 KB | 5000 token(s): yes count is 3390, no count is 1610 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 466 ms | 35800 KB | 200000 token(s): yes count is 171404, no count is 28596 |
2 | Correct | 424 ms | 35668 KB | 200000 token(s): yes count is 161254, no count is 38746 |
3 | Correct | 342 ms | 35668 KB | 200000 token(s): yes count is 117455, no count is 82545 |
4 | Correct | 485 ms | 35924 KB | 200000 token(s): yes count is 182118, no count is 17882 |
5 | Correct | 382 ms | 35688 KB | 200000 token(s): yes count is 167565, no count is 32435 |
6 | Correct | 366 ms | 35832 KB | 200000 token(s): yes count is 156797, no count is 43203 |
7 | Correct | 356 ms | 35668 KB | 200000 token(s): yes count is 156797, no count is 43203 |
8 | Correct | 350 ms | 35668 KB | 200000 token(s): yes count is 122100, no count is 77900 |
9 | Correct | 456 ms | 35668 KB | 200000 token(s): yes count is 139670, no count is 60330 |
10 | Correct | 469 ms | 35844 KB | 200000 token(s): yes count is 165806, no count is 34194 |
11 | Correct | 484 ms | 35668 KB | 200000 token(s): yes count is 175646, no count is 24354 |
12 | Correct | 323 ms | 35796 KB | 200000 token(s): yes count is 134695, no count is 65305 |
13 | Correct | 327 ms | 35840 KB | 200000 token(s): yes count is 126733, no count is 73267 |
14 | Correct | 386 ms | 35624 KB | 200000 token(s): yes count is 155290, no count is 44710 |
15 | Correct | 335 ms | 35636 KB | 200000 token(s): yes count is 129674, no count is 70326 |