제출 #285183

#제출 시각아이디문제언어결과실행 시간메모리
285183peti1234Highway Tolls (IOI18_highway)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "highway.h"
using namespace std;
const int c=90002;
long long m, dist, xo, s, kul, ert[c], cnt, cs1, cs2;;
bool v[c];
vector<int> sz;
find_pair(int n, vector<int> x, vector<int> y, long long gy, long long e) {
    m=x.size(), sz.resize(m);
    for (int i=0; i<m; i++) sz[i]=0;
    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[i]=0;
            else sz[i]=1;
        }
        s=ask(sz);
        kul=(s-dist)/(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;
    }
    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[i]=0;
            else sz[i]=1;
        }
        s=ask(sz);
        kul=(s-dist)/(e-gy);
        if (kul%2) cs1+=(1<<i);
    }
    cs2=(cs1^xo);
    answer(cs1, cs2);
}

컴파일 시 표준 에러 (stderr) 메시지

highway.cpp:8:73: error: ISO C++ forbids declaration of 'find_pair' with no type [-fpermissive]
    8 | find_pair(int n, vector<int> x, vector<int> y, long long gy, long long e) {
      |                                                                         ^
highway.cpp: In function 'int find_pair(int, std::vector<int>, std::vector<int>, long long int, long long int)':
highway.cpp:14:28: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   14 |             if (x[j]&(1<<i)==(y[j]&(1<<i))) sz[i]=0;
      |                      ~~~~~~^~~~~~~~~~~~~~~
highway.cpp:36:1: warning: no return statement in function returning non-void [-Wreturn-type]
   36 | }
      | ^