답안 #1041704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041704 2024-08-02T07:17:20 Z 정희우(#11003) Brought Down the Grading Server? (CEOI23_balance) C++17
35 / 100
54 ms 15064 KB
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
using lint = long long;
using vint = vector<int>;
using pii = pair<int,int>;

const int MAX_N=100010;

struct Edge
{
    int v,i,t;
};


int n,s,m;
vector<vint> arr;
int check[MAX_N];
vector<Edge> edge[MAX_N];
int ei[MAX_N];

void dfs(int v,int t)
{
    for(;ei[v]<edge[v].size();ei[v]++)
    {
        Edge e=edge[v][ei[v]];
        if(check[e.i]==0)
        {
            check[e.i]=1;
            if(e.t^t)swap(arr[e.i][0],arr[e.i][1]);
            return dfs(e.v,t);
        }
    }
}

int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> s >> m;
    if(s!=2)return 0;
    arr.resize(n);
    for(int i=0;i<n;i++)
    {
        arr[i].resize(s);
        for(int j=0;j<s;j++)
            cin >> arr[i][j];
        int u=arr[i][0],v=arr[i][1];
        edge[u].push_back({v,i,0});
        edge[v].push_back({u,i,1});
    }
    for(int i=1;i<=m;i++)
    {
        int t=0;
        while(ei[i]<edge[i].size())
        {
            dfs(i,t);
            t=1-t;
        }
    }
    for(int i=0;i<n;i++,cout << '\n')
        for(int j=0;j<s;j++)
            cout << arr[i][j] << ' ';
    return 0;
}

Compilation message

balance.cpp: In function 'void dfs(int, int)':
balance.cpp:26:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Edge>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(;ei[v]<edge[v].size();ei[v]++)
      |          ~~~~~^~~~~~~~~~~~~~~
balance.cpp: In function 'int main()':
balance.cpp:56:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Edge>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         while(ei[i]<edge[i].size())
      |               ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2904 KB Correct
