Submission #268909

# Submission time Handle Problem Language Result Execution time Memory
268909 2020-08-17T04:17:03 Z 반딧불(#5114) Making Friends on Joitter is Fun (JOI20_joitter2) C++17
1 / 100
5000 ms 888 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m;
bool follow[2002][2002];
int ans;

int main(){
    scanf("%d %d", &n, &m);
    for(int i=1; i<=m; i++){
        int x, y;
        scanf("%d %d", &x, &y);
        if(follow[x][y]){
            printf("%d\n", ans);
            continue;
        }

        follow[x][y] = 1;
        ans++;

        int cnt = n;
        while(cnt--){
            for(int x=1; x<=n; x++){
                for(int y=1; y<=n; y++){
                    for(int z=1; z<=n; z++){
                        if(y!=z && follow[y][x] && follow[x][z] && follow[z][x] && !follow[y][z]){
                            ans++;
                            follow[y][z] = 1;
                        }
                    }
                }
            }
        }

        printf("%d\n", ans);
    }
}

Compilation message

joitter2.cpp: In function 'int main()':
joitter2.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
joitter2.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |         scanf("%d %d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1495 ms 632 KB Output is correct
8 Correct 1586 ms 888 KB Output is correct
9 Correct 1647 ms 472 KB Output is correct
10 Correct 1225 ms 504 KB Output is correct
11 Correct 979 ms 384 KB Output is correct
12 Correct 941 ms 572 KB Output is correct
13 Correct 1191 ms 764 KB Output is correct
14 Correct 1084 ms 500 KB Output is correct
15 Correct 1199 ms 504 KB Output is correct
16 Correct 1365 ms 520 KB Output is correct
17 Correct 1384 ms 420 KB Output is correct
18 Correct 1040 ms 472 KB Output is correct
19 Correct 1069 ms 572 KB Output is correct
20 Correct 1346 ms 384 KB Output is correct
21 Correct 1945 ms 484 KB Output is correct
22 Correct 1422 ms 636 KB Output is correct
23 Correct 1454 ms 504 KB Output is correct
24 Correct 1564 ms 704 KB Output is correct
25 Correct 1492 ms 536 KB Output is correct
26 Correct 905 ms 524 KB Output is correct
27 Correct 888 ms 576 KB Output is correct
28 Correct 858 ms 384 KB Output is correct
29 Correct 864 ms 548 KB Output is correct
30 Correct 909 ms 660 KB Output is correct
31 Correct 913 ms 504 KB Output is correct
32 Correct 1048 ms 632 KB Output is correct
33 Correct 1363 ms 656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1495 ms 632 KB Output is correct
8 Correct 1586 ms 888 KB Output is correct
9 Correct 1647 ms 472 KB Output is correct
10 Correct 1225 ms 504 KB Output is correct
11 Correct 979 ms 384 KB Output is correct
12 Correct 941 ms 572 KB Output is correct
13 Correct 1191 ms 764 KB Output is correct
14 Correct 1084 ms 500 KB Output is correct
15 Correct 1199 ms 504 KB Output is correct
16 Correct 1365 ms 520 KB Output is correct
17 Correct 1384 ms 420 KB Output is correct
18 Correct 1040 ms 472 KB Output is correct
19 Correct 1069 ms 572 KB Output is correct
20 Correct 1346 ms 384 KB Output is correct
21 Correct 1945 ms 484 KB Output is correct
22 Correct 1422 ms 636 KB Output is correct
23 Correct 1454 ms 504 KB Output is correct
24 Correct 1564 ms 704 KB Output is correct
25 Correct 1492 ms 536 KB Output is correct
26 Correct 905 ms 524 KB Output is correct
27 Correct 888 ms 576 KB Output is correct
28 Correct 858 ms 384 KB Output is correct
29 Correct 864 ms 548 KB Output is correct
30 Correct 909 ms 660 KB Output is correct
31 Correct 913 ms 504 KB Output is correct
32 Correct 1048 ms 632 KB Output is correct
33 Correct 1363 ms 656 KB Output is correct
34 Execution timed out 5054 ms 824 KB Time limit exceeded
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1495 ms 632 KB Output is correct
8 Correct 1586 ms 888 KB Output is correct
9 Correct 1647 ms 472 KB Output is correct
10 Correct 1225 ms 504 KB Output is correct
11 Correct 979 ms 384 KB Output is correct
12 Correct 941 ms 572 KB Output is correct
13 Correct 1191 ms 764 KB Output is correct
14 Correct 1084 ms 500 KB Output is correct
15 Correct 1199 ms 504 KB Output is correct
16 Correct 1365 ms 520 KB Output is correct
17 Correct 1384 ms 420 KB Output is correct
18 Correct 1040 ms 472 KB Output is correct
19 Correct 1069 ms 572 KB Output is correct
20 Correct 1346 ms 384 KB Output is correct
21 Correct 1945 ms 484 KB Output is correct
22 Correct 1422 ms 636 KB Output is correct
23 Correct 1454 ms 504 KB Output is correct
24 Correct 1564 ms 704 KB Output is correct
25 Correct 1492 ms 536 KB Output is correct
26 Correct 905 ms 524 KB Output is correct
27 Correct 888 ms 576 KB Output is correct
28 Correct 858 ms 384 KB Output is correct
29 Correct 864 ms 548 KB Output is correct
30 Correct 909 ms 660 KB Output is correct
31 Correct 913 ms 504 KB Output is correct
32 Correct 1048 ms 632 KB Output is correct
33 Correct 1363 ms 656 KB Output is correct
34 Execution timed out 5054 ms 824 KB Time limit exceeded
35 Halted 0 ms 0 KB -