제출 #1141370

#제출 시각아이디문제언어결과실행 시간메모리
1141370Francisco_MartinCoins (IOI17_coins)C++20
컴파일 에러
0 ms0 KiB
#include "coins.h"
#include <bits/stdc++.h>
using namespace std;

#define debug(v) cerr<<#v" = "<<(v)<<"\n"

using ll=long long;
using ull=unsigned long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vpll=vector<pll>;
using vvll=vector<vll>;
const ll INF=1e9+100;
const ll MOD=998244353;
const ll MAXN=2e5+100;

vector<int> coins_flips(int[] b, int c){
    for(int i=0; i<b.size(); i++) if(b[i]) c^=i;
    vector<int> ans={c};
    return ans;
}

int find_coin(int[] b){
    int c;
    for(int i=0; i<b.size(); i++) if(b[i]) c^=i;
    return c;
}

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

coins.cpp:17:31: error: expected ',' or '...' before 'b'
   17 | vector<int> coins_flips(int[] b, int c){
      |                               ^
coins.cpp: In function 'std::vector<int> coins_flips(int*)':
coins.cpp:18:20: error: 'b' was not declared in this scope
   18 |     for(int i=0; i<b.size(); i++) if(b[i]) c^=i;
      |                    ^
coins.cpp:18:44: error: 'c' was not declared in this scope
   18 |     for(int i=0; i<b.size(); i++) if(b[i]) c^=i;
      |                                            ^
coins.cpp:19:22: error: 'c' was not declared in this scope
   19 |     vector<int> ans={c};
      |                      ^
coins.cpp:19:23: error: could not convert '{<expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   19 |     vector<int> ans={c};
      |                       ^
      |                       |
      |                       <brace-enclosed initializer list>
coins.cpp: At global scope:
coins.cpp:23:21: error: expected ',' or '...' before 'b'
   23 | int find_coin(int[] b){
      |                     ^
coins.cpp: In function 'int find_coin(int*)':
coins.cpp:25:20: error: 'b' was not declared in this scope
   25 |     for(int i=0; i<b.size(); i++) if(b[i]) c^=i;
      |                    ^