답안 #819570

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819570 2023-08-10T11:50:25 Z devariaota 곤돌라 (IOI14_gondola) C++17
10 / 100
28 ms 4836 KB
#include <bits/stdc++.h>
#include "gondola.h"
#define ll long long
#define mod 1000000007
using namespace std;

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
  return -1;
}

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

int valid(int n,int inputSeq[]){
  int mn = INT_MAX;
  int id;
  for(int i = 0 ; i < n ; i++){
    if( mn > inputSeq[i] ){
      mn = inputSeq[i];
      id = i;
    }
  }
  if( mn > n ) return 1;
  vector<int> v;
  mn--;
  id = (id-mn)%n+n;
  id %= n;
  for(int i =  id ; i < n ; i++) v.push_back(inputSeq[i]);
  for(int i = 0 ; i < id ; i++) v.push_back(inputSeq[i]);
  map<int,int> cnt;
  for(int i = 0 ; i < n ; i++){
    cnt[v[i]]++;
    if( v[i] <= n && v[i] != i+1 ) return 0;
    if( cnt[v[i]] > 1 ) return 0;
  }
  return 1;
}

//~ int main(){
  //~ ios_base::sync_with_stdio(false);
  //~ cin.tie(0);
  //~ cout.tie(0);
  //~ cin>>n;
  //~ for(int i = 0 ; i < n ; i++){
    //~ cin>>inputSeq[i];
  //~ }
  //~ cout<<valid(n)<<"\n";
  //~ ll T = 1;
  //~ //cin>>T;
  //~ for(int i = 0 ; i < T ; i++){
    //~ solve();
  //~ }
//~ }

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:27:11: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |   id = (id-mn)%n+n;
      |        ~~~^~~~
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 12 ms 2304 KB Output is correct
7 Correct 8 ms 1360 KB Output is correct
8 Correct 20 ms 4196 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 24 ms 4772 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 10 ms 2256 KB Output is correct
7 Correct 8 ms 1184 KB Output is correct
8 Correct 21 ms 4168 KB Output is correct
9 Correct 6 ms 1492 KB Output is correct
10 Correct 28 ms 4836 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 4 ms 1068 KB Output is correct
14 Incorrect 0 ms 304 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -1 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Integer -2 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -