답안 #1010743

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1010743 2024-06-29T10:13:38 Z gaurezzz 식물 비교 (IOI20_plants) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#define F first 
#define S second
#define ll long long
#define nd '\n'

using namespace std;

vector <int> plants;
ll n=0;

void init (int k, vector <int> r){

    plants = r;
    n = r.size();
}

int compare_plants(int x, int y){

    bool menor=1, mayor=1;

    for (ll i=x; i<y; i++){

        if (plants[i] != 1) mayor=0;
        else menor=0; 
    }

    if (mayor) return -1;
    else if (menor) return 1;

    for (ll i=y; i!=x; i++){

        if (i == n) i=0;

        if (plants[i] != 1) mayor=0;
        else menor=0; 
    }

    if (mayor) return -1;
    else if (menor) return 1;
    else return 0;
}


int main (){

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    init(3, {0,1,1,2});

    cout << compare_plants(0,2) << nd;
    cout << compare_plants(1, 2) << nd;

    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccy044Jg.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cceWD5Yg.o:plants.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status