Submission #127722

# Submission time Handle Problem Language Result Execution time Memory
127722 2019-07-10T03:22:01 Z Boxworld Gondola (IOI14_gondola) C++14
25 / 100
63 ms 5452 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
const int maxN=100010;
int valid(int n, int inputSeq[]){
	map<int,int> M;
	int a[maxN*2],fir=-1,firN=n+1;
	for (int i=0;i<n;i++){
		a[n+i]=a[i]=inputSeq[i];
		if (M.count(a[i]))return 0;else M[a[i]]=1;
		if (1<=a[i]&&a[i]<=n)
		if (firN>a[i]){firN=a[i];fir=i;}
	}
	if (fir==-1)return 1;
	for (int i=fir+1;i<n+fir;i++)
	if (1<=a[i]&&a[i]<=n){
		if(a[i]-firN!=i-fir)return 0;
	}
	return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
//	priority_queue<int,vector<int>,greater<int> > Q;
	int a[maxN*2],ans[maxN*3],fir=-1,firN=n+1,Max=n;
	for (int i=0;i<n;i++){
		a[n+i]=a[i]=gondolaSeq[i];
		if (1<=a[i]&&a[i]<=n)
			if (firN>a[i]){firN=a[i];fir=i;}
		if (a[i]>Max)Max=a[i];
	}
	for (int i=n+1;i<=Max;i++)replacementSeq[i-n-1]=i-1;
	for (int i=fir+1;i<n+fir;i++)
	if (a[i]>n){
		replacementSeq[a[i]-n-1]=(firN+i-fir)%n;
		if (replacementSeq[a[i]-n-1]==0)replacementSeq[a[i]-n-1]=n;
	}
//	while(!Q.empty()){
//		int x=Q.top();
//	}
	return Max-n;
}

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

int countReplacement(int n, int inputSeq[]){
	return -3;
}

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:24:16: warning: unused variable 'ans' [-Wunused-variable]
  int a[maxN*2],ans[maxN*3],fir=-1,firN=n+1,Max=n;
                ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 20 ms 2552 KB Output is correct
7 Correct 14 ms 760 KB Output is correct
8 Correct 35 ms 4600 KB Output is correct
9 Correct 11 ms 1656 KB Output is correct
10 Correct 48 ms 5240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 19 ms 2552 KB Output is correct
7 Correct 14 ms 632 KB Output is correct
8 Correct 35 ms 4636 KB Output is correct
9 Correct 11 ms 1656 KB Output is correct
10 Correct 46 ms 5220 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 25 ms 2424 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 63 ms 5452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 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 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 -