# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
408720 | 2021-05-19T14:31:25 Z | ly20 | Inside information (BOI21_servers) | C++17 | 90 ms | 3924 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 121234; int v[MAXN]; int main() { int n, k; scanf("%d %d", &n, &k); k += n - 1; for(int i = 1; i <= n; i++) v[i] = -1; int id = 0; v[1] = 0; id++; for(int i = 0; i < k; i++) { char c; scanf(" %c", &c); if(c == 'S') { int a, b; scanf("%d %d", &a, &b); if(a != 1) swap(a, b); v[b] = id++; } else if(c == 'Q') { int a, b; scanf("%d %d", &a, &b); if(a == b) printf("yes\n"); else if(v[b] == -1 || v[a] == -1 ) printf("no\n"); else if(v[a] > v[b] || (a == 1 && v[b] != 0)) printf("yes\n"); else printf("no\n"); } else { int a; scanf("%d", &a); if(v[a] == -1) printf("1\n"); else if(a != 1) printf("%d\n", id - v[a] + 1); else printf("%d\n", id - v[a]); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 49 ms | 580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 552 KB | Output is correct |
2 | Correct | 86 ms | 3904 KB | Output is correct |
3 | Correct | 88 ms | 3924 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 552 KB | Output is correct |
2 | Correct | 86 ms | 3904 KB | Output is correct |
3 | Correct | 88 ms | 3924 KB | Output is correct |
4 | Correct | 38 ms | 724 KB | Output is correct |
5 | Correct | 90 ms | 3880 KB | Output is correct |
6 | Correct | 78 ms | 3132 KB | Output is correct |
7 | Correct | 75 ms | 3272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 40 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 40 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 616 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 616 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 580 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 39 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |