답안 #1001712

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1001712 2024-06-19T07:11:33 Z codexistent 곤돌라 (IOI14_gondola) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <set>
#include <gondola.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i <= b; i++)

int diff(int n, int a, int b){
    if(b >= a) return b - a;
    else (n - a) + b;
}

int valid(int n, int inputSeq[]){
    pair<int, int> prev = {-1, 0};
    set<int> s;
    FOR(i, 0, n - 1){
        if(inputSeq[i] <= n){
            if(prev.first == -1){
                prev = {i, inputSeq[i]};
            }else{
                if(prev.second + diff(n, prev.first, i) != inputSeq[i]) return 0;
                prev = {i, inputSeq[i]};
            }
        }else{
            if(s.find(inputSeq[i]) != s.end()) return 0;
            s.insert(inputSeq[i]);
        }
    }

    return 1;
}

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

int countReplacement(int n, int inputSeq[]){
    return 1;
}

int main(){
    int t, x;
    cin >> t >> x;
    const int n = x;

    int arr[n];
    FOR(i, 0, n - 1) cin >> arr[i];

    if(t <= 3) valid(x, arr);
    else if(t <= 6) {
        int rep[n];
        replacement(x, arr, rep);
    }else{
        countReplacement(x, arr);
    }
}

Compilation message

gondola.cpp: In function 'int diff(int, int, int)':
gondola.cpp:9:18: warning: statement has no effect [-Wunused-value]
    9 |     else (n - a) + b;
      |          ~~~~~~~~^~~
gondola.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^
/usr/bin/ld: /tmp/ccWH3SVd.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccihkO7e.o:gondola.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status