# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
48672 |
2018-05-17T19:32:29 Z |
doowey |
Gondola (IOI14_gondola) |
C++14 |
|
15 ms |
2252 KB |
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
typedef pair<int,int> pii;
#define fi first
#define se second
#define mp make_pair
const int N = (int)25e4 + 1293;
int valid(int n, int inputSeq[])
{
int cnt[N];
for(int j = 0;j < N;j ++ )
cnt[j] = 0;
int rest[n];
int maz = (int)4e5 + 12345;
for(int i = 0; i < n;i ++){
cnt[inputSeq[i]]++;
if(cnt[inputSeq[i]] >= 2)
return 0;
maz = min(maz, inputSeq[i]);
rest[i] = inputSeq[i];
}
if(maz > n)
return 1;
int p,j;
for(int i = 0;i < n;i ++ ){
if(rest[i] <= n){
p = rest[i]+1;
j = i+1;
j %= N;
while(p <= n){
rest[j] = p;
p++;
j++;
j%=n;
}
p = 1;
while(p < rest[i]){
rest[j] = p;
j++;
j %= n;
p++;
}
break;
}
}
for(int i = 0; i < n;i ++){
if(inputSeq[i] <= n){
if(rest[i] != inputSeq[i])
return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
vector<int>sq;
int cnt[N];
for(int i = 0;i < N;i ++)
cnt[i] = 0;
bool ok = false;
for(int i = 0;i <n;i ++ ){
if(gondolaSeq[i] > n)
sq.push_back(gondolaSeq[i]);
else{
cnt[gondolaSeq[i]]++;
ok = true;
}
}
sort(sq.begin(),sq.end());
int p = 1;
int l = 0;
int ii = n + 1;
for(auto x : sq){
if(ok)while(cnt[p]!= 0)
p++;
replacementSeq[l] = p;
l++;
while(ii < x){
replacementSeq[l] = ii;
ii++;
l++;
}
p++;
}
sort(replacementSeq,replacementSeq + l);
return l;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1272 KB |
Output is correct |
2 |
Correct |
2 ms |
1512 KB |
Output is correct |
3 |
Correct |
3 ms |
1512 KB |
Output is correct |
4 |
Correct |
2 ms |
1512 KB |
Output is correct |
5 |
Correct |
3 ms |
1512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1512 KB |
Output is correct |
2 |
Correct |
3 ms |
1568 KB |
Output is correct |
3 |
Correct |
3 ms |
1568 KB |
Output is correct |
4 |
Correct |
3 ms |
1568 KB |
Output is correct |
5 |
Correct |
3 ms |
1584 KB |
Output is correct |
6 |
Correct |
8 ms |
1764 KB |
Output is correct |
7 |
Correct |
14 ms |
1888 KB |
Output is correct |
8 |
Correct |
12 ms |
2144 KB |
Output is correct |
9 |
Correct |
5 ms |
2144 KB |
Output is correct |
10 |
Correct |
14 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2252 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2252 KB |
Output is correct |
5 |
Correct |
2 ms |
2252 KB |
Output is correct |
6 |
Correct |
7 ms |
2252 KB |
Output is correct |
7 |
Correct |
14 ms |
2252 KB |
Output is correct |
8 |
Correct |
12 ms |
2252 KB |
Output is correct |
9 |
Correct |
6 ms |
2252 KB |
Output is correct |
10 |
Correct |
14 ms |
2252 KB |
Output is correct |
11 |
Correct |
3 ms |
2252 KB |
Output is correct |
12 |
Correct |
3 ms |
2252 KB |
Output is correct |
13 |
Correct |
8 ms |
2252 KB |
Output is correct |
14 |
Correct |
3 ms |
2252 KB |
Output is correct |
15 |
Correct |
15 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2252 KB |
Output is correct |
2 |
Correct |
2 ms |
2252 KB |
Output is correct |
3 |
Correct |
3 ms |
2252 KB |
Output is correct |
4 |
Correct |
2 ms |
2252 KB |
Output is correct |
5 |
Correct |
2 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2252 KB |
Output is correct |
2 |
Correct |
2 ms |
2252 KB |
Output is correct |
3 |
Correct |
2 ms |
2252 KB |
Output is correct |
4 |
Correct |
2 ms |
2252 KB |
Output is correct |
5 |
Correct |
2 ms |
2252 KB |
Output is correct |
6 |
Correct |
3 ms |
2252 KB |
Output is correct |
7 |
Incorrect |
3 ms |
2252 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2252 KB |
Output is correct |
2 |
Correct |
3 ms |
2252 KB |
Output is correct |
3 |
Correct |
2 ms |
2252 KB |
Output is correct |
4 |
Correct |
3 ms |
2252 KB |
Output is correct |
5 |
Correct |
2 ms |
2252 KB |
Output is correct |
6 |
Correct |
3 ms |
2252 KB |
Output is correct |
7 |
Incorrect |
3 ms |
2252 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2252 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2252 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2252 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2252 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |