# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1041794 |
2024-08-02T08:24:22 Z |
12345678 |
Tenis (COI19_tenis) |
C++17 |
|
500 ms |
2292 KB |
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5;
int n, q, p[4][nx], t, x, a, b, opr, mx[nx], res;
void solve()
{
for (int i=1; i<=n; i++) mx[i]=0;
for (int i=1; i<=n; i++) mx[min({p[1][i], p[2][i], p[3][i]})]++;
res=n+1;
for (int i=n; i>=1; i--) mx[i]+=mx[i+1];
for (int i=n; i>1; i--) if (mx[i]==(n-i+1)) res=i;
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>q;
for (int i=1; i<=n; i++) cin>>x, p[1][x]=i;
for (int i=1; i<=n; i++) cin>>x, p[2][x]=i;
for (int i=1; i<=n; i++) cin>>x, p[3][x]=i;
solve();
while (q--)
{
cin>>opr;
if (opr==1) cin>>a, cout<<(min({p[1][a], p[2][a], p[3][a]})<res?"DA\n":"NE\n");
else cin>>t>>a>>b, swap(p[t][a], p[t][b]), solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
372 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
372 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
372 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
15 ms |
1908 KB |
Output is correct |
14 |
Correct |
16 ms |
1884 KB |
Output is correct |
15 |
Correct |
16 ms |
2036 KB |
Output is correct |
16 |
Correct |
15 ms |
1884 KB |
Output is correct |
17 |
Correct |
13 ms |
1900 KB |
Output is correct |
18 |
Correct |
16 ms |
1884 KB |
Output is correct |
19 |
Correct |
15 ms |
1896 KB |
Output is correct |
20 |
Correct |
17 ms |
1768 KB |
Output is correct |
21 |
Correct |
15 ms |
1884 KB |
Output is correct |
22 |
Correct |
14 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
2140 KB |
Output is correct |
2 |
Correct |
26 ms |
2140 KB |
Output is correct |
3 |
Correct |
22 ms |
2268 KB |
Output is correct |
4 |
Correct |
26 ms |
2136 KB |
Output is correct |
5 |
Correct |
22 ms |
2140 KB |
Output is correct |
6 |
Correct |
22 ms |
2292 KB |
Output is correct |
7 |
Correct |
23 ms |
2228 KB |
Output is correct |
8 |
Correct |
22 ms |
2140 KB |
Output is correct |
9 |
Correct |
26 ms |
2136 KB |
Output is correct |
10 |
Correct |
22 ms |
2136 KB |
Output is correct |
11 |
Correct |
22 ms |
2140 KB |
Output is correct |
12 |
Correct |
23 ms |
2252 KB |
Output is correct |
13 |
Correct |
43 ms |
2136 KB |
Output is correct |
14 |
Correct |
43 ms |
2128 KB |
Output is correct |
15 |
Correct |
23 ms |
2148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
372 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
15 ms |
1908 KB |
Output is correct |
14 |
Correct |
16 ms |
1884 KB |
Output is correct |
15 |
Correct |
16 ms |
2036 KB |
Output is correct |
16 |
Correct |
15 ms |
1884 KB |
Output is correct |
17 |
Correct |
13 ms |
1900 KB |
Output is correct |
18 |
Correct |
16 ms |
1884 KB |
Output is correct |
19 |
Correct |
15 ms |
1896 KB |
Output is correct |
20 |
Correct |
17 ms |
1768 KB |
Output is correct |
21 |
Correct |
15 ms |
1884 KB |
Output is correct |
22 |
Correct |
14 ms |
1884 KB |
Output is correct |
23 |
Correct |
22 ms |
2140 KB |
Output is correct |
24 |
Correct |
26 ms |
2140 KB |
Output is correct |
25 |
Correct |
22 ms |
2268 KB |
Output is correct |
26 |
Correct |
26 ms |
2136 KB |
Output is correct |
27 |
Correct |
22 ms |
2140 KB |
Output is correct |
28 |
Correct |
22 ms |
2292 KB |
Output is correct |
29 |
Correct |
23 ms |
2228 KB |
Output is correct |
30 |
Correct |
22 ms |
2140 KB |
Output is correct |
31 |
Correct |
26 ms |
2136 KB |
Output is correct |
32 |
Correct |
22 ms |
2136 KB |
Output is correct |
33 |
Correct |
22 ms |
2140 KB |
Output is correct |
34 |
Correct |
23 ms |
2252 KB |
Output is correct |
35 |
Correct |
43 ms |
2136 KB |
Output is correct |
36 |
Correct |
43 ms |
2128 KB |
Output is correct |
37 |
Correct |
23 ms |
2148 KB |
Output is correct |
38 |
Execution timed out |
1078 ms |
2000 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |