Submission #1183423

#TimeUsernameProblemLanguageResultExecution timeMemory
1183423Albara_Abdulhafith곤돌라 (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
  #include "gondola.h"
  #include <map>

  int valid(int n, int inputSeq[])
  {
    int mn = n + 1;
    int id = -1;

    map<int, int> freq;

    for(int i = 0; i < n; i++){
      if(inputSeq[i] <= n and inputSeq[i] < mn){
        mn = inputSeq[i];
        id = i;
      }
      freq[inputSeq[i]]++;
      if(freq[inputSeq[i]] > 1){
        return 0;
      }
    }

    if(id == -1){
      return 1;
    }

    for(int i = 0; i < n; i++){
      if(inputSeq[(i + id) % n] <= n and inputSeq[(i + id) % n] != mn){
        return 0;
      }
      mn++;
    }

    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:5: error: 'map' was not declared in this scope
    9 |     map<int, int> freq;
      |     ^~~
gondola.cpp:9:5: note: suggested alternatives:
In file included from /usr/include/c++/11/map:61,
                 from gondola.cpp:2:
/usr/include/c++/11/bits/stl_map.h:100:11: note:   'std::map'
  100 |     class map
      |           ^~~
In file included from gondola.cpp:2:
/usr/include/c++/11/map:78:13: note:   'std::pmr::map'
   78 |       using map
      |             ^~~
gondola.cpp:9:9: error: expected primary-expression before 'int'
    9 |     map<int, int> freq;
      |         ^~~
gondola.cpp:16:7: error: 'freq' was not declared in this scope
   16 |       freq[inputSeq[i]]++;
      |       ^~~~