Submission #1868435
Source Code Expand
#include <stdio.h> #include <bits/stdc++.h> #define pb push_back #define pf push_front #define pp pop_back #define sz(a) (int)(a.size()) #define mp make_pair #define F first #define S second #define next _next #define prev _prev #define left _left #define right _right #define y1 _y1 #define all(x) x.begin(), x.end() using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int N = (int)1e6 + 123; const ll INF = (ll)1e18 + 123; const int inf = (int)1e9 + 123; const int MOD = (int)1e9 + 7; void megaRandom() { unsigned int FOR; asm("rdtsc" : "=A"(FOR)); srand(FOR); } int n, m, a[311][311]; set<int> st; int cnt[311], p[311][311]; int main() { megaRandom(); cin >> n >> m; for(int i = 1; i <= n; i ++) { for(int j = 1; j <= m; j ++) { cin >> a[i][j]; p[i][a[i][j]] = j; } } for(int j = 1; j <= m; j ++) st.insert(j); int res = inf; while(sz(st) > 0) { memset(cnt, 0, sizeof cnt); for(int i = 1; i <= n; i ++) { int mn = inf, mn_x = -1; for(auto v : st) if(p[i][v] < mn) mn = p[i][v], mn_x = v; cnt[mn_x] ++; } int mx = -inf, mx_x = -1; for(auto v : st) { if(cnt[v] > mx) mx = cnt[v], mx_x = v; } res = min(res, mx); st.erase(mx_x); } cout << res; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Sports Festival |
User | Aidyn_A |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 1426 Byte |
Status | AC |
Exec Time | 99 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
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 | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | AC | 1 ms | 512 KB |
subtask_1_03.txt | AC | 3 ms | 384 KB |
subtask_1_04.txt | AC | 5 ms | 512 KB |
subtask_1_05.txt | AC | 1 ms | 512 KB |
subtask_1_06.txt | AC | 14 ms | 1024 KB |
subtask_1_07.txt | AC | 15 ms | 1024 KB |
subtask_1_08.txt | AC | 5 ms | 1024 KB |
subtask_1_09.txt | AC | 2 ms | 1024 KB |
subtask_1_10.txt | AC | 11 ms | 384 KB |
subtask_1_11.txt | AC | 19 ms | 384 KB |
subtask_1_12.txt | AC | 5 ms | 256 KB |
subtask_1_13.txt | AC | 31 ms | 512 KB |
subtask_1_14.txt | AC | 99 ms | 1024 KB |
subtask_1_15.txt | AC | 95 ms | 1024 KB |
subtask_1_16.txt | AC | 97 ms | 1024 KB |
subtask_1_17.txt | AC | 99 ms | 1024 KB |
subtask_1_18.txt | AC | 94 ms | 1024 KB |