제출 #484953

#제출 시각아이디문제언어결과실행 시간메모리
484953M4mou버섯 세기 (IOI20_mushrooms)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "mushrooms.h" #pragma GCC optimize ("Ofast") #pragma GCC target ("avx2") using namespace std; using ll = long long; using vi = vector<int>; #define pb push_back #define ff first #define ss second #define lb lower_bound #define all(x) (x).begin() , (x).end() string s;/* int use_machine(vector<int> a){ int c = 0; for(int i = 1;i<a.size();i++){ if(s[a[i]] != s[a[i-1]])c++; } return c; }*/ int count_mushrooms(int n) { int cnt = 1; int k = 220; vector<int>arrA, arrB; for(int i = 1;i<k && i < n;i++){ vector<int> a; a = {0, i}; if(use_machine(a)) { arrB.pb(i); } else { arrA.pb(i); cnt++; } } #define sz(x) (int)x.size() if(sz(arrA) >= sz(arrB)) { int i = k; while(i<n){ vector<int> a; for(int j : arrA){ a.pb(j); a.pb(i); i++; if(i == n)break; } int x = use_machine(a); cnt += (int)(a.size()/2) - (x+1)/2; } } else { int i = k; while(i<n){ vector<int> b; for(int j : arrB){ b.pb(j); b.pb(i); i++; if(i == n)break; } int x = use_machine(b); cnt += (x+1)/2; } } return cnt; } int main(){ while(1){ cin >> s; cout << count_mushrooms(s.size()) << endl; } }

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

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