Submission #1138727

#TimeUsernameProblemLanguageResultExecution timeMemory
1138727adiyerMagic Show (APIO24_show)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "Alice.h"

using namespace std;

typedef long long ll;

vector < pair < int, int > > Alice(){
    ll x = setN(5000), mid = 2500, k = mid;
    vector < pair < int, int > > g;
    for(int v = 2; v <= mid; v++) g.push_back({1, v});
    for(int v = 2; v <= 61; v++){
        if(!(x >> (v - 2) & 1)) continue;
        x -= (1ll << (v - 2));
        for(ll u = v; u <= mid; u += 60){
            if(k == 5000) break;
            g.push_back({u, ++k});
        }
        if(!x)
            while(k < 5000) 
                g.push_back({v, ++k});
    }
    while(k < 5000) g.push_back({1, ++k});
    return g;
}
#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;

typedef long long ll;

long long Bob(std::vector<std::pair<int,int>> V){
	ll x = 0, mid = 2500;
    vector < vector < int > > g[5050];
    for(int i = 0; i < V.size(); i++){
        g[V[i].first].push_back(V[i].second);
        g[V[i].second].push_back(V[i].first);
    }
    for(int v = 2; v <= 61; v++){
        for(ll u = v; u <= mid; u += 60){
            if(g[u].empty()) continue;
            fg |= (1ll << (v - 2));
        }
    }
    return x;
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:12:32: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   12 |         g[V[i].first].push_back(V[i].second);
      |         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Bob.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'int' to 'const value_type&' {aka 'const std::vector<int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Bob.cpp:13:33: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
   13 |         g[V[i].second].push_back(V[i].first);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/11/vector:67,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Bob.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'int' to 'const value_type&' {aka 'const std::vector<int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Bob.cpp:18:13: error: 'fg' was not declared in this scope; did you mean 'g'?
   18 |             fg |= (1ll << (v - 2));
      |             ^~
      |             g