Submission #705668

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7056682023-03-04 23:41:14ToroTNGondola (IOI14_gondola)C++14
60 / 100
30 ms5368 KiB
#include<bits/stdc++.h>
using namespace std;
#include "gondola.h"
//#include "grader.cpp"
#define X first
#define Y second
#define pb push_back
#define ll long long
int a[100005];
int valid(int n, int inputSeq[])
{
set<int> s;
int type=1,pos[100005];
for(int i=0;i<n;i++)
{
a[i+1]=inputSeq[i];
}
for(int i=1;i<=n;i++)
{
if(a[i]<=n)pos[a[i]]=i;
s.insert(a[i]);
}
if(s.size()<n)type=0;
for(int i=1;i<n;i++)
{
if((!(pos[i]==n&&pos[i+1]==1)&&!(pos[i]+1==pos[i+1]))&&(pos[i]>=1&&pos[i]<=n)&&(pos[i+1]>=1&&pos[i+1]<=n))
{
type=0;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:23:16: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |     if(s.size()<n)type=0;
      |        ~~~~~~~~^~
gondola.cpp: In function 'long long int power(long long int, long long int)':
gondola.cpp:127:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  127 |     for(int i=0;i<vec.size();i++)
      |                 ~^~~~~~~~~~~
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:159:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  159 |         for(int i=1;i<v.size();i++)
      |                     ~^~~~~~~~~
gondola.cpp:176:16: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  176 |     if(v.size()==n+1)
      |        ~~~~~~~~^~~~~
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:31:27: warning: 'pos[1]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     if((!(pos[n]==n&&pos[1]==1)&&!(pos[n]+1==pos[1]))&&(pos[n]>=1&&pos[1]<=n)&&(pos[n]>=1&&pos[1]<=n))type=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...