답안 #832425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832425 2023-08-21T10:15:02 Z ttamx 곤돌라 (IOI14_gondola) C++14
25 / 100
33 ms 4924 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;
	for(int i=0;i<n;i++)cerr << s[i] << " \n"[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:41:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   41 |  for(auto [num,pos]:vec){
      |           ^
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 1 ms 212 KB Output is correct
6 Correct 10 ms 2260 KB Output is correct
7 Correct 7 ms 980 KB Output is correct
8 Correct 22 ms 4116 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 28 ms 4780 KB Output is correct
# 결과 실행 시간 메모리 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
6 Correct 11 ms 2292 KB Output is correct
7 Correct 6 ms 1028 KB Output is correct
8 Correct 20 ms 4148 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 26 ms 4820 KB Output is correct
11 Correct 1 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 33 ms 4924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 3 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 3 ms 212 KB Output is correct
8 Incorrect 1 ms 308 KB Integer 0 violates the range [1, 72]
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -