제출 #409076

#제출 시각아이디문제언어결과실행 시간메모리
409076pliam곤돌라 (IOI14_gondola)C++14
55 / 100
25 ms2368 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; //valid vector<pair<int,int>> input;//(val,id) vector<pair<int,int>> rep;//(val,id) int valid(int n, int inputSeq[]) { for(int i=0;i<n;i++){ input.push_back({inputSeq[i],i}); } sort(input.begin(),input.end()); int prev=-1; for(int i=0;i<n;i++){ if(input[i].first==prev) return 0; prev=input[i].first; } int prev_pos=-1; for(int i=0;i<n&&input[i].first<=n;i++){ if((i!=0)&&((input[i].first-prev)!=((input[i].second-prev_pos+n)%n))){ return 0; } prev=input[i].first; prev_pos=input[i].second; } return 1; } //---------------------- int mod1(int x,int m){ x%=m; if(x==0) x=m; return x; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int extra=0; for(int i=0;i<n;i++){ if(gondolaSeq[i]>n) rep.push_back({gondolaSeq[i],i}); else extra=(gondolaSeq[i]-i+n)%n; } for(auto& p:rep){ p.second+=extra; p.second=mod1(p.second,n); } sort(rep.begin(),rep.end()); int l=0; int prev=n; for(auto p:rep){ replacementSeq[l]=p.second; l++; for(int i=prev+1;i<p.first;i++){ replacementSeq[l]=i; l++; } prev=p.first; } return l; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...