Submission #1308877

#TimeUsernameProblemLanguageResultExecution timeMemory
1308877minh30082008Coins (IOI17_coins)C++20
Compilation error
0 ms0 KiB
#include "coins.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define FOR(i, k, n) for(int i = k; i <= n; i++)
#define FOR1(i, k, n) for(int i = k; i >= n; i--)
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define ll long long
#define vll vector<ll>
#define pll pair<ll, ll>
#define re return 0
#define mii map<int, int>
#define input "ALONE.inp"
#define output "ALONE.out"
#define rf 	freopen(input, "r", stdin); freopen(output, "w", stdout)
using namespace std;
const int maxn = 1e4 + 5;
const int mod = 1e9 + 7;
const int base = 998244353;
const int base1 = 31;
const int SZ = 320;
const ll INF = 1e18;
void add(int &a, int b) 
{
	a += b; 
	if(a >= mod) a -= mod; 
	if(a < 0) a += mod; 
}
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	return uniform_int_distribution<int>(l, r) (rd);
}
int[] coin_flips(int[] b, int c)
{
	int T = 0;
	FOR(i, 0, 63)
		if(b[i] == 1)
			T ^= i;
	int d = T ^ c;
	int a[1];
	a[0] = d;
	return a;
}
int find_coin(int[] b)
{
	int ans = 0;
	FOR(i, 0, 63)
		if(b[i] == 1)
			ans ^= i;
	return ans;
}

Compilation message (stderr)

coins.cpp:38:4: error: structured binding declaration cannot have type 'int'
   38 | int[] coin_flips(int[] b, int c)
      |    ^~
coins.cpp:38:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
coins.cpp:38:4: error: empty structured binding declaration
coins.cpp:38:7: error: expected initializer before 'coin_flips'
   38 | int[] coin_flips(int[] b, int c)
      |       ^~~~~~~~~~
coins.cpp:49:21: error: expected ',' or '...' before 'b'
   49 | int find_coin(int[] b)
      |                     ^
coins.cpp: In function 'int find_coin(int*)':
coins.cpp:53:20: error: 'b' was not declared in this scope
   53 |                 if(b[i] == 1)
      |                    ^
grader.cpp: In function 'void shuffle(std::vector<int>&)':
grader.cpp:88:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   88 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:5:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~