Submission #1069869

#TimeUsernameProblemLanguageResultExecution timeMemory
1069869AbitoBrought Down the Grading Server? (CEOI23_balance)C++17
0 / 100
2075 ms23128 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=5e5+5; int n,t,s,f[2][N]; vector<int> a[N]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n>>s>>t; for (int i=0;i<n;i++){ a[i].resize(s); for (int j=0;j<s;j++) cin>>a[i][j]; } for (int mask=0;mask<(1<<n);mask++){ for (int i=0;i<n;i++) if (mask&(1<<i)) swap(a[i][0],a[i][1]); memset(f,0,sizeof(f)); for (int i=0;i<n;i++) f[0][a[i][0]]++,f[1][a[i][1]]++; bool ok=true; for (int i=1;i<=t;i++) ok&=(abs(f[0][i]-f[1][i])<=1); if (ok){ for (int i=0;i<n;i++){ for (int j=0;j<2;j++) cout<<a[i][j]<<' '; cout<<endl; } return 0; } for (int i=0;i<n;i++) if (mask&(1<<i)) swap(a[i][0],a[i][1]); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...