Submission #1125153

#TimeUsernameProblemLanguageResultExecution timeMemory
1125153AlgorithmWarriorMagic Show (APIO24_show)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "Alice.h"
#define long long __int128

using namespace std;

vector<pair<int,int>>Alice(){
    long long x=setN(5000);
    int i;
    vector<pair<int,int>>tree;
    for(i=2;i<=5000;++i){
        tree.push_back({x%(i-1)+1,i});
    }
    return tree;
}
#include <bits/stdc++.h>
#include "Bob.h"
#define long long __int128

using namespace std;

long long bin_exp(long long base,long long exp,long long mod){
    long long rez=1;
    while(exp){
        if(exp&1){
            rez=rez*base%mod;
        }
        base=base*base%mod;
        exp/=2;
    }
    return rez;
}

long long CRT(long long r1,long long m1,long long r2,long long m2){
    long long g=__gcd(m1,m2);
    long long k=(r2-r1)/g*bin_exp(m1/g,m2/g-2,m2/g)%(m2/g);
    long long x=m1*k+r1;
    return x;
}

long long Bob(vector<pair<int,int>>V){
    long long x=0;
    long long mod=1;
    for(auto edge : V){
        x=CRT(x,mod,edge.first-1,edge.second-1);
        mod=mod*(edge.second-1)/__gcd(mod,1LL*edge.second-1);
        if(mod>1e18)
            break;
    }
    return x;
}

Compilation message (stderr)

# 1번째 컴파일 단계

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:3:19: error: two or more data types in declaration of 'x'
    3 | #define long long __int128
      |                   ^~~~~~~~
Alice.cpp:8:5: note: in expansion of macro 'long'
    8 |     long long x=setN(5000);
      |     ^~~~
Alice.cpp:12:25: error: 'x' was not declared in this scope
   12 |         tree.push_back({x%(i-1)+1,i});
      |                         ^
Alice.cpp:12:23: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   12 |         tree.push_back({x%(i-1)+1,i});
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
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 Alice.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::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++/11/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++/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::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++/11/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)
      |                 ~~~~~~~~~~~~~^~~