Submission #400979

#TimeUsernameProblemLanguageResultExecution timeMemory
400979Dan4LifeGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;

int valid(int n, int a[])
{
    int sm = INT_MAX, pos = -1;
    map<int,int> M; M.clear();
    for(auto u : a)
    {
        M[u]++;
        if(M[u]>=2)return 0;
    }
    for(int i = 0; i < n; i++)
        if(sm>a[i] and a[i]<=n)sm=a[i], pos=i;
    if(sm==INT_MAX)return 1;
    int x = n;
    while(x--){
        if(a[pos]==n and a[(pos+1)%n]<=n and a[(pos+1)%n]!=1)return 0;
        else if(a[pos]<n and a[(pos+1)%n]<=n and a[pos]!=a[(pos+1)%n]-1)
            return 0;
        pos++, pos%=n;
    }
    return 1;
}

int replacement(int n, int a[], int replacementSeq[])
{
    return 0;
}

int countReplacement(int n, int a[])
{
    return 0;
}

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:9:18: error: 'begin' was not declared in this scope
    9 |     for(auto u : a)
      |                  ^
gondola.cpp:9:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:95,
                 from gondola.cpp:2:
/usr/include/c++/9/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/9/filesystem:38,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:129,
                 from gondola.cpp:2:
/usr/include/c++/9/bits/fs_dir.h:516:3: note:   'std::filesystem::__cxx11::begin'
  516 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
gondola.cpp:9:18: error: 'end' was not declared in this scope
    9 |     for(auto u : a)
      |                  ^
gondola.cpp:9:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:95,
                 from gondola.cpp:2:
/usr/include/c++/9/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/9/filesystem:38,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:129,
                 from gondola.cpp:2:
/usr/include/c++/9/bits/fs_dir.h:520:3: note:   'std::filesystem::__cxx11::end'
  520 |   end(recursive_directory_iterator) noexcept
      |   ^~~