# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
369939 | 2021-02-22T19:15:57 Z | A_D | Trampoline (info1cup20_trampoline) | C++14 | 537 ms | 47600 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 | 2024 KB | 200 token(s): yes count is 21, no count is 179 |
2 | Correct | 6 ms | 2280 KB | 200 token(s): yes count is 70, no count is 130 |
3 | Incorrect | 4 ms | 1660 KB | expected NO, found YES [52nd token] |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 156 ms | 36820 KB | 4000 token(s): yes count is 99, no count is 3901 |
2 | Correct | 166 ms | 36820 KB | 4000 token(s): yes count is 91, no count is 3909 |
3 | Correct | 174 ms | 36436 KB | 4000 token(s): yes count is 4000, no count is 0 |
4 | Correct | 156 ms | 36820 KB | 4000 token(s): yes count is 1991, no count is 2009 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 327 ms | 47548 KB | expected NO, found YES [5147th token] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 1644 KB | 5000 token(s): yes count is 3238, no count is 1762 |
2 | Correct | 8 ms | 1644 KB | 5000 token(s): yes count is 3837, no count is 1163 |
3 | Correct | 7 ms | 1644 KB | 5000 token(s): yes count is 4104, no count is 896 |
4 | Correct | 7 ms | 1644 KB | 5000 token(s): yes count is 3934, no count is 1066 |
5 | Correct | 8 ms | 1644 KB | 5000 token(s): yes count is 3384, no count is 1616 |
6 | Correct | 8 ms | 1644 KB | 5000 token(s): yes count is 3390, no count is 1610 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 490 ms | 47548 KB | 200000 token(s): yes count is 171404, no count is 28596 |
2 | Correct | 458 ms | 47316 KB | 200000 token(s): yes count is 161254, no count is 38746 |
3 | Correct | 368 ms | 47444 KB | 200000 token(s): yes count is 117455, no count is 82545 |
4 | Correct | 492 ms | 47316 KB | 200000 token(s): yes count is 182118, no count is 17882 |
5 | Correct | 410 ms | 47572 KB | 200000 token(s): yes count is 167565, no count is 32435 |
6 | Correct | 377 ms | 47600 KB | 200000 token(s): yes count is 156797, no count is 43203 |
7 | Correct | 419 ms | 47444 KB | 200000 token(s): yes count is 156797, no count is 43203 |
8 | Correct | 356 ms | 47316 KB | 200000 token(s): yes count is 122100, no count is 77900 |
9 | Correct | 501 ms | 47188 KB | 200000 token(s): yes count is 139670, no count is 60330 |
10 | Correct | 483 ms | 47316 KB | 200000 token(s): yes count is 165806, no count is 34194 |
11 | Correct | 537 ms | 47316 KB | 200000 token(s): yes count is 175646, no count is 24354 |
12 | Correct | 335 ms | 47444 KB | 200000 token(s): yes count is 134695, no count is 65305 |
13 | Correct | 339 ms | 47444 KB | 200000 token(s): yes count is 126733, no count is 73267 |
14 | Correct | 401 ms | 47444 KB | 200000 token(s): yes count is 155290, no count is 44710 |
15 | Correct | 375 ms | 47572 KB | 200000 token(s): yes count is 129674, no count is 70326 |