Submission #285499

#TimeUsernameProblemLanguageResultExecution timeMemory
285499erd1Gondola (IOI14_gondola)C++14
20 / 100
15 ms1280 KiB
#include "gondola.h" #include<bits/stdc++.h> using namespace std; int valid(int n, int inputSeq[]) { set<int> uses; if(find(inputSeq, inputSeq+n, 1) == inputSeq+n)return 0; rotate(inputSeq, find(inputSeq, inputSeq+n, 1), inputSeq+n); for(int i = 0; i < n; i++)if(inputSeq[i] != i+1) if(inputSeq[i] <= n)return 0; else if(uses.count(inputSeq[i])) return 0; else uses.insert(inputSeq[i]); return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:9:31: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
    9 |   for(int i = 0; i < n; i++)if(inputSeq[i] != i+1) if(inputSeq[i] <= n)return 0; else if(uses.count(inputSeq[i])) return 0; else uses.insert(inputSeq[i]);
      |                               ^
#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...