답안 #733010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733010 2023-04-30T02:22:28 Z nguyentunglam Inside information (BOI21_servers) C++17
5 / 100
2071 ms 64948 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define endl "\n"
#define ii pair<int, int>
using namespace std;
const int N = 4010;
int f[N][N];
int main() {
    #define task ""
    cin.tie(0) -> sync_with_stdio(0);
    if (fopen ("task.inp", "r")) {
        freopen ("task.inp", "r", stdin);
        freopen ("task.ans", "w", stdout);
    }
    if (fopen (task".inp", "r")) {
        freopen (task".inp", "r", stdin);
        freopen (task".out", "w", stdout);
    }
    int n, k; cin >> n >> k;
    k = k + n - 1;
    for(int i = 1; i <= n; i++) f[i][i] = 1;
    while (k--) {
        char c; cin >> c;
        if (c == 'S') {
            int x, y; cin >> x >> y;
            for(int i = 1; i <= n; i++) f[x][i] = f[y][i] = f[x][i] | f[y][i];
        }
        if (c == 'Q') {
            int x, y; cin >> x >> y;
            cout << (f[x][y] ? "yes\n" : "no\n");
        }
        if (c == 'C') {
            int x; cin >> x;
            int ans = 0;
            for(int i = 1; i <= n; i++) ans += f[i][x];
            cout << ans << endl;
        }
    }

}

Compilation message

servers.cpp: In function 'int main()':
servers.cpp:13:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen ("task.inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
servers.cpp:14:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen ("task.ans", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
servers.cpp:17:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
servers.cpp:18:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1728 KB Output is correct
2 Correct 105 ms 64812 KB Output is correct
3 Correct 91 ms 64864 KB Output is correct
4 Correct 84 ms 64716 KB Output is correct
5 Correct 81 ms 64852 KB Output is correct
6 Correct 84 ms 64948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1728 KB Output is correct
2 Correct 105 ms 64812 KB Output is correct
3 Correct 91 ms 64864 KB Output is correct
4 Correct 84 ms 64716 KB Output is correct
5 Correct 81 ms 64852 KB Output is correct
6 Correct 84 ms 64948 KB Output is correct
7 Correct 20 ms 1740 KB Output is correct
8 Correct 1989 ms 64592 KB Output is correct
9 Correct 1956 ms 64716 KB Output is correct
10 Correct 2025 ms 64500 KB Output is correct
11 Correct 2071 ms 64480 KB Output is correct
12 Correct 1975 ms 64648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1796 KB Output is correct
2 Runtime error 52 ms 33268 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 1796 KB Output is correct
2 Runtime error 52 ms 33268 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1680 KB Output is correct
2 Runtime error 53 ms 33236 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1680 KB Output is correct
2 Runtime error 53 ms 33236 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1716 KB Output is correct
2 Runtime error 52 ms 33292 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1716 KB Output is correct
2 Runtime error 52 ms 33292 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1756 KB Output is correct
2 Runtime error 51 ms 33200 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 1756 KB Output is correct
2 Runtime error 51 ms 33200 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1720 KB Output is correct
2 Correct 93 ms 64728 KB Output is correct
3 Correct 72 ms 64756 KB Output is correct
4 Correct 84 ms 64736 KB Output is correct
5 Correct 86 ms 64776 KB Output is correct
6 Correct 83 ms 64844 KB Output is correct
7 Correct 18 ms 1776 KB Output is correct
8 Runtime error 49 ms 33232 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 1720 KB Output is correct
2 Correct 93 ms 64728 KB Output is correct
3 Correct 72 ms 64756 KB Output is correct
4 Correct 84 ms 64736 KB Output is correct
5 Correct 86 ms 64776 KB Output is correct
6 Correct 83 ms 64844 KB Output is correct
7 Correct 18 ms 1776 KB Output is correct
8 Runtime error 49 ms 33232 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -