답안 #549890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
549890 2022-04-16T18:57:10 Z BalintR Flights (JOI22_flights) C++17
0 / 100
0 ms 516 KB
#include <vector>
#include <string>
#include <cassert>
using namespace std;
#include "Ali.h"

typedef vector<int> vi;
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cout << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;}

namespace {
    const int MN = 1e4;
    const int HALF = 100;
    int n;
    vi adjList[MN];
    int dist[MN];
}

void Init(int N, vi U, vi V){
    n = N;
    FR(i, n){
        int a = U[i], b = V[i];
        adjList[a].pb(b);
        adjList[b].pb(a);
    }
    FR(i, n){
        SetID(i, i);
    }
}

void dfs(int n1, int par){
    for(int n2 : adjList[n1]){
        if(n2 != par){
            dist[n2] = dist[n1] + 1;
            dfs(n2, n1);
        }
    }
}

string SendA(string inStr){
    assert(SZ(inStr) == 20);
    int val = 0;
    FR(i, 20) val |= (inStr[i]-'0') << i;
    int nodeA = val % MN;
    int nodeB = val/MN;

    dist[nodeA] = 0;
    dfs(nodeA, -1);
    string res;
    FR(i, HALF){
        int v = dist[nodeB*HALF + i];
        FR(j, 14) res.pb((v >> j) & 1 ? '1' : '0');
    }

    FR(i, n) adjList[i].clear();
    return res;
}
#include <string>
using namespace std;
#include "Benjamin.h"

#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cout << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cout << #arr; FR(_i, n) cout << ' ' << arr[_i]; cout << endl;}

namespace {
    const int MN = 1e4;
    const int HALF = 100;
    int n, x, y;
}

string SendB(int N, int X, int Y){
    n = N;
    x = X;
    y = Y;
    int v = x + MN*(y/HALF);
    string res;
    FR(i, 20) res.pb((v >> i) & 1 ? '1' : '0');
    return res;
}

int Answer(string str){
    int pos = y % HALF;
    int res = 0;
    FR(i, 14){
        res |= (str[pos*14 + i]-'0') << i;
    }
    return res;
}

Compilation message

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 516 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 456 KB Incorrect
2 Halted 0 ms 0 KB -