Submission #298249

#TimeUsernameProblemLanguageResultExecution timeMemory
298249HemimorGondola (IOI14_gondola)C++14
55 / 100
25 ms2364 KiB
#include "gondola.h" #include <algorithm> #include <iostream> #include <iomanip> #include <numeric> #include <cassert> #include <vector> #include <cmath> #include <queue> #include <set> #include <map> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<P,int> pip; typedef vector<pip> vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-8; const ll mod=1e9+7; const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1}; int valid(int n, int inputSeq[]){ int id=-1,x; for(int i=0;i<n;i++) if(inputSeq[i]<=n){ if(id==-1) id=i,x=inputSeq[i]; if((x+i-id-1)%n!=inputSeq[i]-1) return 0; } sort(inputSeq,inputSeq+n); for(int i=0;i<n-1;i++) if(inputSeq[i]==inputSeq[i+1]) return 0; return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]){ vp a; int id=0,x=1; for(int i=0;i<n;i++){ if(gondolaSeq[i]>n) a.push_back({gondolaSeq[i],i}); else id=i,x=gondolaSeq[i]; } sort(a.begin(),a.end()); int I=0,mx=n; for(auto p:a){ replacementSeq[I++]=(p.second-id+x-1+2*n)%n+1; mx++; while(mx<p.first){ replacementSeq[I++]=mx; mx++; } } return I; } //---------------------- 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...