Submission #1041526

# Submission time Handle Problem Language Result Execution time Memory
1041526 2024-08-02T05:10:30 Z 김은성(#11000) Brought Down the Grading Server? (CEOI23_balance) C++17
10 / 100
2000 ms 8792 KB
#include <bits/stdc++.h>
using namespace std;
int n, s, t, *a[100009];
void recur(int v){
	if(v == n){
		int i, j, k;
		for(i=1; i<=t; i++){
			int mx = -1, mn = n+1;
			for(j=0; j<s; j++){
				int cnt = 0;
				for(k=0; k<n; k++){
					if(a[k][j] == i)
						cnt++;
				}
				mx = max(mx, cnt);
				mn = min(mn, cnt);
			}
			if(mx - mn >= 2)
				break;
		}
		if(i > t){
			for(i=0; i<n; i++)
				printf("%d %d\n", a[i][0], a[i][1]);
			exit(0);
		}
		return;
	}
	recur(v+1);
	swap(a[v][0], a[v][1]);
	recur(v+1);
}
int main(){
	int i, j;
	scanf("%d %d %d", &n, &s, &t);
	for(i=0; i<n; i++){
		a[i] = (int*)malloc(s * sizeof(int));
		for(j=0; j<s; j++)
			scanf("%d", &a[i][j]);
	}
	recur(0);
}

Compilation message

balance.cpp: In function 'int main()':
balance.cpp:34:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |  scanf("%d %d %d", &n, &s, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
balance.cpp:38:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |    scanf("%d", &a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 1 ms 348 KB Correct
3 Correct 1 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 1 ms 348 KB Correct
6 Correct 2 ms 348 KB Correct
7 Correct 2 ms 348 KB Correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 8792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 8792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct
2 Correct 1 ms 348 KB Correct
3 Correct 1 ms 348 KB Correct
4 Correct 0 ms 348 KB Correct
5 Correct 1 ms 348 KB Correct
6 Correct 2 ms 348 KB Correct
7 Correct 2 ms 348 KB Correct
8 Execution timed out 2013 ms 8792 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 8792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 8792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -