Submission #124877

# Submission time Handle Problem Language Result Execution time Memory
124877 2019-07-04T05:04:27 Z khulegub Gondola (IOI14_gondola) C++14
0 / 100
3 ms 504 KB
#include "gondola.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
using namespace std;
typedef long long i64;
typedef pair<int, int> pii;




int valid(int n, int arr[]){
	vector<pii> rep;
	vector<pii> v;
	for (int i = 0; i < n; i++){
		arr[i]--;
		// cout << arr[i] << ' ';
		if (arr[i] >= n){
			rep.pb(mp(arr[i] - n, i) );
		}
		else v.pb(mp(i, arr[i]) );
	}
	if(v.size() > 0){
		int diff = v[0].yy - v[0].xx;
		int end = (n - 1) - diff;
		int diff2 = diff - n;
		// cout << diff2;
		int vn = v.size();
		for (int i = 0; i < vn; i++){
			if (v[i].xx <= end){
				if (v[i].yy - v[i].xx != diff) return 0;
			}
			else{
				if (v[i].yy - v[i].xx != diff2) return 0;
			}
		}
	}
	sort(rep.begin(), rep.end());
	for(int i = 0; i + 1 < n; i++){
		if(rep[i] == rep[i + 1]) return 0;
	}
	// cout << "veve";
	return 1;
}
//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -