Submission #996650

# Submission time Handle Problem Language Result Execution time Memory
996650 2024-06-11T03:35:05 Z ainta Magic Show (APIO24_show) C++17
100 / 100
3 ms 1080 KB
#include <vector>
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;

#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
typedef long long ll;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;


// 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(){
    mt19937 gen(1557);
    vi T;
    rng(i,1,6*666) T.pb(1000+i);
    shuffle(all(T), gen);


    int N = 1000 + 6*666;
    ll X = setN(N);

    vi Z(6);

    X--;
    rep(i,6){
        Z[i] = X%1000;
        X/=1000;
    }

    vc<pii>res;
    rng(i,2,1000){
        res.pb({1,i});
    }
    rep(i,666){
        rep(j,6){
            res.pb({ (Z[j] + i)%1000 + 1, T[i*6+j]});
        }
    }
    
    return res;
}
#include <vector>
#include "Bob.h"

#include <bits/stdc++.h>
using namespace std;

#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
typedef long long ll;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
// 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){
    mt19937 gen(1557);
    vi T;
    vc<pii> U(5010);
    rng(i,1,6*666) T.pb(1000+i);
    shuffle(all(T), gen);

    rep(i,6*666){
        U[T[i]]={i/6, i%6};
    }
    int R[6]={0};

    for(auto [a,b]: V){
        if(a>1000){
            swap(a,b);
        }
        if(b>1000){
            R[U[b].se] = a-1-U[b].fi;
            while(R[U[b].se] < 0)R[U[b].se] += 1000;
        }
    }
    ll s=1,t=1;
    rep(i,6){
        s += R[i]*t;
        t*=1000;
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Correct 2 ms 816 KB Correct.
3 Correct 2 ms 816 KB Correct.
4 Correct 2 ms 1068 KB Correct.
5 Correct 2 ms 1080 KB Correct.
6 Correct 2 ms 812 KB Correct.
7 Correct 2 ms 816 KB Correct.
8 Correct 1 ms 824 KB Correct.
9 Correct 2 ms 816 KB Correct.
10 Correct 2 ms 1080 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 2 ms 1068 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Correct 2 ms 816 KB Correct.
3 Correct 2 ms 816 KB Correct.
4 Correct 2 ms 1068 KB Correct.
5 Correct 2 ms 1080 KB Correct.
6 Correct 2 ms 812 KB Correct.
7 Correct 2 ms 816 KB Correct.
8 Correct 1 ms 824 KB Correct.
9 Correct 2 ms 816 KB Correct.
10 Correct 2 ms 1080 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 2 ms 1068 KB Correct.
13 Correct 2 ms 1076 KB Correct.
14 Correct 2 ms 816 KB Correct.
15 Correct 3 ms 1068 KB Correct.
16 Correct 2 ms 812 KB Correct.
17 Correct 1 ms 828 KB Correct.
18 Correct 1 ms 816 KB Correct.
19 Correct 2 ms 1068 KB Correct.
20 Correct 2 ms 816 KB Correct.
21 Correct 2 ms 816 KB Correct.
22 Correct 2 ms 828 KB Correct.
23 Correct 2 ms 816 KB Correct.
24 Correct 2 ms 1068 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 816 KB Correct.
2 Correct 2 ms 816 KB Correct.
3 Correct 2 ms 816 KB Correct.
4 Correct 2 ms 1068 KB Correct.
5 Correct 2 ms 1080 KB Correct.
6 Correct 2 ms 812 KB Correct.
7 Correct 2 ms 816 KB Correct.
8 Correct 1 ms 824 KB Correct.
9 Correct 2 ms 816 KB Correct.
10 Correct 2 ms 1080 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 2 ms 1068 KB Correct.
13 Correct 2 ms 1076 KB Correct.
14 Correct 2 ms 816 KB Correct.
15 Correct 3 ms 1068 KB Correct.
16 Correct 2 ms 812 KB Correct.
17 Correct 1 ms 828 KB Correct.
18 Correct 1 ms 816 KB Correct.
19 Correct 2 ms 1068 KB Correct.
20 Correct 2 ms 816 KB Correct.
21 Correct 2 ms 816 KB Correct.
22 Correct 2 ms 828 KB Correct.
23 Correct 2 ms 816 KB Correct.
24 Correct 2 ms 1068 KB Correct.
25 Correct 2 ms 1068 KB Correct.
26 Correct 2 ms 824 KB Correct.
27 Correct 2 ms 1068 KB Correct.
28 Correct 2 ms 824 KB Correct.
29 Correct 2 ms 1068 KB Correct.
30 Correct 2 ms 816 KB Correct.
31 Correct 1 ms 1068 KB Correct.
32 Correct 1 ms 824 KB Correct.
33 Correct 1 ms 1068 KB Correct.
34 Correct 2 ms 820 KB Correct.
35 Correct 2 ms 1068 KB Correct.
36 Correct 2 ms 828 KB Correct.
37 Correct 2 ms 1068 KB Correct.
38 Correct 2 ms 1068 KB Correct.
39 Correct 3 ms 816 KB Correct.
40 Correct 2 ms 816 KB Correct.
41 Correct 2 ms 1072 KB Correct.
42 Correct 3 ms 824 KB Correct.
43 Correct 1 ms 1072 KB Correct.
44 Correct 2 ms 816 KB Correct.