답안 #733873

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
733873 2023-05-01T11:26:55 Z mosiashvililuka 조이터에서 친구를 만드는건 재밌어 (JOI20_joitter2) C++14
1 / 100
5000 ms 940 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,bo[2009][2009],pas,t,tes;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>tes;
    for(t=1; t<=tes; t++){
        cin>>c>>d;
        if(bo[c][d]==0){
            bo[c][d]=1;pas++;
        }
        while(1){
            c=0;d=0;e=0;
            for(i=1; i<=a; i++){
                for(j=i+1; j<=a; j++){
                    if(bo[i][j]==0||bo[j][i]==0) continue;
                    for(ii=1; ii<=a; ii++){
                        if(ii==i||ii==j) continue;
                        if(bo[ii][i]==0&&bo[ii][j]==1){
                            e=ii;c=i;d=j;
                            break;
                        }
                        if(bo[ii][j]==0&&bo[ii][i]==1){
                            e=ii;c=j;d=i;
                            break;
                        }
                    }
                    if(e!=0) break;
                }
                if(e!=0) break;
            }
            if(e==0) break;
            bo[e][c]=1;pas++;
        }
        cout<<pas<<"\n";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 260 ms 544 KB Output is correct
8 Correct 250 ms 556 KB Output is correct
9 Correct 278 ms 560 KB Output is correct
10 Correct 9 ms 460 KB Output is correct
11 Correct 7 ms 468 KB Output is correct
12 Correct 7 ms 468 KB Output is correct
13 Correct 11 ms 468 KB Output is correct
14 Correct 10 ms 460 KB Output is correct
15 Correct 6 ms 528 KB Output is correct
16 Correct 10 ms 468 KB Output is correct
17 Correct 12 ms 500 KB Output is correct
18 Correct 8 ms 468 KB Output is correct
19 Correct 9 ms 544 KB Output is correct
20 Correct 26 ms 456 KB Output is correct
21 Correct 275 ms 556 KB Output is correct
22 Correct 31 ms 532 KB Output is correct
23 Correct 115 ms 548 KB Output is correct
24 Correct 40 ms 528 KB Output is correct
25 Correct 199 ms 548 KB Output is correct
26 Correct 9 ms 468 KB Output is correct
27 Correct 6 ms 464 KB Output is correct
28 Correct 6 ms 468 KB Output is correct
29 Correct 8 ms 468 KB Output is correct
30 Correct 14 ms 548 KB Output is correct
31 Correct 207 ms 548 KB Output is correct
32 Correct 9 ms 468 KB Output is correct
33 Correct 209 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 260 ms 544 KB Output is correct
8 Correct 250 ms 556 KB Output is correct
9 Correct 278 ms 560 KB Output is correct
10 Correct 9 ms 460 KB Output is correct
11 Correct 7 ms 468 KB Output is correct
12 Correct 7 ms 468 KB Output is correct
13 Correct 11 ms 468 KB Output is correct
14 Correct 10 ms 460 KB Output is correct
15 Correct 6 ms 528 KB Output is correct
16 Correct 10 ms 468 KB Output is correct
17 Correct 12 ms 500 KB Output is correct
18 Correct 8 ms 468 KB Output is correct
19 Correct 9 ms 544 KB Output is correct
20 Correct 26 ms 456 KB Output is correct
21 Correct 275 ms 556 KB Output is correct
22 Correct 31 ms 532 KB Output is correct
23 Correct 115 ms 548 KB Output is correct
24 Correct 40 ms 528 KB Output is correct
25 Correct 199 ms 548 KB Output is correct
26 Correct 9 ms 468 KB Output is correct
27 Correct 6 ms 464 KB Output is correct
28 Correct 6 ms 468 KB Output is correct
29 Correct 8 ms 468 KB Output is correct
30 Correct 14 ms 548 KB Output is correct
31 Correct 207 ms 548 KB Output is correct
32 Correct 9 ms 468 KB Output is correct
33 Correct 209 ms 584 KB Output is correct
34 Execution timed out 5045 ms 940 KB Time limit exceeded
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 260 ms 544 KB Output is correct
8 Correct 250 ms 556 KB Output is correct
9 Correct 278 ms 560 KB Output is correct
10 Correct 9 ms 460 KB Output is correct
11 Correct 7 ms 468 KB Output is correct
12 Correct 7 ms 468 KB Output is correct
13 Correct 11 ms 468 KB Output is correct
14 Correct 10 ms 460 KB Output is correct
15 Correct 6 ms 528 KB Output is correct
16 Correct 10 ms 468 KB Output is correct
17 Correct 12 ms 500 KB Output is correct
18 Correct 8 ms 468 KB Output is correct
19 Correct 9 ms 544 KB Output is correct
20 Correct 26 ms 456 KB Output is correct
21 Correct 275 ms 556 KB Output is correct
22 Correct 31 ms 532 KB Output is correct
23 Correct 115 ms 548 KB Output is correct
24 Correct 40 ms 528 KB Output is correct
25 Correct 199 ms 548 KB Output is correct
26 Correct 9 ms 468 KB Output is correct
27 Correct 6 ms 464 KB Output is correct
28 Correct 6 ms 468 KB Output is correct
29 Correct 8 ms 468 KB Output is correct
30 Correct 14 ms 548 KB Output is correct
31 Correct 207 ms 548 KB Output is correct
32 Correct 9 ms 468 KB Output is correct
33 Correct 209 ms 584 KB Output is correct
34 Execution timed out 5045 ms 940 KB Time limit exceeded
35 Halted 0 ms 0 KB -