답안 #1064312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064312 2024-08-18T11:20:07 Z beaconmc Brought Down the Grading Server? (CEOI23_balance) C++14
15 / 100
269 ms 35844 KB
#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;


map<ll,ll> sus;
map<ll,ll> sus2;
map<ll,ll> cnts;


set<vector<ll>> stuff[100000];

int main(){

	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);


	FOR(i,0,n){
		ll a,b;
		cin >> a >> b;

		cores.push_back({a,b});
		stuff[a].insert({b,i});
		stuff[b].insert({a,i});
	}

	ll cnt = 1;
	vector<ll> urg;
	FOR(i,1,n+1) if (stuff[i].size()==1) urg.push_back(i);


	while (cnt < n){
		if (stuff[cnt].size()==0) cnt++;
		ll cur = cnt;

		while (urg.size() && stuff[urg[urg.size()-1]].size() != 1) urg.pop_back();

		if (urg.size()){
			cur = urg[urg.size()-1];
			urg.pop_back();
		}


		while (1){
			if (stuff[cur].size()==0) break;

			vector<ll> node = (*stuff[cur].begin());

			orient[node[1]] = {cur, node[0]};
			stuff[cur].erase(node);
			stuff[node[0]].erase({cur, node[1]});

			if (stuff[cur].size() == 1) urg.push_back(cur);
			if (stuff[node[0]].size() == 1) urg.push_back(node[0]);

			cur = node[0];


			if (cur == cnt) break;
		}
	}
	for (auto&i : orient){
		cout << i[0] << " " << i[1] << endl;
	}






}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4956 KB Correct
2 Incorrect 2 ms 4956 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Correct
2 Correct 2 ms 4952 KB Correct
3 Correct 3 ms 4956 KB Correct
4 Incorrect 2 ms 4940 KB maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 239 ms 34772 KB Correct
2 Correct 215 ms 33792 KB Correct
3 Correct 196 ms 30972 KB Correct
4 Correct 206 ms 31212 KB Correct
5 Correct 227 ms 34048 KB Correct
6 Correct 215 ms 34816 KB Correct
7 Correct 229 ms 33896 KB Correct
8 Correct 182 ms 35684 KB Correct
9 Correct 166 ms 35704 KB Correct
10 Correct 152 ms 35772 KB Correct
11 Correct 161 ms 35588 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 239 ms 34772 KB Correct
2 Correct 215 ms 33792 KB Correct
3 Correct 196 ms 30972 KB Correct
4 Correct 206 ms 31212 KB Correct
5 Correct 227 ms 34048 KB Correct
6 Correct 215 ms 34816 KB Correct
7 Correct 229 ms 33896 KB Correct
8 Correct 182 ms 35684 KB Correct
9 Correct 166 ms 35704 KB Correct
10 Correct 152 ms 35772 KB Correct
11 Correct 161 ms 35588 KB Correct
12 Correct 202 ms 34868 KB Correct
13 Correct 228 ms 33976 KB Correct
14 Correct 191 ms 30980 KB Correct
15 Correct 269 ms 31332 KB Correct
16 Correct 228 ms 34048 KB Correct
17 Correct 211 ms 34820 KB Correct
18 Correct 199 ms 33816 KB Correct
19 Correct 174 ms 35664 KB Correct
20 Correct 190 ms 35608 KB Correct
21 Correct 156 ms 35844 KB Correct
22 Correct 175 ms 35588 KB Correct
23 Incorrect 256 ms 35072 KB maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4952 KB Correct
2 Correct 2 ms 4952 KB Correct
3 Correct 3 ms 4956 KB Correct
4 Incorrect 2 ms 4940 KB maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4952 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 239 ms 34772 KB Correct
2 Correct 215 ms 33792 KB Correct
3 Correct 196 ms 30972 KB Correct
4 Correct 206 ms 31212 KB Correct
5 Correct 227 ms 34048 KB Correct
6 Correct 215 ms 34816 KB Correct
7 Correct 229 ms 33896 KB Correct
8 Correct 182 ms 35684 KB Correct
9 Correct 166 ms 35704 KB Correct
10 Correct 152 ms 35772 KB Correct
11 Correct 161 ms 35588 KB Correct
12 Incorrect 2 ms 4952 KB Unexpected end of file - int32 expected
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 239 ms 34772 KB Correct
2 Correct 215 ms 33792 KB Correct
3 Correct 196 ms 30972 KB Correct
4 Correct 206 ms 31212 KB Correct
5 Correct 227 ms 34048 KB Correct
6 Correct 215 ms 34816 KB Correct
7 Correct 229 ms 33896 KB Correct
8 Correct 182 ms 35684 KB Correct
9 Correct 166 ms 35704 KB Correct
10 Correct 152 ms 35772 KB Correct
11 Correct 161 ms 35588 KB Correct
12 Correct 202 ms 34868 KB Correct
13 Correct 228 ms 33976 KB Correct
14 Correct 191 ms 30980 KB Correct
15 Correct 269 ms 31332 KB Correct
16 Correct 228 ms 34048 KB Correct
17 Correct 211 ms 34820 KB Correct
18 Correct 199 ms 33816 KB Correct
19 Correct 174 ms 35664 KB Correct
20 Correct 190 ms 35608 KB Correct
21 Correct 156 ms 35844 KB Correct
22 Correct 175 ms 35588 KB Correct
23 Incorrect 256 ms 35072 KB maximum and minimum number of simultaneously evaluated submissions for any single task differ more than one
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4956 KB Correct
2 Incorrect 2 ms 4956 KB Unexpected end of file - int32 expected
3 Halted 0 ms 0 KB -