Submission #1006136

#TimeUsernameProblemLanguageResultExecution timeMemory
1006136Abdullah_AlodaibiCoins (IOI17_coins)C++17
Compilation error
0 ms0 KiB
#include <coins.h>
using namespace std;
vector<int> coin_flips(vector<int> b, int c){
    ll x=0;
    for(int i=0;i<b.size();i++){
        x+=b[i]*i;
        x%=b.size();
    }
    b[((c+b.size())-x)%b.size()]=(b[((c+b.size())-x)%b.size()]+1)%2;
    return b;
}
int find_coin(vector<int> b){
    ll x=0;
    for(int i=0;i<b.size();i++){
        x+=b[i]*i;
        x%=b.size();
    }
    return x;
}

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:4:5: error: 'll' was not declared in this scope
    4 |     ll x=0;
      |     ^~
coins.cpp:5:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |     for(int i=0;i<b.size();i++){
      |                 ~^~~~~~~~~
coins.cpp:6:9: error: 'x' was not declared in this scope
    6 |         x+=b[i]*i;
      |         ^
coins.cpp:9:21: error: 'x' was not declared in this scope
    9 |     b[((c+b.size())-x)%b.size()]=(b[((c+b.size())-x)%b.size()]+1)%2;
      |                     ^
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:13:5: error: 'll' was not declared in this scope
   13 |     ll x=0;
      |     ^~
coins.cpp:14:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i=0;i<b.size();i++){
      |                 ~^~~~~~~~~
coins.cpp:15:9: error: 'x' was not declared in this scope
   15 |         x+=b[i]*i;
      |         ^
coins.cpp:18:12: error: 'x' was not declared in this scope
   18 |     return x;
      |            ^