Submission #6886165


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int Rand(int x) {return rand() * rand() % x + 1;}

#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
const int INF = 0x3f3f3f3f, N = 305, M = 2000005, MOD = 1e9 + 7;

int a[N][N], vis[N], has[N];
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
//	freopen("o1.txt","w",stdout);
#endif
//	srand((unsigned)time(false));
	ios::sync_with_stdio(false); cin.tie(0), cout.tie(0);
	int n, m;
	cin >> n >> m;
	for(int i = 1;i <= n;i ++) {
		for(int j = 1;j <= m;j ++) {
			cin >> a[i][j];
		}
		has[a[i][1]] ++;
	}
	int ans = INF; 
	while(1) {
		int maxn = 0, k = -1;
		for(int i = 1;i <= m;i ++) if(!vis[i] && has[i] > maxn) maxn = has[i], k = i;
		if(k == -1) break;
		ans = min(ans, maxn);
		for(int i = 1;i <= m;i ++) has[i] = 0; 
		vis[k] = 1;
		for(int i = 1;i <= n;i ++) {
			for(int j = 1;j <= m;j ++) if(!vis[a[i][j]]) {
				has[a[i][j]] ++;
				break;
			}
		}
	}
	cout << ans << endl;
#ifndef ONLINE_JUDGE
    cout << "time cost:" << (double)clock()/CLOCKS_PER_SEC << "ms" << endl;
#endif
	return 0;
}

Submission Info

Submission Time
Task B - Sports Festival
User luogu_bot4
Language C++ (GCC 5.4.1)
Score 0
Code Size 1214 Byte
Status RE
Exec Time 100 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:29: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  freopen("in.txt","r",stdin);
                             ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
RE × 3
RE × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt
Case Name Status Exec Time Memory
sample_01.txt RE 98 ms 256 KB
sample_02.txt RE 97 ms 256 KB
sample_03.txt RE 99 ms 256 KB
subtask_1_01.txt RE 97 ms 256 KB
subtask_1_02.txt RE 97 ms 256 KB
subtask_1_03.txt RE 97 ms 256 KB
subtask_1_04.txt RE 99 ms 256 KB
subtask_1_05.txt RE 97 ms 256 KB
subtask_1_06.txt RE 97 ms 256 KB
subtask_1_07.txt RE 97 ms 256 KB
subtask_1_08.txt RE 97 ms 256 KB
subtask_1_09.txt RE 98 ms 256 KB
subtask_1_10.txt RE 98 ms 256 KB
subtask_1_11.txt RE 98 ms 256 KB
subtask_1_12.txt RE 98 ms 256 KB
subtask_1_13.txt RE 100 ms 256 KB
subtask_1_14.txt RE 99 ms 256 KB
subtask_1_15.txt RE 97 ms 256 KB
subtask_1_16.txt RE 97 ms 256 KB
subtask_1_17.txt RE 96 ms 256 KB
subtask_1_18.txt RE 98 ms 256 KB