Submission #408714

# Submission time Handle Problem Language Result Execution time Memory
408714 2021-05-19T14:20:01 Z ly20 Inside information (BOI21_servers) C++17
0 / 100
45 ms 664 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;
    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(v[a] > v[b] || a == 1) printf("yes\n");
            else printf("no\n");
        }
        else {
            int a;
            scanf("%d", &a);
            if(a != 1) printf("%d\n", id - v[a] + 1);
            else printf("%d\n", id - v[a]);
        }
    }
}

Compilation message

servers.cpp: In function 'int main()':
servers.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf(" %c", &c);
      |         ~~~~~^~~~~~~~~~~
servers.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:23:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d", &a);
      |             ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 580 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 580 KB Output isn't correct
2 Halted 0 ms 0 KB -