Submission #742474

# Submission time Handle Problem Language Result Execution time Memory
742474 2023-05-16T09:50:11 Z penguin133 The Collection Game (BOI21_swaps) C++17
15 / 100
65 ms 1440 KB
#include <bits/stdc++.h>
using namespace std;
 
//#define int long long
#include "swaps.h"
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int cnt[505], vis[505], stuf[505][505], ans[505];
bool cmp(int a, int b){
	return cnt[a] > cnt[b];
}
void solve(int N, int V) {
   for(int i=1;i<N;i++){
	   vector <pi> bru;
	   for(int j=1;j<=N;j++)vis[j] = 0;
	   for(int j=1;j<=N;j++){
		   int tmp = j + i;
		   if(tmp > N)tmp -= N;
		   if(!stuf[j][tmp] && !vis[j] && !vis[tmp]){
			   schedule(j, tmp);
			   vis[j] = 1;
			   vis[tmp] = 1;
             	stuf[tmp][j] = stuf[j][tmp] = 1;
			   bru.push_back({j, tmp});
		   }
	   }
	   vector <int> ret = visit();
	   for(int j=0;j<(int)ret.size();j++){
		   if(ret[j])cnt[bru[j].fi]++;
		   else cnt[bru[j].se]++;
	   }
   }
   for(int i=1;i<N;i++){
	   vector <pi> bru;
	   for(int j=1;j<=N;j++)vis[j] = 0;
	   for(int j=1;j<=N;j++){
		   int tmp = j + i;
		   if(tmp > N)tmp -= N;
		   if(!stuf[j][tmp] && !vis[j] && !vis[tmp]){
			   schedule(j, tmp);
			   vis[j] = 1;
			   vis[tmp] = 1;
             stuf[tmp][j] = stuf[j][tmp] = 1;
			   bru.push_back({j, tmp});
		   }
	   }
	   vector <int> ret = visit();
	   for(int j=0;j<(int)ret.size();j++){
		   if(ret[j])cnt[bru[j].fi]++;
		   else cnt[bru[j].se]++;
	   }
   }
   vector <int> brr;
   for(int i=1;i<=N;i++)brr.push_back(i);
   sort(brr.begin(), brr.end(), cmp);
   answer(brr);
   
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 512 KB Correct
3 Correct 15 ms 820 KB Correct
4 Correct 49 ms 1312 KB Correct
5 Correct 44 ms 1308 KB Correct
6 Correct 50 ms 1312 KB Correct
7 Correct 47 ms 1312 KB Correct
8 Correct 49 ms 1312 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 516 KB Correct
3 Correct 20 ms 816 KB Correct
4 Correct 50 ms 1308 KB Correct
5 Correct 46 ms 1328 KB Correct
6 Correct 65 ms 1372 KB Correct
7 Correct 45 ms 1388 KB Correct
8 Correct 49 ms 1304 KB Correct
9 Correct 53 ms 1316 KB Correct
10 Correct 47 ms 1440 KB Correct
11 Correct 46 ms 1316 KB Correct
12 Correct 53 ms 1312 KB Correct
13 Correct 49 ms 1396 KB Correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -