Submission #818079

# Submission time Handle Problem Language Result Execution time Memory
818079 2023-08-10T01:42:56 Z kebine Gondola (IOI14_gondola) C++17
25 / 100
8 ms 1140 KB
#include "gondola.h"
#include<bits/stdc++.h>
using namespace std;
const int MAX=25e4;
int valid(int n, int a[]) {
  int next=-1, ret=0;
  vector<bool> occ(MAX+1);
  for(int i=0; i<n; i++) {
    if(occ[a[i]]) return 0;
    occ[a[i]]=1;
    if(next!=-1) next=next%n+1;
    if(a[i]<=0) return 0;
    if(a[i]<=n) {
      if(next==-1) next=a[i];
      if(a[i]!=next) return 0;
    }
  }
  return 1;
}
int replacement(int n, int a[], int b[]) {
  int idx=0, next=-1;
  priority_queue<pair<int, int>> pq;
  int init[n];
  for(int i=0; i<n; i++) {
    if(next!=-1) init[i]=next=next%n+1;
    else if(a[i]<=n) init[i]=next=a[i];
  }
  if(next==-1) next=n;
  for(int i=0; i<n; i++) init[i]=next=next%n+1;
  for(int i=0; i<n; i++)
    if(a[i]>n) pq.push({-a[i], init[i]});
  next=n+1;
  while(!pq.empty()) {
    int u=pq.top().first, v=pq.top().second;
    u=-u; b[idx++]=v;
    for(; next<u; next++) b[idx++]=next;
    pq.pop();
  }
  return idx;
}
int countReplacement(int n, int a[]) {
  return 0;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:6:16: warning: unused variable 'ret' [-Wunused-variable]
    6 |   int next=-1, ret=0;
      |                ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 4 ms 576 KB Output is correct
7 Correct 8 ms 1084 KB Output is correct
8 Correct 6 ms 1040 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 6 ms 1140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 6 ms 1068 KB Output is correct
8 Correct 5 ms 980 KB Output is correct
9 Correct 2 ms 448 KB Output is correct
10 Correct 6 ms 1084 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 3 ms 852 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 6 ms 1092 KB Output is correct
# 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 1 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 304 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 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 1 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 0 ms 212 KB Output is correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 312 KB Output isn't correct
2 Halted 0 ms 0 KB -