Submission #1000833

# Submission time Handle Problem Language Result Execution time Memory
1000833 2024-06-18T09:52:50 Z Boycl07 Magic Show (APIO24_show) C++17
0 / 100
2 ms 1084 KB
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define rep(i, n) for(int i = 1; (i) <= (n); ++i)
#define forn(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, r, l) for(int i = (r); i >= (l); --i)
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define FORD(i, n) for(int i = ((n) - 1); i >= 0; --i)
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define sz(a) int(a.size())
#define C(x, y) make_pair(x, y)
#define all(a) (a).begin(), (a).end()
#define bit(i, mask) (mask >> i & 1)
 
template<typename T> bool maximize(T &res, const T &val) { if (res < val){ res = val; return true; }; return false; }
template<typename T> bool minimize(T &res, const T &val) { if (res > val){ res = val; return true; }; return false; }
 
inline int readInt()       {char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();int n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;}
inline ll readLong()       {char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign=(c=='-');if(sign)c=getchar();ll  n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';return(!sign)?n:-n;}
inline string readString() {char c;while(c=getchar(),c==' '||c=='\n'||c=='\t');string s({c});while(c=getchar(),c!=EOF&&c!=' '&&c!='\n'&&c!='\t')s+=c;return s;}
 
const int MaxN = 5000;
const int MaxM = 6;
 
int p[MaxN + 33];
int cnt[MaxN];
 
vector<std::pair<int, int>> Alice()
{
    int n = MaxN;
    rep(i, n) p[i] = i;
 
    ll target = setN(MaxN);
 
    forn(i, 0, 60) cnt[i] = 0;
    vector<int> bits;
    forn(i, 0, 59) if(target >> i & 1)
        bits.pb(i + 1);
    vector<pii> res;
    forn(i, 1, n - 1)
    {
        pii Min = {1e9, 0};
        for(int x : bits)
            minimize(Min, {cnt[x], x});
        if(i <= Min.se) res.pb({p[i], p[n]});
        else res.pb({p[i], p[i - Min.se]}), ++cnt[Min.se];
    }
    return res;
}
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define rep(i, n) for(int i = 1; (i) <= (n); ++i)
#define forn(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, r, l) for(int i = (r); i >= (l); --i)
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define FORD(i, n) for(int i = ((n) - 1); i >= 0; --i)
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define sz(a) int(a.size())
#define C(x, y) make_pair(x, y)
#define all(a) (a).begin(), (a).end()
#define bit(i, mask) (mask >> i & 1)
const int MaxN_ = 5000;
const int MaxM_ = 6;
 
int p_[MaxN_ + 33], pos[MaxN_ + 33];
long long Bob(std::vector<std::pair<int, int>> V)
{
 
    int n = MaxN_;
    rep(i, n) p_[i] = i;
    rep(i, n) pos[p_[i]] = i;
 
 
    ll res = 0;
    for(auto &[u, v] : V)
    {
        if(pos[u] == n || pos[v] == n) continue;
        if(pos[u] > pos[v]) swap(u, v);
        if(pos[v] - pos[u] > 59) continue;
        res |= 1ll << (pos[v] - pos[u] - 1);
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1084 KB Correct.
2 Incorrect 1 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1084 KB Correct.
2 Incorrect 1 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1084 KB Correct.
2 Incorrect 1 ms 1076 KB Incorrect answer.
3 Halted 0 ms 0 KB -