제출 #1103094

#제출 시각아이디문제언어결과실행 시간메모리
1103094underwaterkillerwhale캥거루 (CEOI16_kangaroo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
#define rep(i,m,n) for(int i=(m); i<=(n); i++)
#define reb(i,m,n) for(int i=(m); i>=(n); i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair
#define fs first
#define se second
#define bit(msk, i) ((msk >> i) & 1)
#define iter(id, v) for(auto id : v)
#define pb push_back
#define SZ(v) (ll)v.size()
#define ALL(v) v.begin(),v.end()

using namespace std;

mt19937_64 rd(chrono :: steady_clock :: now ().time_since_epoch().count());
ll Rand (ll l, ll r) { return uniform_int_distribution<ll> (l, r) (rd); }

const int N = 2e5 + 7;
const int Mod = 1e9 + 7;///lon
const int INF = 1e9;
const ll BASE = 137;
const int szBL = 450;

int n, K;
int a[N];
int sos[(1 << 20) + 7];

void solution () {
    cin >> n;
    rep (i, 1, n) { 
        cin >> a[i];
    }
    rep (i, 1, n)
    rep (j, 1, n) { 
        sos[a[i] & a[j]]++;
    }
    rep (i, 0, 19) 
    rep (msk, 0, (1 << 20) - 1) 
        if (!bit(msk, i)) 
            sos[msk] += sos[msk ^ (1 << i)];
    
    int A, B, C, D;
    rep (i, 1, n) 
    rep (j, 1, n) { 
        if (sos[a[i] & a[j]] < K) {
            K -= sos[a[i] & a[j]];
        }
        else {
            A = i, B = j;
            break;
        }
    }
    rep (msk, ())
    rep (i, 1, n) 
        sos[a[i]]++;
    rep (i, 0, 19) 
    rep (msk, 0, (1 << 20) - 1) 
        if (!bit(msk, i)) 
            sos[msk] += sos[msk ^ (1 << i)];
}

#define file(name) freopen(name".inp","r",stdin); \
freopen(name".out","w",stdout);
int main () {
//    file("c");
    ios_base :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int num_Test = 1;
//    cin >> num_Test;
    while (num_Test--)
        solution();
}
/*
no bug challenge +11

7 9
1 5 3 4 8 3 2
7 4 8 3 2 3 1

ko gan gtri bien co the cut
bien doi operation update doan thanh update phan tu tren mang hieu de de quan sat mo hinh bai toan hon
*/

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

kangaroo.cpp:56:17: error: macro "rep" requires 3 arguments, but only 2 given
   56 |     rep (msk, ())
      |                 ^
kangaroo.cpp:3: note: macro "rep" defined here
    3 | #define rep(i,m,n) for(int i=(m); i<=(n); i++)
      | 
kangaroo.cpp: In function 'void solution()':
kangaroo.cpp:56:5: error: 'rep' was not declared in this scope
   56 |     rep (msk, ())
      |     ^~~
kangaroo.cpp:57:10: error: 'i' was not declared in this scope
   57 |     rep (i, 1, n)
      |          ^
kangaroo.cpp:3:35: note: in definition of macro 'rep'
    3 | #define rep(i,m,n) for(int i=(m); i<=(n); i++)
      |                                   ^
kangaroo.cpp:45:15: warning: unused variable 'C' [-Wunused-variable]
   45 |     int A, B, C, D;
      |               ^
kangaroo.cpp:45:18: warning: unused variable 'D' [-Wunused-variable]
   45 |     int A, B, C, D;
      |                  ^