Submission #1041614

# Submission time Handle Problem Language Result Execution time Memory
1041614 2024-08-02T06:15:26 Z 김은성(#11000) Brought Down the Grading Server? (CEOI23_balance) C++17
0 / 100
2000 ms 18260 KB
#include <bits/stdc++.h>
using namespace std;
int n, s, t, *a[100009];
vector<pair<int, int> > graph[100009];
int ans[100009];
int deg[100009];	//out - in
void findcycle(int v){
	for(auto [idx, u]: graph[v]){
		if(ans[idx] != -1)
			continue;
		ans[idx] = v;
		deg[v]++;
		deg[u]--;
		findcycle(u);
	}
}
int main(){
	int i, j;
	scanf("%d %d %d", &n, &s, &t);
	memset(ans, -1, sizeof(ans));
	for(i=0; i<n; i++){
		a[i] = (int*)malloc(s * sizeof(int));
		for(j=0; j<s; j++){
			scanf("%d", &a[i][j]);
		}
		graph[a[i][0]].push_back(make_pair(i, a[i][1]));
		graph[a[i][1]].push_back(make_pair(i, a[i][0]));
	}
	for(i=1; i<=t; i++){
		findcycle(i);
	}
	for(i=1; i<=t; i++){
		assert(-1 <= deg[i] && deg[i] <= 1);
	}
	for(i=0; i<n; i++){
		printf("%d %d\n", ans[i], a[i][0] + a[i][1] - ans[i]);
	}
}

Compilation message

balance.cpp: In function 'int main()':
balance.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%d %d %d", &n, &s, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
balance.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Correct
2 Incorrect 1 ms 3164 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3160 KB Correct
2 Runtime error 4 ms 6492 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 17452 KB Correct
2 Correct 753 ms 18260 KB Correct
3 Correct 97 ms 16488 KB Correct
4 Correct 1756 ms 15332 KB Correct
5 Execution timed out 2047 ms 16876 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 17452 KB Correct
2 Correct 753 ms 18260 KB Correct
3 Correct 97 ms 16488 KB Correct
4 Correct 1756 ms 15332 KB Correct
5 Execution timed out 2047 ms 16876 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3160 KB Correct
2 Runtime error 4 ms 6492 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3160 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3160 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 3160 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 17452 KB Correct
2 Correct 753 ms 18260 KB Correct
3 Correct 97 ms 16488 KB Correct
4 Correct 1756 ms 15332 KB Correct
5 Execution timed out 2047 ms 16876 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 17452 KB Correct
2 Correct 753 ms 18260 KB Correct
3 Correct 97 ms 16488 KB Correct
4 Correct 1756 ms 15332 KB Correct
5 Execution timed out 2047 ms 16876 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3164 KB Correct
2 Incorrect 1 ms 3164 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -