Submission #484506

#TimeUsernameProblemLanguageResultExecution timeMemory
484506M4mouCounting Mushrooms (IOI20_mushrooms)C++17
Compilation error
0 ms0 KiB
//#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; string s; int use_machine(vector<int> a){ int cnt = 0; for(int i = 0;i<((int)a.size())-1;i++){ if(s[a[i]] != s[a[i+1]])cnt++; } return cnt; } int count_mushrooms(int n) { int cnt = 1; for(int i = 1;i<n-1;i+=2){ vector<int> a; a.push_back(i); a.push_back(0); a.push_back(i+1); int x = use_machine(a); if(x == 0){ cnt += 2; } else if(x == 1){ cnt += 1; } } if(n%2==0){ vector<int> a; a.push_back(0); a.push_back(n-1); int x = use_machine(a); if(x == 0)cnt++; } return cnt; } int main(){ while(1){ cin >> s; cout << count_mushrooms(s.size()) << endl; } }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc7w9Cu7.o: in function `use_machine(std::vector<int, std::allocator<int> >)':
stub.cpp:(.text+0x150): multiple definition of `use_machine(std::vector<int, std::allocator<int> >)'; /tmp/cc9o0Bm4.o:mushrooms.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cc7w9Cu7.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9o0Bm4.o:mushrooms.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status