제출 #1198423

#제출 시각아이디문제언어결과실행 시간메모리
1198423TahirAliyev곤돌라 (IOI14_gondola)C++20
컴파일 에러
0 ms0 KiB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9 + 9;

int valid(int n, int arr[]){
    set<int> s;
    set<int> s2;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(arr[i] <= n) s.insert((arr[i] - i + n) % n);
        else cnt++;
        s2.insert(arr[i]);
    }
    #undef long long
    if(!(s2.size() == n && s.size() == 1)) return 0;
    return 1;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

//----------------------

int binpow(int a, int b){
    a %= MOD;
    int res = 1;
    while(b){
        if(b & 1) res = res * a % MOD;
        b /= 2; 
        a = a * a % MOD;
    }
    return res;
}

int countReplacement(int n, int arr[]){
    if(!valid(n, arr)){
        #undef long long
        return 0;
    } 
    vector<int> v;
    for(int i = 0; i < n; i++){
        if(arr[i] > n) v.push_back(arr[i]);
    } 
    sort(v.begin(), v.end());
    v.insert(v.begin(), n);
    int ans = 1;
    for(int i = 1; i < v.size(); i++){
        ans = ans * binpow(v.size() - i, v[i] - v[i - 1] - 1) % MOD;
    }
    if(v.size() - 1 == n) ans = ans * n % MOD;
    #undef long long
    return ans;
}

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

gondola.cpp:16:17: warning: extra tokens at end of #undef directive
   16 |     #undef long long
      |                 ^~~~
gondola.cpp:43:21: warning: extra tokens at end of #undef directive
   43 |         #undef long long
      |                     ^~~~
gondola.cpp:57:17: warning: extra tokens at end of #undef directive
   57 |     #undef long long
      |                 ^~~~
/usr/bin/ld: /tmp/ccxHZZt9.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x135): undefined reference to `replacement'
collect2: error: ld returned 1 exit status