Submission #832429

# Submission time Handle Problem Language Result Execution time Memory
832429 2023-08-21T10:16:09 Z ttamx Gondola (IOI14_gondola) C++14
25 / 100
32 ms 4940 KB
#include "gondola.h"
#include<bits/stdc++.h>

using namespace std;

int valid(int n, int Seq[]){
	vector<int> s(n);
	map<int,bool> mp;
	for(int i=0;i<n;i++){
		if(mp[Seq[i]])return 0;
		mp[Seq[i]]=true;
		if(Seq[i]<=n)s[i]=Seq[i];
	}
	for(int t=0;t<2;t++){
		for(int i=0;i<n;i++){
			if(s[i]>0){
				auto &x=s[(i+1)%n];
				int val=s[i]%n+1;
				if(x==0)x=val;
				else if(x!=val)return 0;
			}
		}
	}
	return 1;
}

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

int replacement(int n, int Seq[], int Ans[]){
	vector<int> s(n);
	vector<pair<int,int>> vec;
	for(int i=0;i<n;i++){
		if(Seq[i]<=n)s[i]=Seq[i];
		else vec.emplace_back(Seq[i],i);
	}
	for(int t=0;t<2;t++)for(int i=0;i<n;i++)if(s[i]>0)s[(i+1)%n]=s[i]%n+1;
	sort(vec.begin(),vec.end());
	int nxt=n+1;
	int sz=0;
	for(auto [num,pos]:vec){
		while(s[pos]!=num){
			Ans[sz++]=s[pos];
			s[pos]=nxt++;
		}
	}
	return sz;
}

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

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

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:40:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   40 |  for(auto [num,pos]:vec){
      |           ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 11 ms 2260 KB Output is correct
7 Correct 10 ms 1004 KB Output is correct
8 Correct 25 ms 4180 KB Output is correct
9 Correct 7 ms 1492 KB Output is correct
10 Correct 24 ms 4856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 11 ms 2368 KB Output is correct
7 Correct 7 ms 1024 KB Output is correct
8 Correct 21 ms 4168 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 25 ms 4780 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 13 ms 2132 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 32 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 220 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 1 ms 340 KB Integer 0 violates the range [1, 72]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Incorrect 1 ms 340 KB Integer 0 violates the range [1, 72]
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -