Submission #1014179

#TimeUsernameProblemLanguageResultExecution timeMemory
1014179Mousa_AboubakerMagic Show (APIO24_show)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "Alice.h" using namespace std; // 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(). vector<pair<int,int>> Alice(){ // add your code here // change below into your code long long x = setN(5000); vector<pair<int, int>> p; vector<int> bits; for(int i = 0; i < 62; i++) { if((x >> i) & 1) { bits.push_back(i); } } int l = 0; for(int i = 2; i <= 5000; i++) { p.push_back({1, bits[l % b.size()]}); l++; } return p; }
#include <bits/stdc++.h> #include "Bob.h" using namespace std; // 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(vector<pair<int,int>> V){ // add your code here set<int> bits; for(auto el: V) { bits.insert(el.second); } long long x = 0; for(int el: bits) { x |= (1ll << el); } return x; // change this into your code }

Compilation message (stderr)

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:26:34: error: 'b' was not declared in this scope
   26 |         p.push_back({1, bits[l % b.size()]});
      |                                  ^
Alice.cpp:26:44: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   26 |         p.push_back({1, bits[l % b.size()]});
      |                                            ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Alice.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~