# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1118670 |
2024-11-26T01:41:31 Z |
vjudge1 |
Tenis (COI19_tenis) |
C++17 |
|
131 ms |
7240 KB |
#include<bits/stdc++.h>
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=1e5+5;
int n,m,a[4][N];
namespace SGT
{
int a[N<<2],p[N<<2],lt[N<<2];
inline void pushup(int w){int o=(a[w<<1]>a[w<<1|1]);a[w]=a[w<<1|o],p[w]=p[w<<1|o];}
inline void upd(int w,int x){a[w]+=x;lt[w]+=x;}
inline void pushdown(int w){int &t=lt[w];if(t) upd(w<<1,t),upd(w<<1|1,t),t=0;}
void updata(int x,int L,int R=n,int l=1,int r=n,int w=1)
{
if(L<=l&&r<=R) return upd(w,x);
int mid=(l+r)>>1;pushdown(w);
if(L<=mid) updata(x,L,R,l,mid,w<<1);
if(mid<R) updata(x,L,R,mid+1,r,w<<1|1);
pushup(w);
}
inline int ask(){return p[1];}
void build(int l=1,int r=n,int w=1)
{
if(l==r) return a[w]=p[w]=l,void();
int mid=(l+r)>>1;build(l,mid,w<<1);build(mid+1,r,w<<1|1);
pushup(w);
}
}
inline int MX(int i){return max({a[1][i],a[2][i],a[3][i]});}
inline void upd(int i,int x){SGT::updata(-x,MX(i));}
int main()
{
// fr(tennis)
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>n>>m;
for(int o=1;o<=3;o++) for(int i=1,x;i<=n;i++) cin>>x,a[o][x]=i;
SGT::build();
for(int i=1;i<=n;i++) upd(i,1);
for(int o,p,x,y;m--;)
{
cin>>o;
if(o==1) cin>>x,cout<<(MX(x)<=SGT::ask()?"DA\n":"NE\n");
else
{
cin>>p>>x>>y;if(x==y) continue;
upd(x,-1),upd(y,-1),swap(a[p][x],a[p][y]),upd(x,1),upd(y,1);
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
76 ms |
4692 KB |
Output is correct |
14 |
Correct |
48 ms |
4700 KB |
Output is correct |
15 |
Correct |
43 ms |
4700 KB |
Output is correct |
16 |
Correct |
48 ms |
4700 KB |
Output is correct |
17 |
Correct |
55 ms |
6240 KB |
Output is correct |
18 |
Correct |
57 ms |
4604 KB |
Output is correct |
19 |
Correct |
48 ms |
4716 KB |
Output is correct |
20 |
Correct |
55 ms |
4688 KB |
Output is correct |
21 |
Correct |
58 ms |
5228 KB |
Output is correct |
22 |
Correct |
47 ms |
5712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
6512 KB |
Output is correct |
2 |
Correct |
56 ms |
6352 KB |
Output is correct |
3 |
Correct |
68 ms |
7240 KB |
Output is correct |
4 |
Correct |
93 ms |
4936 KB |
Output is correct |
5 |
Correct |
67 ms |
6508 KB |
Output is correct |
6 |
Correct |
59 ms |
4936 KB |
Output is correct |
7 |
Correct |
61 ms |
4988 KB |
Output is correct |
8 |
Correct |
94 ms |
4948 KB |
Output is correct |
9 |
Correct |
71 ms |
4996 KB |
Output is correct |
10 |
Correct |
56 ms |
4976 KB |
Output is correct |
11 |
Correct |
59 ms |
4988 KB |
Output is correct |
12 |
Correct |
76 ms |
4972 KB |
Output is correct |
13 |
Correct |
59 ms |
4940 KB |
Output is correct |
14 |
Correct |
56 ms |
4956 KB |
Output is correct |
15 |
Correct |
50 ms |
4980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
76 ms |
4692 KB |
Output is correct |
14 |
Correct |
48 ms |
4700 KB |
Output is correct |
15 |
Correct |
43 ms |
4700 KB |
Output is correct |
16 |
Correct |
48 ms |
4700 KB |
Output is correct |
17 |
Correct |
55 ms |
6240 KB |
Output is correct |
18 |
Correct |
57 ms |
4604 KB |
Output is correct |
19 |
Correct |
48 ms |
4716 KB |
Output is correct |
20 |
Correct |
55 ms |
4688 KB |
Output is correct |
21 |
Correct |
58 ms |
5228 KB |
Output is correct |
22 |
Correct |
47 ms |
5712 KB |
Output is correct |
23 |
Correct |
59 ms |
6512 KB |
Output is correct |
24 |
Correct |
56 ms |
6352 KB |
Output is correct |
25 |
Correct |
68 ms |
7240 KB |
Output is correct |
26 |
Correct |
93 ms |
4936 KB |
Output is correct |
27 |
Correct |
67 ms |
6508 KB |
Output is correct |
28 |
Correct |
59 ms |
4936 KB |
Output is correct |
29 |
Correct |
61 ms |
4988 KB |
Output is correct |
30 |
Correct |
94 ms |
4948 KB |
Output is correct |
31 |
Correct |
71 ms |
4996 KB |
Output is correct |
32 |
Correct |
56 ms |
4976 KB |
Output is correct |
33 |
Correct |
59 ms |
4988 KB |
Output is correct |
34 |
Correct |
76 ms |
4972 KB |
Output is correct |
35 |
Correct |
59 ms |
4940 KB |
Output is correct |
36 |
Correct |
56 ms |
4956 KB |
Output is correct |
37 |
Correct |
50 ms |
4980 KB |
Output is correct |
38 |
Correct |
120 ms |
4716 KB |
Output is correct |
39 |
Correct |
73 ms |
4804 KB |
Output is correct |
40 |
Correct |
116 ms |
6600 KB |
Output is correct |
41 |
Correct |
76 ms |
4724 KB |
Output is correct |
42 |
Correct |
83 ms |
6260 KB |
Output is correct |
43 |
Correct |
125 ms |
4700 KB |
Output is correct |
44 |
Correct |
90 ms |
4736 KB |
Output is correct |
45 |
Correct |
90 ms |
4700 KB |
Output is correct |
46 |
Correct |
86 ms |
4732 KB |
Output is correct |
47 |
Correct |
104 ms |
4680 KB |
Output is correct |
48 |
Correct |
88 ms |
5156 KB |
Output is correct |
49 |
Correct |
106 ms |
4724 KB |
Output is correct |
50 |
Correct |
74 ms |
4720 KB |
Output is correct |
51 |
Correct |
98 ms |
5456 KB |
Output is correct |
52 |
Correct |
131 ms |
6492 KB |
Output is correct |
53 |
Correct |
87 ms |
6244 KB |
Output is correct |
54 |
Correct |
91 ms |
6384 KB |
Output is correct |
55 |
Correct |
88 ms |
4844 KB |
Output is correct |
56 |
Correct |
113 ms |
4736 KB |
Output is correct |
57 |
Correct |
78 ms |
4732 KB |
Output is correct |
58 |
Correct |
110 ms |
4732 KB |
Output is correct |