Submission #408702

# Submission time Handle Problem Language Result Execution time Memory
408702 2021-05-19T14:11:11 Z ly20 Inside information (BOI21_servers) C++17
5 / 100
2672 ms 66544 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4123;
int v[MAXN][MAXN];
int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    k += n - 1;
    for(int i = 1; i <= n; i++) {
        v[i][i] = 1;
    }
    for(int i = 0; i < k; i++) {
        char c;
        scanf(" %c", &c);
        if(c == 'S') {
            int a, b;
            scanf("%d %d", &a, &b);
            for(int j = 1; j <= n; j++) {
                if(v[a][j] == 1 || v[b][j] == 1) {
                    v[a][j] = 1; v[b][j] = 1;
                }
            }
        }
        else if(c == 'Q') {
            int a, b;
            scanf("%d %d", &a, &b);
            if(v[a][b] == 1) printf("yes\n");
            else printf("no\n");
        }
        else {
            int a;
            scanf("%d", &a);
            int resp = 0;
            for(int j = 1; j <= n; j++) resp += v[j][a];
            printf("%d\n", resp);
        }
    }
}

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:26:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |             scanf("%d %d", &a, &b);
      |             ~~~~~^~~~~~~~~~~~~~~~~
servers.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |             scanf("%d", &a);
      |             ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1320 KB Output is correct
2 Correct 102 ms 49668 KB Output is correct
3 Correct 120 ms 65988 KB Output is correct
4 Correct 101 ms 48968 KB Output is correct
5 Correct 87 ms 18232 KB Output is correct
6 Correct 165 ms 66480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1320 KB Output is correct
2 Correct 102 ms 49668 KB Output is correct
3 Correct 120 ms 65988 KB Output is correct
4 Correct 101 ms 48968 KB Output is correct
5 Correct 87 ms 18232 KB Output is correct
6 Correct 165 ms 66480 KB Output is correct
7 Correct 38 ms 892 KB Output is correct
8 Correct 2488 ms 49272 KB Output is correct
9 Correct 2672 ms 65920 KB Output is correct
10 Correct 2508 ms 48672 KB Output is correct
11 Correct 2177 ms 17900 KB Output is correct
12 Correct 2617 ms 66388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1348 KB Output is correct
2 Runtime error 63 ms 34024 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1348 KB Output is correct
2 Runtime error 63 ms 34024 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1380 KB Output is correct
2 Runtime error 64 ms 34124 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1380 KB Output is correct
2 Runtime error 64 ms 34124 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1328 KB Output is correct
2 Runtime error 61 ms 34052 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1328 KB Output is correct
2 Runtime error 61 ms 34052 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1300 KB Output is correct
2 Runtime error 60 ms 34060 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1300 KB Output is correct
2 Runtime error 60 ms 34060 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1348 KB Output is correct
2 Correct 109 ms 49680 KB Output is correct
3 Correct 122 ms 66132 KB Output is correct
4 Correct 102 ms 48872 KB Output is correct
5 Correct 84 ms 18192 KB Output is correct
6 Correct 139 ms 66544 KB Output is correct
7 Correct 39 ms 1752 KB Output is correct
8 Runtime error 62 ms 34072 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1348 KB Output is correct
2 Correct 109 ms 49680 KB Output is correct
3 Correct 122 ms 66132 KB Output is correct
4 Correct 102 ms 48872 KB Output is correct
5 Correct 84 ms 18192 KB Output is correct
6 Correct 139 ms 66544 KB Output is correct
7 Correct 39 ms 1752 KB Output is correct
8 Runtime error 62 ms 34072 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -