Submission #1238017

#TimeUsernameProblemLanguageResultExecution timeMemory
1238017ayathkCoins (IOI17_coins)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "coins.h" using namespace std; #define fi first #define se second #define all(a) a.begin(),a.end() #define pb push_back const int maxn = 2e5+1; vector <int> coin_flips(vector <int> b, int c){ vector <int> d; int o = 0 ,z = 0; for(int i : b){ if(i == 1)o++; else z++; } int ch = -1; if(o > z)ch = 1; else ch = 0; if(o == 0 || z == 0){ d.push_back(c); return d; } if(b[c] == ch){ for(int i = 0;i < b.size();i++){ if(b[i] == ch && i != c){ d.push_back(i); break; } } else{ d.push_back(2); } return d; } int find_coin(vector <int> b){ int o = 0 ,z = 0; for(int i : b){ if(i == 1)o++; else z++; } int ch = -1; if(o < z)ch = 1; else ch = 0; for(int i = 0;i < b.size();i++){ if(b[i] == ch)return i; } return 2; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:36:3: error: expected '}' before 'else'
   36 |   else{
      |   ^~~~
coins.cpp:28:17: note: to match this '{'
   28 |   if(b[c] == ch){
      |                 ^