Submission #274554

#TimeUsernameProblemLanguageResultExecution timeMemory
274554faresbasbsGondola (IOI14_gondola)C++14
20 / 100
45 ms5740 KiB
#include <bits/stdc++.h> #include "gondola.h" using namespace std; int valid(int n, int a[]){ vector<pair<int,int>> v; for(int i = 0 ; i < n ; i += 1){ if(a[i] <= n){ v.push_back({a[i],i}); } } sort(v.begin(),v.end()); for(int i = 1 ; i < v.size() ; i += 1){ int diff1 = v[i].first-v[i-1].first , diff2; if(v[i].second > v[i-1].second){ diff2 = v[i].second-v[i-1].second; }else{ diff2 = n-v[i-1].second+v[i].second; } if(diff1 != diff2){ return 0; } } set<int> st; for(int i = 0 ; i < n ; i += 1){ if(st.count(a[i])){ return 0; } st.insert(a[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:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for(int i = 1 ; i < v.size() ; i += 1){
      |                  ~~^~~~~~~~~~
#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...