Submission #1081231

#TimeUsernameProblemLanguageResultExecution timeMemory
1081231beaconmcBrought Down the Grading Server? (CEOI23_balance)C++14
15 / 100
2065 ms38076 KiB
#include <bits/stdc++.h>
 
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;




multiset<ll> stuff[100005];
vector<ll> ans[100005];

bool used[100005];
map<ll,ll> match;
vector<ll> reals;


bool khun(ll a){

	if (used[a]) return false;
	used[a] = true;
	for (auto&i : stuff[a]){
		if (match.count(i)==0 || khun(match[i])){
			match[i] = a;
			return true;
		}
	}
	return false;
}
ll cnts[100005];

int main(){
	FOR(i,0,100005) match[i] = -1, used[i] = false, cnts[i] = 0;

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,s,t;
	cin >> n >> s >> t;
	vector<vector<ll>> cores;
	vector<vector<ll>> orient(n);
	ll cnt = 0;
	FOR(i,0,n){
		FOR(j,0,s){
			ll temp;
			cin >> temp;
			cnts[temp]++;

			ll idk = ((cnts[temp]-1)/s)*1000000 + temp;
			stuff[i].insert(idk);
			reals.push_back(temp);
		}
	}


	FOR(i,0,s){
		match.clear();

		FOR(j,0,n){
			FOR(p,0,n+1) used[p] = false;
			khun(j);
		}

		for (auto&i : match){

			ans[i.second].push_back(i.first%1000000);
			stuff[i.second].erase(stuff[i.second].find(i.first));
		}


	}

	FOR(i,0,n){

		for (auto&k : ans[i])cout << k << " ";
			cout << "\n";
	}





}

Compilation message (stderr)

balance.cpp: In function 'int main()':
balance.cpp:43:5: warning: unused variable 'cnt' [-Wunused-variable]
   43 |  ll cnt = 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...