Submission #739170

# Submission time Handle Problem Language Result Execution time Memory
739170 2023-05-10T06:00:45 Z NeroZein Gondola (IOI14_gondola) C++17
15 / 100
13 ms 4988 KB
#include "gondola.h"
#include <bits/stdc++.h> 
using namespace std; 

int valid(int n, int inputSeq[]) {
	bool ret = true; 
	function<bool(int, int, int)> Go = [&](int id, int cur, int step) {
		if (id < 0 || id >= n) {
			return true; 
		}
		if (cur == 0) cur = n; 
		if (cur == n + 1) cur = 1; 
		if (inputSeq[id] <= n && inputSeq[id] != cur) {
			return false; 
		}
		return Go(id + step, cur + step, step); 
	}; 
  for (int i = 0; i < n; ++i) {
		if (inputSeq[i] <= n) {
			ret &= Go(i, inputSeq[i], 1); 
			ret &= Go(i, inputSeq[i], -1); 
			break; 
		}
	}
	return ret;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
	int mx = 0;
  for (int i = 0; i < n; ++i) {
		mx = max(mx, gondolaSeq[i]); 
	}
	vector<bool> vis(mx + 1);
	for (int i = 0; i < n; ++i) {
		vis[gondolaSeq[i]] = true; 
	}  
	int ans = 0; 
	for (int i = 1; i <= mx; ++i) {
		if (!vis[i]) {
			replacementSeq[ans++] = i;  
		}
	}
	return ans; 
}

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

int countReplacement(int n, int inputSeq[]) {
  return -3;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 312 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
# 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 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 5 ms 2388 KB Output is correct
7 Correct 7 ms 1108 KB Output is correct
8 Correct 9 ms 4308 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 10 ms 4928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 216 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 300 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 4 ms 2388 KB Output is correct
7 Correct 13 ms 1108 KB Output is correct
8 Correct 9 ms 4308 KB Output is correct
9 Correct 3 ms 1492 KB Output is correct
10 Correct 10 ms 4988 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 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 336 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 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 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 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 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 -