Submission #991361

# Submission time Handle Problem Language Result Execution time Memory
991361 2024-06-02T07:40:23 Z Khanhcsp2 Magic Show (APIO24_show) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "Alice.h"
#define el '\n'
#define fi first
#define sc second
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
const int N=1e5+11;
vector<pii> tree;
long long setN(int n)
{
    ll x;
    cin >> x;
    return x;
}
//ll lcm(ll a, ll b)
//{
//    return a*b/__gcd(a, b);
//}
std::vector<std::pair<int,int>> Alice()
{
    // add your code here

    // change below into your code
    long long x = setN(5000);

    for(int i=1; i<5000; i++) tree.push_back({x%i+1, i+1});
    sort(all(tree));
    return tree;
}
//long long Bob(std::vector<std::pair<int,int>> V){
//	 add your code here
//
//     change this into your code
//    for(int i=1;i<=5000;i++) mod[i]=-1;
//    for(auto x:V) mod[x.sc-1]=x.fi-1;
//    ll lcmm=1, ans=0;
//    for(int i=1;i<=5000;i++)
//    {
//        if(mod[i]==-1) continue;
//        while(ans%i!=mod[i]) ans+=lcmm;
//        lcmm=lcm(lcmm, i);
//    }
//    int ch=0;
//    for(int i=1;i<=5000;i++)
//    {
//        if(mod[i]==-1) continue;
//        if((x%i)!=mod[i]) ch=1;
//    }
//    if(ch==0) return ans;
//    else return -1;
//    return ans;
//}

//void sol()
//{
//    Alice();
////    for(auto x:tree) cout << x.fi << ' ' << x.sc << el;
//    cout << Bob(tree);
//}
//signed main()
//{
////    freopen("divisor.INP", "r", stdin);
////    freopen("divisor.OUT", "w", stdout);
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    int t=1;
//    //cin >> t;
//    while(t--)
//    {
//        sol();
//    }
//}
#include<bits/stdc++.h>
#include "Bob.h"
#define el '\n'
#define fi first
#define sc second
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
const int N=1e5+11;
vector<pii> tree;
ll mod[N];
//long long setN(int n)
//{
//    cin >> x;
//    return x;
//}
ll lcm(ll a, ll b)
{
    return a*b/__gcd(a, b);
}
//std::vector<std::pair<int,int>> Alice()
//{
//    // add your code here
//
//    // change below into your code
//    long long x = setN(5000);
//
//    for(int i=1; i<5000; i++) tree.push_back({x%i+1, i+1});
//    return tree;
//}
long long Bob(std::vector<std::pair<int,int>> V){
	// add your code here

    // change this into your code
    for(int i=1;i<=5000;i++) mod[i]=-1;
    for(auto x:V) mod[x.sc-1]=x.fi-1;
    ll lcmm=1, ans=0;
    for(int i=1;i<=5000;i++)
    {
        if(mod[i]==-1) continue;
        while((ans%i)!=mod[i]) ans+=lcmm;
        lcmm=lcm(lcmm, i);
    }
//    int ch=0;
//    for(int i=1;i<=5000;i++)
//    {
//        if(mod[i]==-1) continue;
//        if((x%i)!=mod[i]) ch=1;
//    }
//    if(ch==0) return ans;
//    else return -1;
    return ans;
}

//void sol()
//{
//    Alice();
////    for(auto x:tree) cout << x.fi << ' ' << x.sc << el;
//    cout << Bob(tree);
//}
//signed main()
//{
////    freopen("divisor.INP", "r", stdin);
////    freopen("divisor.OUT", "w", stdout);
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    int t=1;
//    //cin >> t;
//    while(t--)
//    {
//        sol();
//    }
//}

Compilation message

/usr/bin/ld: /tmp/ccLrrvJN.o: in function `setN(int)':
grader_alice.cpp:(.text+0xb0): multiple definition of `setN(int)'; /tmp/ccvtp0gO.o:Alice.cpp:(.text+0x4b0): first defined here
collect2: error: ld returned 1 exit status