Submission #230295

#TimeUsernameProblemLanguageResultExecution timeMemory
230295MasterdanGondola (IOI14_gondola)C++14
25 / 100
26 ms1452 KiB
#include "gondola.h" #include <bits/stdc++.h> #define MAX 1e9+7 #define pb push_back #define mk make_pair #define all(a) a.begin (),a.end () using namespace std; typedef vector<int> vi; typedef long long int ll; typedef pair<int, int> ii; int valid(int n, int inputSeq[]) { vi v; int flag=0; for(int i=0;i<n;i++)v.pb(inputSeq[i]); for(int i=1;i<n;i++){ if(v[i]==1 && v[i-1]!=n)return 0; if(v[i] != 1 && v[i-1] + 1 != v[i])return 0; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { vi v; int sw=0; for(int i=0;i<n;i++)v.pb(gondolaSeq[i]); sort(all(v)); for(int i=0;i<n;i++){ if(v[i]!=i+1){replacementSeq[0]=i+1; sw=1; break; } } return sw; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:14:9: warning: unused variable 'flag' [-Wunused-variable]
     int flag=0;
         ^~~~
#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...