2 Incorrect 1 ms 2908 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2908 KB Correct
2 Correct 0 ms 2908 KB Correct
3 Correct 1 ms 2908 KB Correct
4 Correct 0 ms 2908 KB Correct
5 Correct 0 ms 2908 KB Correct
6 Correct 0 ms 2908 KB Correct
7 Correct 0 ms 2908 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 13348 KB Correct
2 Correct 38 ms 13072 KB Correct
3 Correct 38 ms 12368 KB Correct
4 Correct 27 ms 11776 KB Correct
5 Correct 40 ms 13064 KB Correct
6 Correct 39 ms 14208 KB Correct
7 Correct 37 ms 13652 KB Correct
8 Correct 35 ms 13752 KB Correct
9 Correct 38 ms 14160 KB Correct
10 Correct 33 ms 14172 KB Correct
11 Correct 31 ms 14164 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 13348 KB Correct
2 Correct 38 ms 13072 KB Correct
3 Correct 38 ms 12368 KB Correct
4 Correct 27 ms 11776 KB Correct
5 Correct 40 ms 13064 KB Correct
6 Correct 39 ms 14208 KB Correct
7 Correct 37 ms 13652 KB Correct
8 Correct 35 ms 13752 KB Correct
9 Correct 38 ms 14160 KB Correct
10 Correct 33 ms 14172 KB Correct
11 Correct 31 ms 14164 KB Correct
12 Correct 41 ms 14164 KB Correct
13 Correct 35 ms 13836 KB Correct
14 Correct 31 ms 12268 KB Correct
15 Correct 23 ms 12032 KB Correct
16 Correct 36 ms 13832 KB Correct
17 Correct 38 ms 13908 KB Correct
18 Correct 40 ms 14160 KB Correct
19 Correct 34 ms 14164 KB Correct
20 Correct 36 ms 14128 KB Correct
21 Correct 33 ms 14176 KB Correct
22 Correct 34 ms 14160 KB Correct
23 Correct 43 ms 15064 KB Correct
24 Correct 25 ms 11868 KB Correct
25 Correct 38 ms 13648 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2908 KB Correct
2 Correct 0 ms 2908 KB Correct
3 Correct 1 ms 2908 KB Correct
4 Correct 0 ms 2908 KB Correct
5 Correct 0 ms 2908 KB Correct
6 Correct 0 ms 2908 KB Correct
7 Correct 0 ms 2908 KB Correct
8 Correct 54 ms 13348 KB Correct
9 Correct 38 ms 13072 KB Correct
10 Correct 38 ms 12368 KB Correct
11 Correct 27 ms 11776 KB Correct
12 Correct 40 ms 13064 KB Correct
13 Correct 39 ms 14208 KB Correct
14 Correct 37 ms 13652 KB Correct
15 Correct 35 ms 13752 KB Correct
16 Correct 38 ms 14160 KB Correct
17 Correct 33 ms 14172 KB Correct
18 Correct 31 ms 14164 KB Correct
19 Correct 41 ms 14164 KB Correct
20 Correct 35 ms 13836 KB Correct
21 Correct 31 ms 12268 KB Correct
22 Correct 23 ms 12032 KB Correct
23 Correct 36 ms 13832 KB Correct
24 Correct 38 ms 13908 KB Correct
25 Correct 40 ms 14160 KB Correct
26 Correct 34 ms 14164 KB Correct
27 Correct 36 ms 14128 KB Correct
28 Correct 33 ms 14176 KB Correct
29 Correct 34 ms 14160 KB Correct
30 Correct 43 ms 15064 KB Correct
31 Correct 25 ms 11868 KB Correct
32 Correct 38 ms 13648 KB Correct
33 Correct 1 ms 2904 KB Correct
34 Correct 0 ms 2908 KB Correct
35 Correct 1 ms 2908 KB Correct
36 Correct 1 ms 2908 KB Correct
37 Correct 1 ms 2908 KB Correct
38 Correct 1 ms 2908 KB Correct
39 Correct 1 ms 2908 KB Correct
40 Correct 39 ms 13328 KB Correct
41 Correct 43 ms 13064 KB Correct
42 Correct 32 ms 12372 KB Correct
43 Correct 23 ms 11612 KB Correct
44 Correct 34 ms 12872 KB Correct
45 Correct 44 ms 13396 KB Correct
46 Correct 42 ms 13400 KB Correct
47 Correct 43 ms 13412 KB Correct
48 Correct 39 ms 13396 KB Correct
49 Correct 29 ms 13392 KB Correct
50 Correct 28 ms 13404 KB Correct
51 Correct 42 ms 14160 KB Correct
52 Correct 25 ms 11844 KB Correct
53 Correct 39 ms 13652 KB Correct
54 Correct 23 ms 8792 KB Correct
55 Correct 1 ms 3164 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2904 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2904 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2904 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 13348 KB Correct
2 Correct 38 ms 13072 KB Correct
3 Correct 38 ms 12368 KB Correct
4 Correct 27 ms 11776 KB Correct
5 Correct 40 ms 13064 KB Correct
6 Correct 39 ms 14208 KB Correct
7 Correct 37 ms 13652 KB Correct
8 Correct 35 ms 13752 KB Correct
9 Correct 38 ms 14160 KB Correct
10 Correct 33 ms 14172 KB Correct
11 Correct 31 ms 14164 KB Correct
12 Incorrect 1 ms 2904 KB Unexpected end of file - int32 expected
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 13348 KB Correct
2 Correct 38 ms 13072 KB Correct
3 Correct 38 ms 12368 KB Correct
4 Correct 27 ms 11776 KB Correct
5 Correct 40 ms 13064 KB Correct
6 Correct 39 ms 14208 KB Correct
7 Correct 37 ms 13652 KB Correct
8 Correct 35 ms 13752 KB Correct
9 Correct 38 ms 14160 KB Correct
10 Correct 33 ms 14172 KB Correct
11 Correct 31 ms 14164 KB Correct
12 Correct 41 ms 14164 KB Correct
13 Correct 35 ms 13836 KB Correct
14 Correct 31 ms 12268 KB Correct
15 Correct 23 ms 12032 KB Correct
16 Correct 36 ms 13832 KB Correct
17 Correct 38 ms 13908 KB Correct
18 Correct 40 ms 14160 KB Correct
19 Correct 34 ms 14164 KB Correct
20 Correct 36 ms 14128 KB Correct
21 Correct 33 ms 14176 KB Correct
22 Correct 34 ms 14160 KB Correct
23 Correct 43 ms 15064 KB Correct
24 Correct 25 ms 11868 KB Correct
25 Correct 38 ms 13648 KB Correct
26 Incorrect 1 ms 2904 KB Unexpected end of file - int32 expected
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2904 KB Correct
2 Incorrect 1 ms 2908 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -