답안 #1078232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1078232 2024-08-27T14:20:59 Z wood 통행료 (IOI18_highway) C++17
18 / 100
137 ms 3256 KB
#include "highway.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay


void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
    int m = U.size();
    ll curxor = 0, curs = 0;
    int x = 1, p = 0;
    while(x<N){
        vi w(m,1);
        for(int i = 0; i<m; i++){
            if((U[i]&x)^(V[i]&x))  w[i] = 0;
        }
        curxor+=(ask(w)&1)<<p;
        x<<=1;
        p++;
    }
    x = 1, p = 0;
    while(x<N){
        vi w(m,1);
        bool done[N]; memset(done,0,sizeof done);
        bool include[N]; memset(include,0,sizeof include);
        int mask = (x<<1)-1;
        for(int i = 0; i<N; i++){
            if(done[i])continue;
            if((i&mask)==curs){
                include[i] = true;
                done[i] = true;
                if((i^curxor)<N)
                done[i^curxor] = true;
            }
        }
        for(int i = 0; i<m; i++){
            if(include[U[i]]^include[V[i]]) w[i] = 0;
        }
        curs+=(!(ask(w)&1))<<p;
        x<<=1;
        p++;
    }
    answer(curs,curs^curxor);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 340 KB Output is incorrect: {s, t} is wrong.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 596 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 8 ms 508 KB Output is incorrect: {s, t} is wrong.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 648 KB Output is correct
2 Correct 9 ms 600 KB Output is correct
3 Correct 93 ms 2556 KB Output is correct
4 Correct 93 ms 2836 KB Output is correct
5 Correct 105 ms 3148 KB Output is correct
6 Correct 119 ms 3144 KB Output is correct
7 Correct 117 ms 3144 KB Output is correct
8 Correct 132 ms 3156 KB Output is correct
9 Correct 113 ms 3104 KB Output is correct
10 Correct 116 ms 3036 KB Output is correct
11 Correct 116 ms 3152 KB Output is correct
12 Correct 112 ms 3124 KB Output is correct
13 Correct 117 ms 3192 KB Output is correct
14 Correct 137 ms 3256 KB Output is correct
15 Correct 115 ms 3140 KB Output is correct
16 Correct 105 ms 3044 KB Output is correct
17 Correct 78 ms 2600 KB Output is correct
18 Correct 79 ms 2392 KB Output is correct
19 Correct 72 ms 2560 KB Output is correct
20 Correct 76 ms 2416 KB Output is correct
21 Correct 109 ms 3168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 512 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -