Submission #1121477

# Submission time Handle Problem Language Result Execution time Memory
1121477 2024-11-29T05:43:10 Z vjudge1 Flight to the Ford (BOI22_communication) C++17
0 / 100
756 ms 328 KB
// Bolatulu
#include <bits/stdc++.h>
#include "communication.h"

/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/

typedef long long ll;
typedef unsigned long long ull; 
typedef double db;
#define pb push_back
#define eb emplace_back
#define ins insert
#define F first
#define S second
#define md (tl+tr)/2
#define TL v+v,tl,md
#define TR v+v+1,md+1,tr
#define Tl t[v].l,tl,md
#define Tr t[v].r,md+1,tr
#define all(x) (x).begin(),(x).end()
#define yes cout << "YES\n"
#define no cout << "NO\n"
// #define int long long
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define ld long double
using namespace std;

int binpow(int a,int n,int M) {
    if (n==0)
        return 1;
    if (n%2!=0)
        return (a * binpow(a,n-1,M))%M;
    int z=binpow(a,n/2,M);
    return (z*z)%M;
}

const ll INF = 1e18+7;
const int N = 1e5+7;
const int M = 1e4+7;
const ld eps = 1e-3;

string t="0111010100";

void encode(int n,int x) {
    int sz=0,i;
    for (int j=1;j<30;j++) {
        i=0;
        int bit=(x>>j&1);
        bool ok=true;
        while (ok) {
            ok=send(t[i]-'0');
            sz++;
            i++;
            i%=t.size();
        }
        send(bit);
        sz++;
    }
    while (sz<80) {
        send(t[i]-'0');
        sz++;
        i++;
        i%=t.size();
    }
}

pair <int,int> decode(int n) {
    int k=1,ans=0,j=1;
    for (int i=1;i<=80;i++) {
        int z=receive();
        if (j==0) {
            ans+=(1<<k)*z;
            k++;
            j=1;
        } else if (z==t[j]-'0') {
            j++;
            j%=t.size();
        } else {
            j=0;
        }
    }
    return {ans,ans+1};
}

/*
signed main() {
    // file("jenga");
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int test = 1;
    solve(3);
    // cin >> test;
    while (test--) {
        // solve();
        if (test)
            cout << '\n';
    }
    return 0;
}
*/
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 328 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 756 ms 328 KB Not correct
2 Halted 0 ms 0 KB -