Submission #1212176

#TimeUsernameProblemLanguageResultExecution timeMemory
1212176LIAGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple<ll, ll, ll> plll;
typedef vector<plll> vplll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vector<pll>> vvpll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;

int valid(int n, int inputSeq[]) {
  bool b = 1;
  ll cnt = 0;
  vll inp;
  vll vis(250001);
  loop(i,0,n) {
    vis[inputSeq[i]]++;
    if (inputSeq[i] <=n) inp.push_back(inputSeq[i]);
  }
  for (auto it : inputSeq) if (vis[it]>1) b= false;
  loop(i,1,n) {
    if (inp[i] < inp[i-1] && cnt!= 0 ) b = false;
    if (inp[i] < inp[i-1]) cnt++;
  }
  return (b==1 ? 1: 0);
}

//----------------------

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:28:18: error: 'begin' was not declared in this scope
   28 |   for (auto it : inputSeq) if (vis[it]>1) b= false;
      |                  ^~~~~~~~
gondola.cpp:28:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from gondola.cpp:2:
/usr/include/c++/11/valarray:1228:5: note:   'std::begin'
 1228 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/11/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from gondola.cpp:2:
/usr/include/c++/11/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
gondola.cpp:28:18: error: 'end' was not declared in this scope
   28 |   for (auto it : inputSeq) if (vis[it]>1) b= false;
      |                  ^~~~~~~~
gondola.cpp:28:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from gondola.cpp:2:
/usr/include/c++/11/valarray:1255:5: note:   'std::end'
 1255 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
In file included from /usr/include/c++/11/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:129,
                 from gondola.cpp:2:
/usr/include/c++/11/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~