Submission #1312252

#TimeUsernameProblemLanguageResultExecution timeMemory
1312252azamuraiMagic Show (APIO24_show)C++20
Compilation error
0 ms0 KiB
#include <vector> #include <bits/stdc++.h> #include "Alice.h" // you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables. // you had better not use the same global variables in function Alice() and in function Bob(). std::vector<std::pair<int,int>> Alice(){ long long x = setN(5000); vector <pair<int,int>> edges; for (int i = 1; i <= 5000; i++) { if (i == x) continue; edges.push_back({i, x}); } return edges; }
#include <vector> #include <bits/stdc++.h> #include "Bob.h" // you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables. // you had better not use the same global variables in function Alice() and in function Bob(). long long Bob(std::vector<std::pair<int,int>> V){ map <int,int> cnt; for (int i = 0; i < Sz(V); i++) { int u = V[i].first, v = V[i].second; cnt[u]++; cnt[v]++; } long long ans = 0; for (auto to : cnt) { if (to.second > 1) ans = to.first; } return ans; }

Compilation message (stderr)

# 1번째 컴파일 단계

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:10:17: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   10 |         vector <pair<int,int>> edges;
      |                 ^~~~
      |                 std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/vector:62,
                 from Alice.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
Alice.cpp:10:9: error: 'vector' was not declared in this scope
   10 |         vector <pair<int,int>> edges;
      |         ^~~~~~
Alice.cpp:10:9: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Alice.cpp:10:22: error: expected primary-expression before 'int'
   10 |         vector <pair<int,int>> edges;
      |                      ^~~
Alice.cpp:13:17: error: 'edges' was not declared in this scope
   13 |                 edges.push_back({i, x});
      |                 ^~~~~
Alice.cpp:15:16: error: 'edges' was not declared in this scope
   15 |         return edges;
      |                ^~~~~