Submission #149789

# Submission time Handle Problem Language Result Execution time Memory
149789 2019-09-01T07:10:23 Z CHT를 사랑하는 모임(#3587, moonrabbit2, Retro3014, gs18115) On the Grid (FXCUP4_grid) C++17
12 / 100
8 ms 384 KB
#include "grid.h"
#include <bits/stdc++.h>

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 0
#define TEST if(test)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 50;

vector<int> num;
int idx[MAX_N+1];
vector<int> vt;
vector<int> fin;
vector<int> v;

int ans(){
	int ret = PutDisks(v);
	while(!v.empty())	v.pop_back();
	return ret;
}


vector<int> SortDisks(int N) {
	for(int i=0; i<N; i++) num.pb(0);
	for(int i=0; i<N; i++){
		vt.pb(i);
	}
	for(int i=N; i>=1; i--){
		TEST cout<<i<<endl;
		int now;
		for(int j=0; j<vt.size(); j++){
			v.pb(vt[j]);
			for(int k : vt){
				if(k!=vt[j]){
					v.pb(k);
				}
			}
			for(int k = fin.size()-1; k>=0; k--){
				v.pb(fin[k]);
			}
			int t = ans();
			TEST cout<<vt[j]<<" "<<t<<endl;
			if(t==(N-1+i)){
				now = vt[j];
				break;
			}
		}
		while(!vt.empty()){
			if(vt.back()!=now){
				v.pb(vt.back());
			}
			vt.pop_back();
		}
		while(!v.empty()){
			vt.pb(v.back()); v.pop_back();
		}
		fin.pb(now);
		num[now] = i;
		TEST cout<<now<<endl;
	}
	return num;
}

Compilation message

grid.cpp: In function 'std::vector<int> SortDisks(int)':
grid.cpp:49:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j<vt.size(); j++){
                ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Incorrect 8 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Halted 0 ms 0 KB -
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 8 ms 384 KB Output isn't correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 6 ms 384 KB Output is correct