답안 #285393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285393 2020-08-28T21:01:14 Z peti1234 통행료 (IOI18_highway) C++17
69 / 100
186 ms 3352 KB
#include <bits/stdc++.h>
#include "highway.h"
using namespace std;
const int c=90002;
long long m, dist, xo, s, kul, ert[c], cnt, ki, cs1, cs2;;
bool v[c];
vector<int> sz;
/*
int ask(vector<int> sz) {
    for (int i=0; i<m; i++) cout << sz[i] << " ";
    int x;
    cin >> x;
    return x;
}
void answer(int a, int b) {
    cout << "valasz " << a << " " << b << "\n";
}*/
void find_pair(int n, vector<int> x, vector<int> y, int gy, int e) {
    m=x.size(), sz.resize(m);
    for (int i=0; i<m; i++) sz[i]=1;
    dist=ask(sz);
    for (int i=0; i<18; i++) {
        for (int j=0; j<m; j++) {
            if (((x[j])&(1<<i))==(((y[j])&(1<<i)))) sz[j]=1;
            else sz[j]=0;
        }
        s=ask(sz);
        kul=(dist-s)/(e-gy);
        if (kul%2) xo+=(1<<i);
    }
    for (int i=0; i<n; i++) {
        int f=(i^xo);
        if (!v[i] && f<n && !v[f]) v[i]=1, v[f]=1, cnt++, ert[i]=cnt;
    }
    /*cout << "ertekek ";
    for (int i=0; i<n; i++) cout << ert[i] << " ";
    cout << "\n";*/
    for (int i=0; i<18; i++) {
        for (int j=0; j<m; j++) {
            if ((ert[x[j]]&(1<<i))==(ert[y[j]]&(1<<i))) sz[j]=1;
            else sz[j]=0;
        }
        s=ask(sz);
        kul=(dist-s)/(e-gy);
        if (kul%2) ki+=(1<<i);
    }
    for (int i=0; i<n; i++) if (ert[i]==ki) cs1=i;
    cs2=(cs1^xo);
    answer(cs1, cs2);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 380 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 288 KB Output is correct
2 Correct 12 ms 512 KB Output is correct
3 Correct 130 ms 2636 KB Output is correct
4 Correct 121 ms 2668 KB Output is correct
5 Correct 124 ms 2540 KB Output is correct
6 Correct 123 ms 2472 KB Output is correct
7 Correct 115 ms 2480 KB Output is correct
8 Correct 117 ms 2648 KB Output is correct
9 Correct 108 ms 2472 KB Output is correct
10 Correct 130 ms 2568 KB Output is correct
11 Correct 119 ms 2568 KB Output is correct
12 Correct 134 ms 2392 KB Output is correct
13 Correct 121 ms 2404 KB Output is correct
14 Correct 118 ms 2464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 640 KB Output is correct
2 Correct 24 ms 816 KB Output is correct
3 Correct 34 ms 1200 KB Output is correct
4 Correct 109 ms 2668 KB Output is correct
5 Correct 111 ms 2952 KB Output is correct
6 Correct 114 ms 2408 KB Output is correct
7 Correct 95 ms 2944 KB Output is correct
8 Correct 108 ms 2516 KB Output is correct
9 Correct 107 ms 2688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 15 ms 512 KB Output is correct
3 Correct 97 ms 1836 KB Output is correct
4 Correct 122 ms 2480 KB Output is correct
5 Correct 116 ms 2412 KB Output is correct
6 Correct 119 ms 2404 KB Output is correct
7 Correct 127 ms 2636 KB Output is correct
8 Correct 123 ms 2496 KB Output is correct
9 Correct 121 ms 2488 KB Output is correct
10 Correct 118 ms 2548 KB Output is correct
11 Correct 116 ms 2412 KB Output is correct
12 Correct 125 ms 2724 KB Output is correct
13 Correct 123 ms 2660 KB Output is correct
14 Correct 123 ms 2536 KB Output is correct
15 Correct 114 ms 2476 KB Output is correct
16 Correct 103 ms 2636 KB Output is correct
17 Correct 126 ms 2472 KB Output is correct
18 Correct 115 ms 2476 KB Output is correct
19 Correct 129 ms 2492 KB Output is correct
20 Correct 127 ms 2576 KB Output is correct
21 Correct 118 ms 2472 KB Output is correct
22 Correct 116 ms 2408 KB Output is correct
23 Correct 120 ms 2412 KB Output is correct
24 Correct 115 ms 2456 KB Output is correct
25 Correct 127 ms 2512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 632 KB Output is correct
2 Correct 14 ms 632 KB Output is correct
3 Correct 132 ms 2712 KB Output is correct
4 Correct 138 ms 3000 KB Output is correct
5 Correct 178 ms 3352 KB Output is correct
6 Correct 182 ms 3260 KB Output is correct
7 Correct 173 ms 3200 KB Output is correct
8 Correct 171 ms 3196 KB Output is correct
9 Correct 186 ms 3108 KB Output is correct
10 Correct 158 ms 3188 KB Output is correct
11 Correct 167 ms 3164 KB Output is correct
12 Correct 173 ms 3280 KB Output is correct
13 Correct 168 ms 3120 KB Output is correct
14 Correct 174 ms 3272 KB Output is correct
15 Correct 171 ms 3208 KB Output is correct
16 Correct 175 ms 3116 KB Output is correct
17 Correct 103 ms 2476 KB Output is correct
18 Correct 118 ms 2592 KB Output is correct
19 Correct 121 ms 2496 KB Output is correct
20 Correct 115 ms 2804 KB Output is correct
21 Correct 167 ms 3272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 512 KB Output is incorrect: {s, t} is wrong.
2 Halted 0 ms 0 KB -