submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s941765650 | p03752 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int N, K;
vector<long> buildings;
int build(int now, long back_building_height, int increase_buildings){
if(increase_buildings == K){
return 0;
}else if(N - now == K - increase_buildings){
return max(0l, back_building_height + 1 - buildings[now]) + build(now + 1, max(back_building_height + 1, buildings[now]), increase_buildings + 1);
}else{
return min(max(0l, back_building_height + 1 - buildings[now]) + build(now + 1, max(back_building_height + 1, buildings[now]), increase_buildings + 1), build(now + 1, back_building_height, increase_buildings));
}
}
int main(){
cin >> N >> K;
buildings.resize(N);
for(int i = 0; i < N; i++){
cin >> buildings[i];
}
cout << build(1, buildings[0], 1) << endl;
}
| a.cc: In function 'int build(int, long int, int)':
a.cc:15:19: error: no matching function for call to 'min(long int, int)'
15 | return min(max(0l, back_building_height + 1 - buildings[now]) + build(now + 1, max(back_building_height + 1, buildings[now]), increase_buildings + 1), build(now + 1, back_building_height, increase_buildings));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:15:19: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
15 | return min(max(0l, back_building_height + 1 - buildings[now]) + build(now + 1, max(back_building_height + 1, buildings[now]), increase_buildings + 1), build(now + 1, back_building_height, increase_buildings));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:15:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
15 | return min(max(0l, back_building_height + 1 - buildings[now]) + build(now + 1, max(back_building_height + 1, buildings[now]), increase_buildings + 1), build(now + 1, back_building_height, increase_buildings));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s858742913 | p03752 | C | /*
cat <<EOF >mistaken-paste
*/
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef unsigned long long ull;
typedef signed long long sll;
#define N_MAX 15
#define M_MAX 200
typedef struct {
int a;
int b;
} hw;
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
ull s;
ull t;
int c;
} struct_a;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull vua, vub, vuc, vud, vue, vuf;
sll vsa, vsb, vsc, vsd, vse, vsf;
long double vra, vrb, vrc;
ull a[N_MAX];
// sll a[N_MAX];
// ull a[N_MAX][N_MAX];
// ull wall[N_MAX][M_MAX];
// ull b[N_MAX];
// sll b[N_MAX];
// ull b[N_MAX][N_MAX];
// sll b[N_MAX][N_MAX];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// size_t slen;
// size_t tlen;
// char s[N_MAX][M_MAX + 1];
// ull dp[N_MAX];
// sll dp[N_MAX];
// bool dp[N_MAX];
// ull dq[N_MAX];
// ull dp[N_MAX + 1][N_MAX + 1];
// ull dp[N_MAX][M_MAX + 1];
// hw arr[N_MAX];
// hwll arr[N_MAX];
// hw brr[M_MAX];
ull bitdp[1 << N_MAX];
// ull digitdp[102][ 2][ 2];
// pos less carry
struct_a arr[N_MAX * 2];
// struct_b brr[N_MAX * 2];
void swap_adj (ull *a, ull *b) {
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide (ull a, ull b) {
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int digits (ull x) {
int i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
// int nextroute (int arr[]) {
// int i = n - 1;
// int j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int), comp);
// return 0;
// }
int targetdig (ull x, int index /* 1-indexed */) {
// static...?
int posmax = digits(x);
if (posmax < index) return -1;
while (posmax > index) {
posmax--;
x /= 10;
}
return x % 10;
}
int charcomp (const char left, const char right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int pcharcomp (const char *left, const char *right) {
return charcomp(*left, *right);
}
int intcomp (const int left, const int right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int pintcomp (const int *left, const int *right) {
return intcomp(*left, *right);
}
int ullcomp (const ull left, const ull right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int pullcomp (const ull *left, const ull *right) {
return ullcomp(*left, *right);
}
int sllcomp (const sll left, const sll right) {
if (left < right) {
return -1;
} else if (left > right) {
return +1;
} else {
return 0;
}
}
int psllcomp (const sll *left, const sll *right) {
return sllcomp(*left, *right);
}
int phwAcomp (const hw *left, const hw *right) {
return intcomp(left->a, right->a);
}
int phwBcomp (const hw *left, const hw *right) {
return intcomp(left->b, right->b);
}
int phwABcomp (const hw *left, const hw *right) {
int x = phwAcomp(left, right);
if (x) return x;
return phwBcomp(left, right);
}
int phwllAcomp (const hwll *left, const hwll *right) {
return sllcomp(left->a, right->a);
}
int phwllBcomp (const hwll *left, const hwll *right) {
return sllcomp(left->b, right->b);
}
int phwllABcomp (const hwll *left, const hwll *right) {
int x = phwllAcomp(left, right);
if (x) return x;
return phwllBcomp(left, right);
}
int pstrAcomp (const struct_a *left, const struct_a *right) {
int x;
if (x = ullcomp(left->t, right->t)) return x;
if (x = ullcomp(left->s, right->s)) return x;
if (x = intcomp(left->c, right->c)) return x;
return 0;
}
int bitlet (char c) {
return (1 << (c - 'a'));
}
ull ullabs (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sllabs (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll nibutanlobo (bool (*func)(sll arg), sll ok, sll ng) {
while (sllabs(ok, ng) > 1) {
sll med = (ok + ng) / 2;
if (func(med)) {
ok = med;
} else {
ng = med;
}
// printf("debug: [%lld %lld)\n", ok, ng);
}
if (!func(ok)) return ok * 2 - ng;
return ok;
}
ull filled[N_MAX];
ull solve () {
sll i, j, ki;
ull result = 0;
// sll result;
ull sum = 0;
// qsortの際には"p"ullcompを使う
if (n == k) {
for (i = 0; i < n; i++) {
if (i == 0) {
sum = a[0];
continue;
}
if (++sum < a[i]) {
result += (a[i] - sum);
sum = a[i];
}
}
} else {
//
}
printf("%llu\n", result);
puts(s);
return 0;
success:
puts("Yes");
// printf("%llu\n", result);
return 0;
fail:
puts("No");
return 1;
}
int main (void) {
int i, j;
int x, y;
// scanf("%llu%llu", &h, &w);
scanf("%llu%llu", &n, &k);
// scanf("%llu%llu", &vua, &vub);
// scanf("%s", s);
// slen = strlen(s);
// scanf("%s", t);
// tlen = strlen(t);
// scanf("%llu", &k);
for (i = 0; i < n; i++) {
scanf("%llu", &a[i]);
}
// for (i = 0; i < m; i++) {
// scanf("%lld", &b[i]);
// }
// for (i = 0; i < n; i++) {
// scanf("%llu%llu%d", &arr[i].s, &arr[i].t, &arr[i].c);
// arr[i].c--;
// }
solve();
// for (i = 0; i < n; i++) {
// // scanf("%llu%llu", &vua, &vub);
// scanf("%s", s);
// solve();
// }
return 0;
}
| main.c: In function 'solve':
main.c:342:14: error: 's' undeclared (first use in this function)
342 | puts(s);
| ^
main.c:342:14: note: each undeclared identifier is reported only once for each function it appears in
|
s803542869 | p03752 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)
#define pb push_back
const int LLINF = 1LL << 60;
signed main()
{
int N, K;
int A[25];
int dp[25][25];
cin >> N >> K;
Rep(i, N) cin >> A[i];
int sample = A[0];
fill_n(*dp, 25 * 25, LLINF);
dp[0][0] = 0;
Rep(i, K - 1) {
Rep(j, N - 1) {
if(dp[i][j] == LLINF) continue;
Reps(k, j + 1, N) {
dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
}
}
}
int minv = LLINF;
Rep(i, N) {
minv = min(minv, dp[K - 1][i]);
}
cout << minv << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:56: error: no matching function for call to 'max(int, long long int)'
29 | dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:29:56: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
29 | dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:29:56: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
29 | dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + max(0, (i + 1 + sample) - A[k]));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s608051285 | p03752 | C++ | #include <vector>
#include <string.h>
#include<iostream>
#include<set>
#include<map>
#include<unordered_map>
#include<string.h>
#include<algorithm>
#include <stdlib.h>
#include<queue>
using namespace std;
typedef long long ll;
int main(){
// vector<int>b(5);
// int n=248832;
// for(int j=0;j<5;j++){
// b[j]=((int)(248831/pow(12,j)))%12;
// //cout<<i<<" "<<j<<" "<<" "<<((int)(i/pow(12,j)))%12<<" "<<b[j]<<endl;
// cout<<b[j]<<" ";
// }
// cout<<endl;
ll n,k;
cin>>n>>k;
vector<ll>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
ll cur=1;
ll last=a[0];
ll need=0;
for(int i=1;i<n;i++){
if(a[i]>last){
last=a[i];
cur++;
} else {
last++;
need+=last-a[i];
}
}
if(n==k){
cout<<need<<endl;
return 0;
}
ll mi=100000000;
vector<int>b(n);
for(int i=0;i<248832;i++){
// cout<<"i: "<<i<<endl;
bool ok=true;
for(int j=0;j<n;j++){
b[j]=((int)(i/pow(12,j)))%12;
}
ll mieru=1;
ll last=b[0];
if(b[0]<a[0])ok=false;
for(int i=1;i<n;i++){
if(b[i]>last){
last=b[i];
mieru++;
}
if(b[i]<a[i]){
ok=false;
}
}
if(!ok)continue;
if(mieru<k)continue;
//cout<<mieru<<endl;
ll cur=b[0]-a[0];
for(int i=1;i<n;i++){
cur+=b[i]-a[i];
}
mi=min(mi,cur);
}
cout<<mi<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:53:27: error: 'pow' was not declared in this scope
53 | b[j]=((int)(i/pow(12,j)))%12;
| ^~~
|
s564446567 | p03752 | C++ | #include <iostream>
using namespace std;
#define int long long
int bitcount(int a){
int r = 0;
while(a){
a -= a & -a;
r++;
}
return r;
}
signed main(){
int n, k;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; i++) cin >> a[i];
int ans = 1e9 + 7;
for(int i = 0; i < 1 << n; i++){
if(bitcount(i) < k) continue;
int tmp = 0, p = -1;
for(int j = 0; j < n; j++){
if(i >> j & 1){
if(p == -1) p = a[j] + 1;
else{
tmp += max(0, p - a[j]);
p = max(p + 1, a[j] + 1);
}
}else p = max(p, a[j] + 1);
}
ans = min(ans, tmp);
next:;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:28:51: error: no matching function for call to 'max(int, long long int)'
28 | tmp += max(0, p - a[j]);
| ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:28:51: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
28 | tmp += max(0, p - a[j]);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
|
s888706069 | p03752 | C++ | #include "bits/stdc++.h"
#ifdef WINT_MIN
#define __MAI
#endif
using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;
#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define debugaar(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[y][x]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007ll
void printbit(int u) { if (u == 0)cout << 0; else { int s = 0, k = 0; for (; 0<u; u >>= 1, k++)s = (s << 1) | (u & 1); for (; 0<k--; s >>= 1)cout << (s & 1); } }template<typename T1, typename T2>
ostream& operator <<(ostream &o, const pair<T1, T2> p) { o << "(" << p.first << ":" << p.second << ")"; return o; }
#define TIME chrono::system_clock::now()
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())
namespace {
std::chrono::system_clock::time_point t;
void tic() { t = TIME; }
void toc() { fprintf(stderr, "TIME : %lldms\n", MILLISEC(TIME - t)); }
std::chrono::system_clock::time_point tle = TIME;
#ifdef __MAI
void safe_tle(int msec) { assert(MILLISEC(TIME - tle) < msec); }
#else
#define safe_tle(k) ;
#endif
}
#ifndef __MAI
namespace {
class MaiScanner {
public:
template<typename T>
void input_integer(T& var) {
var = 0;
T sign = 1;
int cc = getchar_unlocked();
for (; cc<'0' || '9'<cc; cc = getchar_unlocked())
if (cc == '-') sign = -1;
for (; '0' <= cc&&cc <= '9'; cc = getchar_unlocked())
var = (var << 3) + (var << 1) + cc - '0';
var = var*sign;
}
void ign() { getchar_unlocked(); }
MaiScanner& operator>>(int& var) {
input_integer<int>(var);
return *this;
}
MaiScanner& operator>>(long long& var) {
input_integer<long long>(var);
return *this;
}
};
}
MaiScanner scanner;
#else
#define scanner cin
#endif
int width, height;
int m, n, kei;
int aa[20];
int main() {
int i, j, k;
ll x, y, a, b;
scanner >> n >> kei;
for (i = 0; i < n; ++i) {
scanner >> aa[i];
}
ll cost = -1;
for (int bit = 0; bit < (1 << n) ; ++bit) {
if (kei == __builtin_popcount(bit)) {
a = 0;
y = aa[0];
b = bit;
for (i = 0; b; ++i, b>>=1) {
if (b & 1) {
a += max(y - aa[i], 0);
y = max(aa[i], y);
++y;
}else{
y = max(aa[i], y);
}
//cout << y << endl;
}
if (cost < 0 || a < cost) {
cost = a;
}
}
}
cout << cost << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:91:29: error: no matching function for call to 'max(ll, int)'
91 | a += max(y - aa[i], 0);
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:91:29: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
91 | a += max(y - aa[i], 0);
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:91:29: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
91 | a += max(y - aa[i], 0);
| ~~~^~~~~~~~~~~~~~
a.cc:92:28: error: no matching function for call to 'max(int&, ll&)'
92 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:92:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
92 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:92:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
92 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
a.cc:95:28: error: no matching function for call to 'max(int&, ll&)'
95 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:95:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
95 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:95:28: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
95 | y = max(aa[i], y);
| ~~~^~~~~~~~~~
|
s240956745 | p03752 | C++ | #include<iostream>
#include <algorithm>
#include <string.h>
#include <vector>
using namespace std;
int N,K;
const long long INF=100000000000LL;
long long a[20];
long long reg(int n,int k,long long t){
if(k==K)return 0;
if(n==N)return INF;
if(a[n]>t)return reg(n+1,k+1,a[n]);
long long was=INF;
was=min(was,t+1-a[n]+reg(n+1,k+1,t+1));
was=min(was,reg(n+1,k,t));
//cout<<n<<" "<<k<<" "<<t<<" "<<was<<endl;
return was;
}
int main(){
memset(dp,-1,sizeof(dp));
cin>>N>>K;
for(int i=0;i<N;++i){
cin>>a[i];
}
cout<<reg(1,1,a[0])<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:16: error: 'dp' was not declared in this scope
20 | memset(dp,-1,sizeof(dp));
| ^~
|
s067930503 | p03752 | C++ | #include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll __int64
ll a[20];
ll vis[20];
ll n,k;
ll output;
void Dfs(ll u)
{
if(u==n+1)
{
ll b[20];
ll cnt=0;
ll pre=a[1];
for(ll i=1;i<=n;i++)if(vis[i]==1)cnt++;
for(ll i=1;i<=n;i++)b[i]=a[i];
if(cnt==k)
{
ll sum=0;
for(ll i=2;i<=n;i++)
{
if(vis[i]==1)
{
if(b[i]>pre)pre=b[i];
else
{
sum+=pre+1-b[i];
b[i]=pre+1;
pre=b[i];
}
}
}
ll look=1;
for(ll i=2;i<=n;i++)
{
ll flag=0;
for(ll j=1;j<i;j++)
{
if(b[j]>b[i])flag=1;
}
if(flag==0)look++;
}
if(look==k)
{
output=min(output,sum);
}
}
return ;
}
vis[u]=1;
Dfs(u+1);
if(u!=1)
{
vis[u]=0;
Dfs(u+1);
}
}
int main()
{
while(~scanf("%I64d%I64d",&n,&k))
{
output=10000000000000000;
memset(vis,0,sizeof(vis));
for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
Dfs(1);
printf("%I64d\n",output);
}
}
| a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:6:1: note: in expansion of macro 'll'
6 | ll a[20];
| ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:7:1: note: in expansion of macro 'll'
7 | ll vis[20];
| ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:8:1: note: in expansion of macro 'll'
8 | ll n,k;
| ^~
a.cc:5:12: error: '__int64' does not name a type; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:9:1: note: in expansion of macro 'll'
9 | ll output;
| ^~
a.cc:10:6: error: variable or field 'Dfs' declared void
10 | void Dfs(ll u)
| ^~~
a.cc:5:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:10:10: note: in expansion of macro 'll'
10 | void Dfs(ll u)
| ^~
a.cc: In function 'int main()':
a.cc:62:32: error: 'n' was not declared in this scope
62 | while(~scanf("%I64d%I64d",&n,&k))
| ^
a.cc:62:35: error: 'k' was not declared in this scope
62 | while(~scanf("%I64d%I64d",&n,&k))
| ^
a.cc:64:9: error: 'output' was not declared in this scope
64 | output=10000000000000000;
| ^~~~~~
a.cc:65:16: error: 'vis' was not declared in this scope
65 | memset(vis,0,sizeof(vis));
| ^~~
a.cc:5:12: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
5 | #define ll __int64
| ^~~~~~~
a.cc:66:13: note: in expansion of macro 'll'
66 | for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
| ^~
a.cc:66:20: error: 'i' was not declared in this scope
66 | for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
| ^
a.cc:66:44: error: 'a' was not declared in this scope
66 | for(ll i=1;i<=n;i++)scanf("%I64d",&a[i]);
| ^
a.cc:67:9: error: 'Dfs' was not declared in this scope; did you mean 'ffs'?
67 | Dfs(1);
| ^~~
| ffs
|
s772206164 | p03752 | C++ | #include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define INF 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,K;
ll dp[16][16][300];
ll a[20];
vector<ll> index;
int main(void){
scanf("%d%d",&n,&K);
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
for(int j=0;j<15;j++){
index.push_back((ll)a[i]+j);
}
}
index.push_back(0);
sort(index.begin(),index.end());
index.erase(unique(index.begin(),index.end()),index.end());
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
for(int k=0;k<=index.size();k++){
dp[i][j][k]=(ll)n*INF;
}
}
}
dp[0][0][0]=0;
for(int i=0;i<n;i++){
a[i]=lower_bound(index.begin(),index.end(),a[i])-index.begin();
for(int j=0;j<n;j++){
for(int k=0;k<index.size();k++){
dp[i+1][j][max(k,(int)a[i])]=min(dp[i+1][j][max(k,(int)a[i])],dp[i][j][k]);
if(a[i]>k){
dp[i+1][j+1][a[i]]=min(dp[i+1][j+1][a[i]],dp[i][j][k]);
}else{
ll cost=index[k+1]-index[a[i]];
dp[i+1][j+1][k+1]=min(dp[i+1][j+1][k+1],dp[i][j][k]+cost);
}
}
}
}
ll res=dp[n][K][0];
for(int i=0;i<index.size();i++){
res=min(res,dp[n][K][i]);
}
printf("%lld\n",res);
return 0;
}
| a.cc:21:12: error: 'std::vector<long long int> index' redeclared as different kind of entity
21 | vector<ll> index;
| ^~~~~
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:2:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int main()':
a.cc:28:31: error: overloaded function with no contextual type information
28 | index.push_back((ll)a[i]+j);
| ^~~~~~~~~
a.cc:31:15: error: overloaded function with no contextual type information
31 | index.push_back(0);
| ^~~~~~~~~
a.cc:32:20: error: overloaded function with no contextual type information
32 | sort(index.begin(),index.end());
| ^~~~~
a.cc:32:34: error: overloaded function with no contextual type information
32 | sort(index.begin(),index.end());
| ^~~
a.cc:33:15: error: overloaded function with no contextual type information
33 | index.erase(unique(index.begin(),index.end()),index.end());
| ^~~~~
a.cc:33:34: error: overloaded function with no contextual type information
33 | index.erase(unique(index.begin(),index.end()),index.end());
| ^~~~~
a.cc:33:48: error: overloaded function with no contextual type information
33 | index.erase(unique(index.begin(),index.end()),index.end());
| ^~~
a.cc:33:61: error: overloaded function with no contextual type information
33 | index.erase(unique(index.begin(),index.end()),index.end());
| ^~~
a.cc:36:46: error: overloaded function with no contextual type information
36 | for(int k=0;k<=index.size();k++){
| ^~~~
a.cc:43:40: error: overloaded function with no contextual type information
43 | a[i]=lower_bound(index.begin(),index.end(),a[i])-index.begin();
| ^~~~~
a.cc:43:54: error: overloaded function with no contextual type information
43 | a[i]=lower_bound(index.begin(),index.end(),a[i])-index.begin();
| ^~~
a.cc:43:72: error: overloaded function with no contextual type information
43 | a[i]=lower_bound(index.begin(),index.end(),a[i])-index.begin();
| ^~~~~
a.cc:45:45: error: overloaded function with no contextual type information
45 | for(int k=0;k<index.size();k++){
| ^~~~
a.cc:50:54: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
50 | ll cost=index[k+1]-index[a[i]];
| ^
a.cc:50:65: error: invalid types '<unresolved overloaded function type>[ll {aka long long int}]' for array subscript
50 | ll cost=index[k+1]-index[a[i]];
| ^
a.cc:57:29: error: overloaded function with no contextual type information
57 | for(int i=0;i<index.size();i++){
| ^~~~
|
s274703586 | p03753 | C++ | #include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace atcoder;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000000000000
long long get(int h,int m,vector<int> x){
vector<string> S(h,string(7,'0'));
rep(i,7*h){
if(binary_search(x.begin(),x.end(),i%m)){
S[i/7][i%7]='1';
}
}
dsu D(h*7);
rep(i,h){
rep(j,7){
if(i!=h-1){
if(S[i][j]=='0'&&S[i+1][j]=='0'){
D.merge(i*7+j,(i+1)*7+j);
}
}
if(j!=6){
if(S[i][j]=='0'&&S[i][j+1]=='0'){
D.merge(i*7+j,i*7+j+1);
}
}
}
}
long long ret = 0LL;
rep(i,h){
rep(j,7){
if(S[i][j]=='1')continue;
if(D.leader(i*7+j)==i*7+j)ret++;
}
}
return ret;
}
int main(){
long long n,m,q;
cin>>n>>m>>q;
vector<int> a(q);
rep(i,q)cin>>a[i];
long long ans = 0LL;
if(n<=m){
ans = get(n,m,a);
}
else{
ans = get(m,m,a);
n -= m;
ans += n/m * (get(2*m,m,a)-get(m,m,a));
n %= m;
ans += get(m+n,m,a) - get(m,m,a);
}
cout<<ans<<endl;
return 0;
}
| a.cc:3:10: fatal error: atcoder/dsu: No such file or directory
3 | #include <atcoder/dsu>
| ^~~~~~~~~~~~~
compilation terminated.
|
s201016453 | p03753 | C++ | z#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;
#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);
typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;
//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
const int MAX = 100010;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
//********************************template END****************************************//
ll N, M, Q;
void dfs(int x, int y, mat& m)
{
m[y][x] = 1;
rep(4, d)
{
int ny = y + dy[d], nx = x + dx[d];
if (0 <= ny && ny < (int)m.size() && 0 <= nx && nx < 7)
{
if (m[ny][nx] == 0)
{
dfs(nx, ny, m);
}
}
}
}
void solve(void){
cin >> N >> M >> Q;
vec qs(Q);
rep(Q, i)
{
cin >> qs[i];
}
if (M % 7)
{
//0 -> white, 1 -> black
mat maze(M, vec (7, 0)), dmaze(M*2, vec(7, 0));
rep(Q, i) rep(7, j)
{
int x = qs[i] + M*j;
int h = x / 7, w = x % 7;
dmaze[h][w] = maze[h][w] = 1;
x += 7*M;
h = x / 7, w = x % 7;
dmaze[h][w] = 1;
}
int a = 0, b = 0, k = N/M;
rep(M, i) rep(7, j)
{
if (maze[i][j] == 0)
{
a++;
dfs(j, i, maze);
}
}
rep(2*M, i) rep(7, j)
{
if (dmaze[i][j] == 0)
{
b++;
dfs(j, i, dmaze);
}
}
//cout << a << ' ' << b << ' ' << k << endl;
int ans = a + (b-a) * (k-1);
cout << ans << endl;
return;
}
//0 -> white, 1 -> black
mat maze(M/7, vec (7, 0)), dmaze(M/7*2, vec(7, 0));
rep(Q, i)
{
int x = qs[i];
int h = x / 7, w = x % 7;
dmaze[h][w] = maze[h][w] = 1;
x += M;
h = x / 7, w = x % 7;
dmaze[h][w] = 1;
}
int a = 0, b = 0, k = N*7/M;
rep(M/7, i) rep(7, j)
{
if (maze[i][j] == 0)
{
a++;
dfs(j, i, maze);
}
}
rep(2*M/7, i) rep(7, j)
{
if (dmaze[i][j] == 0)
{
b++;
dfs(j, i, dmaze);
}
}
//cout << a << ' ' << b << ' ' << k << endl;
int ans = a + (b-a) * (k-1);
cout << ans << endl;
}
int main(void){
solve();
//cout << "yui(*-v・)yui" << endl;
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | z#include <iostream>
| ^
a.cc:1:1: error: 'z' does not name a type
1 | z#include <iostream>
| ^
In file included from /usr/include/c++/14/cmath:45,
from a.cc:6:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdio.h:34,
from /usr/include/c++/14/cstdio:42,
from a.cc:2:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/include/c++/14/bits/stl_a |
s591788197 | p03753 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
ll gcd(ll a, ll b) {
if (b > a) swap(a, b);
while (b) {
ll t = a % b;
a = b;
b = t;
}
return a;
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
int dy[] = {1, 0, -1, 0};
int dx[] = {0, -1, 0, 1};
ll n, m, q;
ll h;
int used[101010][7] = {};
int cal[101010][7] = {};
int used2[2][7] = {};
int cal2[2][7] = {};
void dfs(int y, int x) {
used[y][x] = 1;
rep(i,4) {
if (y + dy[i] >= 0 && y + dy[i] < h && x + dx[i] >= 0 && x + dx[i] < 7 && !used[y + dy[i]][x + dx[i]] && !cal[y + dy[i]][x + dx[i]]) {
dfs(y + dy[i], x + dx[i]);
}
}
}
void dfs2(int y, int x) {
used2[y][x] = 1;
rep(i,4) {
if (y + dy[i] >= 0 && y + dy[i] < 2 && x + dx[i] >= 0 && x + dx[i] < 7 && !used2[y + dy[i]][x + dx[i]] && !cal2[y + dy[i]][x + dx[i]]) {
dfs2(y + dy[i], x + dx[i]);
}
}
}
void solve() {
cin >> n >> m >> q;
h = lcm(7, m) / 7;
rep(i,q) {
ll a;
cin >> a;
for (ll j = a; j < 7 * h; j += m) {
if (cal[j/7][j%7]) break;
cal[j/7][j%7] = 1;
}
}
ll cnt = 0;
rep(i,h) {
rep(j,7) {
if (!used[i][j] && !cal[i][j]) {
dfs(i, j);
cnt++;
}
}
}
rep(i,7) cal2[0][i] = cal[h-1][i];
rep(i,7) cal2[1][i] = cal[0][i];
ll cnt2 = 0;
rep(i,2) {
rep(j,7) {
if (!used2[i][j] && !cal2[i][j]) {
dfs2(i, j);
cnt2++;
}
}
}
ll cnt3 = 0;
if (!cal2[0][0]) cnt3++;
REP(i,1,7) if (cal2[0][i-1] && !cal2[0][i]) cnt3++;
if (!cal2[1][0]) cnt3++;
REP(i,1,7) if (cal2[1][i-1] && !cal2[1][i]) cnt3++;
cnt2 = cnt3 - cnt2;
ll ans = (n / h) * cnt - (n / h - 1) * cnt2
cout << ans << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:93:5: error: expected ',' or ';' before 'cout'
93 | cout << ans << endl;
| ^~~~
|
s737895777 | p03753 | C++ | int main(void){
llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
queue<llint> que;
vector<llint> nuru;
set<llint> siro;
scanf("%lld %lld %lld",&N,&M,&q);
for(i=0;i<q;i++){
scanf("%lld",&a);
nuru.pub(a);
}
sort(nuru.begin(),nuru.end());
if(M%7!=0){ M*=7;ok=1; }
for(i=0;i<M;i++){
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
}
}
ansa=0;
while(siro.size()!=0){
que.push(*siro.begin());
while(!que.empty()){
a=que.front();
que.pop();
if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
if(a+7<M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
siro.erase(a);
}
ansa++;
}
for(i=0;i<M;i++){
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
}
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
}
}
ansb=0;
while(siro.size()!=0){
que.push(*siro.begin());
while(!que.empty()){
a=que.front();
que.pop();
if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
if(a+7<2*M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
siro.erase(a);
}
ansb++;
}
ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
printf("%lld\n",ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:2:9: error: 'llint' was not declared in this scope; did you mean 'int'?
2 | llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
| ^~~~~
| int
a.cc:3:9: error: 'queue' was not declared in this scope
3 | queue<llint> que;
| ^~~~~
a.cc:3:22: error: 'que' was not declared in this scope
3 | queue<llint> que;
| ^~~
a.cc:4:9: error: 'vector' was not declared in this scope
4 | vector<llint> nuru;
| ^~~~~~
a.cc:4:23: error: 'nuru' was not declared in this scope
4 | vector<llint> nuru;
| ^~~~
a.cc:5:9: error: 'set' was not declared in this scope
5 | set<llint> siro;
| ^~~
a.cc:5:20: error: 'siro' was not declared in this scope
5 | set<llint> siro;
| ^~~~
a.cc:6:33: error: 'N' was not declared in this scope
6 | scanf("%lld %lld %lld",&N,&M,&q);
| ^
a.cc:6:36: error: 'M' was not declared in this scope
6 | scanf("%lld %lld %lld",&N,&M,&q);
| ^
a.cc:6:39: error: 'q' was not declared in this scope
6 | scanf("%lld %lld %lld",&N,&M,&q);
| ^
a.cc:6:9: error: 'scanf' was not declared in this scope
6 | scanf("%lld %lld %lld",&N,&M,&q);
| ^~~~~
a.cc:7:13: error: 'i' was not declared in this scope
7 | for(i=0;i<q;i++){
| ^
a.cc:8:31: error: 'a' was not declared in this scope
8 | scanf("%lld",&a);
| ^
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(nuru.begin(),nuru.end());
| ^~~~
| short
a.cc:12:26: error: 'ok' was not declared in this scope
12 | if(M%7!=0){ M*=7;ok=1; }
| ^~
a.cc:13:13: error: 'i' was not declared in this scope
13 | for(i=0;i<M;i++){
| ^
a.cc:14:21: error: 'j' was not declared in this scope
14 | for(j=0;j<1+ok*6;j++){
| ^
a.cc:14:29: error: 'ok' was not declared in this scope
14 | for(j=0;j<1+ok*6;j++){
| ^~
a.cc:15:29: error: 'binary_search' was not declared in this scope
15 | if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
| ^~~~~~~~~~~~~
a.cc:18:9: error: 'ansa' was not declared in this scope
18 | ansa=0;
| ^~~~
a.cc:22:25: error: 'a' was not declared in this scope
22 | a=que.front();
| ^
a.cc:33:13: error: 'i' was not declared in this scope
33 | for(i=0;i<M;i++){
| ^
a.cc:34:21: error: 'j' was not declared in this scope
34 | for(j=0;j<1+ok*6;j++){
| ^
a.cc:34:29: error: 'ok' was not declared in this scope
34 | for(j=0;j<1+ok*6;j++){
| ^~
a.cc:35:29: error: 'binary_search' was not declared in this scope
35 | if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
| ^~~~~~~~~~~~~
a.cc:37:21: error: 'j' was not declared in this scope
37 | for(j=0;j<1+ok*6;j++){
| ^
a.cc:37:29: error: 'ok' was not declared in this scope
37 | for(j=0;j<1+ok*6;j++){
| ^~
a.cc:38:29: error: 'binary_search' was not declared in this scope
38 | if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
| ^~~~~~~~~~~~~
a.cc:41:9: error: 'ansb' was not declared in this scope
41 | ansb=0;
| ^~~~
a.cc:45:25: error: 'a' was not declared in this scope
45 | a=que.front();
| ^
a.cc:55:9: error: 'ans' was not declared in this scope
55 | ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
| ^~~
a.cc:56:9: error: 'printf' was not declared in this scope
56 | printf("%lld\n",ans);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void){
|
s519630210 | p03753 | C++ | #include<map>
#include<string>
#include<iostream>
#include<set>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
//#define scanf scanf_s
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pub push_back
using namespace std;
typedef long long int llint;
const llint one = 1;
const llint big = (one<<30);
const llint mod=1000000007;
int main(void){
llint N,M,q,i,j,a,ansa,ansb,ok=0,ans;
queue<llint> que;
vector<llint> nuru;
set<llint> siro;
scanf("%lld %lld %lld",&N,&M,&q);
for(i=0;i<q;i++){
scanf("%lld",&a);
nuru.pub(a);
}
sort(nuru.begin(),nuru.end());
if(M%7!=0){ M*=7;ok=1; }
for(i=0;i<M;i++){
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M); }
}
}
ansa=0;
while(siro.size()!=0){
que.push(*siro.begin());
while(!que.empty()){
a=que.front();
que.pop();
if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
if(a+7<M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
siro.erase(a);
}
ansa++;
}
for(i=0;i<M;i++){
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7); }
}
for(j=0;j<1+ok*6;j++){
if(!binary_search(nuru.begin(),nuru.end(),i)){ siro.insert(i+j*M/7+M); }
}
}
ansb=0;
while(siro.size()!=0){
que.push(*siro.begin());
while(!que.empty()){
a=que.front();
que.pop();
if(a-7>=0&&siro.find(a-7)!=siro.end()){ que.push(a-7); }
if(a+7<2*M&&siro.find(a+7)!=siro.end()){ que.push(a+7); }
if(a%7!=0&&siro.find(a-1)!=siro.end()){ que.push(a-1); }
if(a%7!=6&&siro.find(a+1)!=siro.end()){ que.push(a+1); }
siro.erase(a);
}
ansb++;
}
ans=(ansb-ansa)*N*7/M+(2*ansa-ansb);
printf("%lld\n",ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:9: error: 'queue' was not declared in this scope
25 | queue<llint> que;
| ^~~~~
a.cc:10:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
9 | #include<functional>
+++ |+#include <queue>
10 | //#define scanf scanf_s
a.cc:25:20: error: expected primary-expression before '>' token
25 | queue<llint> que;
| ^
a.cc:25:22: error: 'que' was not declared in this scope
25 | queue<llint> que;
| ^~~
|
s545259810 | p03753 | C++ | #include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long n;int m,q,a[1<<17];
bool f[7][1<<17];
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
void bfs(int x,int y,long _n)
{
queue<pair<int,int> >P;
f[x][y]=true;
P.push(make_pair(x,y));
while(!P.empty())
{
pair<int,int>p=P.front();P.pop();
for(int r=0;r<4;r++)
{
int tx=p.first+dx[r],ty=p.second+dy[r];
if(tx<0||ty<0||tx>=7||ty>=_n||f[tx][ty])continue;
f[tx][ty]=true;
P.push(make_pair(tx,ty));
}
}
}
main()
{
cin>>n>>m>>q;
for(int i=0;i<q;i++)
{
cin>>a[i];
}
if(n<=100000)
{
for(int i=0;i<7;i++)
{
for(int j=0;j<n;j++)
{
int b=(j*7+i)%m;
if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
}
}
long ans=0;
for(int i=0;i<7;i++)
{
for(int j=0;j<n;j++)
{
if(!f[i][j])
{
ans++;
bfs(i,j,n);
}
}
}
cout<<ans<<endl;
}
else if(m%7==0)
{
for(int i=0;i<7;i++)
{
for(int j=0;j<m/7*2;j++)
{
int b=(j*7+i)%m;
if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
}
}
long count1=0;
for(int i=0;i<7;i++)
{
for(int j=0;j<m/7*2;j++)
{
if(!f[i][j])
{
count1++;
bfs(i,j,m/7*2);
}
}
}
for(int i=0;i<7;i++)
{
for(int j=0;j<m/7*3;j++)
{
f[i][j]=false;
int b=(j*7+i)%m;
if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
}
}
long count2=0;
for(int i=0;i<7;i++)
{
for(int j=0;j<m/7*3;j++)
{
if(!f[i][j])
{
count2++;
bfs(i,j,m/7*3);
}
}
}
long kousa=count2-count1;
long syokou=count1-kousa*2;
cout<<syokou+kousa*(n/(m/7))<<endl;
}
else
{
for(int i=0;i<7;i++)
{
for(int j=0;j<m;j++)
{
int b=(j*7+i)%m;
if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
}
}
long count1=0;
for(int i=0;i<7;i++)
{
for(int j=0;j<m;j++)
{
if(!f[i][j])
{
count1++;
bfs(i,j,m);
}
}
}
for(int i=0;i<7;i++)
{
for(int j=0;j<2*m;j++)
{
f[i][j]=false;
int b=(j*7+i)%m;
if(upper_bound(a,a+q,b)!=lower_bound(a,a+q,b))f[i][j]=true;
}
}
long count2=0;
for(int i=0;i<7;i++)
{
for(int j=0;j<2*m;j++)
{
if(!f[i][j])
{
count2++;
bfs(i,j,2*m);
}
}
}
long kousa=(count2-count1)/7;s
long syokou=count1-kousa*7;
cout<<syokou+kousa*n<<endl;
}
} | a.cc:25:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
25 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:146:46: error: 's' was not declared in this scope
146 | long kousa=(count2-count1)/7;s
| ^
a.cc:148:23: error: 'syokou' was not declared in this scope
148 | cout<<syokou+kousa*n<<endl;
| ^~~~~~
|
s320044136 | p03754 | C++ | #include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
struct edge{ int to, cost; };
signed main(){
int n; cin >> n;
vector<vector<int>> G(n);
for(int i = 0; i < n-1; i++){
int a, b; cin >> a >> b;
a--, b--;
G[a].push_back(b);
G[b].push_back(a);
}
vector<double> dp(n, 0);
auto dfs = [&](auto&& dfs, int u, int par)->void{
int child = (par == -1 ? G[u].size() : G[u].size()-1);
for(int v : G[u]){
if(v == par) continue;
dfs(dfs, v, u);
dp[u] += (dp[v] + 1) / child;
}
};
dfs(dfs, 0, -1);
cout << dp << endl;
vector<double> ans(n);
auto dfs2 = [&](auto&& dfs2, int u, int par, double d_par)->void{
int child = G[u].size();
if(par == -1){
ans[u] = dp[u];
}else{
ans[u] = (dp[u] * (child-1) + d_par) / child;
}
for(int v : G[u]){
if(v == par) continue;
d_par = (ans[u] * G[u].size() - (dp[v]+1)) / max(1LL, child-1) + 1;
dfs2(dfs2, v, u, d_par);
}
};
dfs2(dfs2, 0, -1, 0);
for(int i = 0; i < n; i++){
printf("%.9f\n", ans[i]);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:30:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<double>')
30 | cout << dp << endl;
| ~~~~ ^~ ~~
| | |
| | std::vector<double>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<double>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<double>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<double>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<double>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<double>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<double>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<double>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<double>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<double>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<double>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<double>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<double>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<double>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<double>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<double>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<double>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<double>' to 'std::nullptr_t'
306 | |
s882117243 | p03754 | C++ | 3.666666666666667
2.250000000000000
3.666666666666667
2.833333333333333
2.555555555555555
2.666666666666667
4.333333333333333
2.666666666666667
5.333333333333333
2.500000000000000
2.500000000000000
5.000000000000000
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 3.666666666666667
| ^~~~~~~~~~~~~~~~~
|
s229106066 | p03754 | C++ | #include <bits/stdc++.h>
using namespace std;
vector <int> g[150100];
map <pair <int, int> , double> mp;
double dfs(int v, int p = -1, double t = 1)
{
if(mp[make_pair(v, p)] != 0)
return mp[make_pair(v, p)] * t;
double ans = 0;
int k = g[v].size();
if(p != -1)
k--;
for(int i = 0; i < g[v].size(); ++i)
{
if(g[v][i] != p)
ans += dfs(g[v][i], v, 1.0 / k) + 1.0 / k;
}
mp[make_pair(v, p)] = ans;
return ans * t;
}
int main()
{
int n, i, x, y;
scanf("%d", &n)
for(i = 1; i < n; ++i)
{
scanf("%d %d", &x, &y);
g[x].push_back(y);
g[y].push_back(x);
}
for(i = 1; i <= n; ++i)
cout << fixed << setprecision(12) << dfs(i) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:20: error: expected ';' before 'for'
25 | scanf("%d", &n)
| ^
| ;
26 |
27 | for(i = 1; i < n; ++i)
| ~~~
a.cc:27:26: error: expected ';' before ')' token
27 | for(i = 1; i < n; ++i)
| ^
| ;
|
s984567658 | p03754 | C++ | #include <bits/stdc++.h>
using namespace std;
vector <int> g[150100];
map <pair <int, int> , double> mp;
double dfs(int v, int p = -1, double t = 1)
{
if(mp[make_pair(v, p)] != 0)
return mp[make_pair(v, p)] * t;
double ans = 0;
int k = g[v].size();
if(p != -1)
k--;
for(int i = 0; i < g[v].size(); ++i)
{
if(g[v][i] != p)
ans += dfs(g[v][i], v, 1.0 / k) + 1.0 / k;
}
mp[make_pair(v, p)] = ans;
return ans * t;
}
int main()
{
int n, i, x, y;
scanf("%d", &n)
for(i = 1; i < n; ++i)
{
scanf("%d %d", &x, &y);
g[x].push_back(y);
g[y].push_back(x);
}
for(i = 1; i <= n; ++i)
cout << fixed << setprecision(12) << dfs(i) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:20: error: expected ';' before 'for'
25 | scanf("%d", &n)
| ^
| ;
26 |
27 | for(i = 1; i < n; ++i)
| ~~~
a.cc:27:26: error: expected ';' before ')' token
27 | for(i = 1; i < n; ++i)
| ^
| ;
|
s774751039 | p03754 | C++ | 12
1 2
2 3
2 4
4 5
5 6
5 7
6 8
8 9
2 10
10 11
11 12 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 12
| ^~
|
s203104780 | p03754 | C++ | d | a.cc:1:1: error: 'd' does not name a type
1 | d
| ^
|
s313953012 | p03754 | C++ |
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
auto& in = std::cin;
auto& out = std::cout;
int32_t N;
constexpr int32_t MAX_N = 150000;//頂点数
std::unordered_map<int32_t, double> graph[MAX_N];//木
double get(int32_t v) {
int32_t count = 0;
double sum = 0;
for (auto& c : graph[v]) {
++count;
sum += get(c.first, v) + 1;
}
if (count == 0) {
return 0;
}
return sum / count;
}
double get(int32_t v, int32_t p) {
auto& memo = graph[v][p];
if (memo >= 0) {
return memo;
}
int32_t count = 0;
double sum = 0;
for (auto& c : graph[v]) {
if (c.first != p) {
++count;
sum += get(c.first, v)+1;
}
}
if (count == 0) {
return memo = 0;
}
return memo = sum / count;
}
void input_tree()
{
in >> N;
for (int32_t i = 0; i < N - 1; ++i)
{
int a, b;
in >> a >> b; --a; --b;
graph[a][b] = -1;
graph[b][a] = -1;
}
}
int main()
{
using std::endl;
in.sync_with_stdio(false);
out.sync_with_stdio(false);
out << std::fixed << std::setprecision(9);
input_tree();
for (int32_t i = 0; i < N; ++i)
{
out << get(i) << endl;
}
return 0;
}
#endif
#if 0
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
auto& in = std::cin;
auto& out = std::cout;
int32_t N;
std::string S[10000];
std::string T;
int main()
{
using std::endl;
in.sync_with_stdio(false);
out.sync_with_stdio(false);
in >> N;
for (int32_t i = 0; i < N; ++i)
{
in >> S[i];
}
in >> T;
return 0;
}
#endif
| a.cc: In function 'double get(int32_t)':
a.cc:35:27: error: too many arguments to function 'double get(int32_t)'
35 | sum += get(c.first, v) + 1;
| ~~~^~~~~~~~~~~~
a.cc:30:8: note: declared here
30 | double get(int32_t v) {
| ^~~
|
s310379316 | p03757 | C++ | #include<unordered_set>
#include<unordered_map>
using namespace std;
int n;
int q;
struct query{
int ty;
int v;
int d;
int x;
query(int ty_,int v_,int d_,int x_=0){
ty = ty_;
v = v_;
d = d_;
x = x_;
}
};
#define MAX 500002
vector<int> v[MAX];
long long int cost[MAX];
vector<query> Q;
bool ex[MAX];
vector<pair<int, long long int> > ev[MAX];
long long int ans[MAX];
struct ASK{
int id;
int d;
ASK(int id_, int d_){
id = id_;
d = d_;
}
};
vector<ASK> ask[MAX];
int dep[MAX];
struct BIT{
vector<long long int> bit;
void resize(int N){
bit.assign(N, 0);
}
void add(int i, long long int j){
i++;
while (i < bit.size()){
bit[i] += j;
i += i&-i;
}
}
long long int sum(int i){
long long int r = 0;
i++;
while (i){
r += bit[i];
i -= i&-i;
}
return r;
}
};
BIT B;
long long int flag[MAX];
inline void dfs(int b,long long int cur_add=0){
if (ex[b] == false)return;
cur_add += flag[dep[b]];
for (int i = 0; i < ev[b].size(); i++){
cur_add += ev[b][i].second;
flag[dep[b] + ev[b][i].first + 1] -= ev[b][i].second;
}
cost[b] += cur_add;
for (int i = 0; i < v[b].size(); i++){
dfs(v[b][i],cur_add);
}
for (int i = 0; i < ev[b].size(); i++){
cur_add -= ev[b][i].second;
flag[dep[b] + ev[b][i].first + 1] += ev[b][i].second;
}
ev[b].clear();
}
long long int sum[MAX];
int us[MAX];
int u_s;
int mx_dep;
int child[MAX];
int star[MAX];
int en[MAX];
int ord;
inline void adding_all(int b){
if (us[dep[b]] != u_s){
us[dep[b]] = u_s;
sum[dep[b]] = 0;
}
sum[dep[b]] += cost[b];
for (int i = 0; i < v[b].size(); i++){
adding_all(v[b][i]);
}
mx_dep = max(mx_dep, dep[b]);
}
inline void dfs3(int b, bool del=false){
if (ex[b] == false)return;
u_s++;
mx_dep = 0;
if (v[b].size() == 0){
for (int i = 0; i < ask[b].size(); i++){
ans[ask[b][i].id] += cost[b];
}
return;
}
int mx = -1;
int node = 0;
for (int i = 0; i < v[b].size(); i++){
if (mx < child[v[b][i]]){
mx = child[v[b][i]];
node = v[b][i];
}
}
for (int i = 0; i < v[b].size(); i++){
if (v[b][i] != node){
dfs3(v[b][i]);
}
}
dfs3(node, true);
for (int i = 0; i < v[b].size(); i++){
if (v[b][i] != node){
adding_all(v[b][i]);
}
}
mx_dep = max(mx_dep, dep[b]);
for (int i = dep[b]+1; i <= mx_dep; i++){
sum[i] += sum[i - 1];
}
for (int i = 0; i < ask[b].size(); i++){
int go = dep[b] + ask[b][i].d;
go = min(go, mx_dep);
ans[ask[b][i].id] = sum[go];
}
}
void init(){
dfs(0);
dfs3(0);
}
inline void dfs2(int b,int d=0){
star[b] = ord;
ord++;
dep[b] = d;
for (int i = 0; i < v[b].size(); i++){
int go = v[b][i];
dfs2(go,d+1);
child[b] += child[go];
}
en[b] = ord;
child[b]++;
}
int main(){
cin >> n >> q;
B.resize(2*MAX);
for (int i = 0; i < n; i++){
ex[i] = true;
int p, a;
scanf("%d%d", &p, &a);
if (p >= 0){
v[p].push_back(i);
}
cost[i] = a;
}
int cur=n;
for (int i = 0; i < q; i++){
int ty;
scanf("%d", &ty);
if (ty == 1){
int vv, d,xx;
scanf("%d%d%d", &vv, &d,&xx);
Q.push_back(query(ty, vv, d,xx));
continue;
}
if (ty == 2){
int vv,dd;
scanf("%d%d", &vv,&dd);
Q.push_back(query(ty, vv,dd));
continue;
}
if (ty == 3){
int pr, ar;
scanf("%d%d", &pr, &ar);
Q.push_back(query(3, cur,ar));
v[pr].push_back(cur);
cur++;
}
}
dfs2(0);
int SQ = 220;
/*for (int i = 0; i < q; i+=SQ){
int rig = min(q, i + SQ);
for (int j = 0; j < rig; j++){
if (Q[j].ty == 1){
ev[Q[j].v].push_back(make_pair(Q[j].d, Q[j].x));
continue;
}
if (Q[j].ty == 2){
ask[Q[j].v].push_back(ASK(j,Q[j].d));
continue;
}
ex[Q[j].v] = true;
cost[Q[j].v] = Q[j].d;
}
init();
for (int j = 0; j < rig; j++){
if (Q[j].ty == 1){
for (int jj = j + 1; jj < rig; jj++){
if (Q[jj].ty == 3){
if (dep[Q[jj].v]-dep[Q[j].v]<=Q[j].d&&star[Q[j].v] <= star[Q[jj].v] && en[Q[jj].v] <= en[Q[j].v]){
cost[Q[jj].v] -= Q[j].x;
}
}
}
continue;
}
if (Q[j].ty == 2){
for (int jj = j + 1; jj < rig; jj++){
if (Q[jj].ty == 1){
int v1 = Q[j].v; //
int v2 = Q[jj].v;
if (star[v1] <= star[v2] && en[v2] <= en[v1]){
}
if (star[v2] <= star[v1] && en[v1] <= en[v2]){
}
}
if (Q[jj].ty == 3){
if (dep[Q[jj].v] - dep[Q[j].v] <= Q[j].d&&star[Q[j].v] <= star[Q[jj].v] && en[Q[jj].v] <= en[Q[j].v]){
ans[j] -= cost[Q[jj].v];
}
continue;
}
}
}
}
}*/
return 0;
} | a.cc:23:1: error: 'vector' does not name a type
23 | vector<int> v[MAX];
| ^~~~~~
a.cc:27:1: error: 'vector' does not name a type
27 | vector<query> Q;
| ^~~~~~
a.cc:31:1: error: 'vector' does not name a type
31 | vector<pair<int, long long int> > ev[MAX];
| ^~~~~~
a.cc:44:1: error: 'vector' does not name a type
44 | vector<ASK> ask[MAX];
| ^~~~~~
a.cc:49:9: error: 'vector' does not name a type
49 | vector<long long int> bit;
| ^~~~~~
a.cc: In member function 'void BIT::resize(int)':
a.cc:51:17: error: 'bit' was not declared in this scope
51 | bit.assign(N, 0);
| ^~~
a.cc: In member function 'void BIT::add(int, long long int)':
a.cc:55:28: error: 'bit' was not declared in this scope
55 | while (i < bit.size()){
| ^~~
a.cc: In member function 'long long int BIT::sum(int)':
a.cc:64:30: error: 'bit' was not declared in this scope
64 | r += bit[i];
| ^~~
a.cc: In function 'void dfs(int, long long int)':
a.cc:78:29: error: 'ev' was not declared in this scope; did you mean 'ex'?
78 | for (int i = 0; i < ev[b].size(); i++){
| ^~
| ex
a.cc:83:29: error: 'v' was not declared in this scope
83 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc:86:29: error: 'ev' was not declared in this scope; did you mean 'ex'?
86 | for (int i = 0; i < ev[b].size(); i++){
| ^~
| ex
a.cc:90:9: error: 'ev' was not declared in this scope; did you mean 'ex'?
90 | ev[b].clear();
| ^~
| ex
a.cc: In function 'void adding_all(int)':
a.cc:109:29: error: 'v' was not declared in this scope
109 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc: In function 'void dfs3(int, bool)':
a.cc:119:13: error: 'v' was not declared in this scope
119 | if (v[b].size() == 0){
| ^
a.cc:120:37: error: 'ask' was not declared in this scope
120 | for (int i = 0; i < ask[b].size(); i++){
| ^~~
a.cc:127:29: error: 'v' was not declared in this scope
127 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc:133:29: error: 'v' was not declared in this scope
133 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc:139:29: error: 'v' was not declared in this scope
139 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc:148:29: error: 'ask' was not declared in this scope
148 | for (int i = 0; i < ask[b].size(); i++){
| ^~~
a.cc: In function 'void dfs2(int, int)':
a.cc:164:29: error: 'v' was not declared in this scope
164 | for (int i = 0; i < v[b].size(); i++){
| ^
a.cc: In function 'int main()':
a.cc:175:9: error: 'cin' was not declared in this scope
175 | cin >> n >> q;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<unordered_map>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:180:17: error: 'scanf' was not declared in this scope
180 | scanf("%d%d", &p, &a);
| ^~~~~
a.cc:182:25: error: 'v' was not declared in this scope
182 | v[p].push_back(i);
| ^
a.cc:189:17: error: 'scanf' was not declared in this scope
189 | scanf("%d", &ty);
| ^~~~~
a.cc:193:25: error: 'Q' was not declared in this scope
193 | Q.push_back(query(ty, vv, d,xx));
| ^
a.cc:199:25: error: 'Q' was not declared in this scope
199 | Q.push_back(query(ty, vv,dd));
| ^
a.cc:205:25: error: 'Q' was not declared in this scope
205 | Q.push_back(query(3, cur,ar));
| ^
a.cc:206:25: error: 'v' was not declared in this scope
206 | v[pr].push_back(cur);
| ^
|
s598613582 | p03758 | C++ | #include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
#define MOD 1000000007
ll d[210][210];
int main(){
ll n;
cin>>n;
clr(d,-1);
rep(i,0,40){
string s;
rep(j,0,200){
s += "0";
}
rep(j,i*5,i*5+5){
s[j] = 'a';
}
cout << "?" << " " << s << endl;
ll ans1;
cin>>ans1;
if(ans1==0){
rep(j,i*5,i*5+5){
rep(k,i*5+1,i*5+5){
d[j][k] = 0;
}
}
}
}
rep(i,0,n){
rep(j,i+1,n){
if(d[i][j]!=-1)continue;
string s1;
rep(l,0,n){
if(l==i||l==j)s1+="1";
else s1+="0";
}
cout << "?" << " " << s1 << endl;
ll ans1;
cin>>ans1;
if(ans1==1){
d[i][j] = 1;
}
else{
d[i][j] = 0;
}
}
}
}
cout << "! ";
vector<pair<ll,ll> > v;
rep(i,0,200){
rep(j,i+1,200){
if(d[i][j] == 1){
v.pb(mp(i,j));
}
}
}
rep(i,0,v.sz){
cout << "(" << v[i].fi << "," << v[i].se << ")";
if(i!=v.sz-1)cout << " ";
}
cout << endl;
return 0;
} | a.cc:84:9: error: 'cout' does not name a type
84 | cout << "! ";
| ^~~~
a.cc:31:20: error: expected unqualified-id before 'for'
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^~~
a.cc:86:9: note: in expansion of macro 'rep'
86 | rep(i,0,200){
| ^~~
a.cc:86:13: error: 'i' does not name a type; did you mean 'fi'?
86 | rep(i,0,200){
| ^
a.cc:31:33: note: in definition of macro 'rep'
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^
a.cc:31:39: error: expected unqualified-id before '++' token
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^~
a.cc:86:9: note: in expansion of macro 'rep'
86 | rep(i,0,200){
| ^~~
a.cc:31:20: error: expected unqualified-id before 'for'
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^~~
a.cc:93:9: note: in expansion of macro 'rep'
93 | rep(i,0,v.sz){
| ^~~
a.cc:93:13: error: 'i' does not name a type; did you mean 'fi'?
93 | rep(i,0,v.sz){
| ^
a.cc:31:33: note: in definition of macro 'rep'
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^
a.cc:31:39: error: expected unqualified-id before '++' token
31 | #define rep(i,a,b) for(ll i=(a);i<(b);++i)
| ^~
a.cc:93:9: note: in expansion of macro 'rep'
93 | rep(i,0,v.sz){
| ^~~
a.cc:97:9: error: 'cout' does not name a type
97 | cout << endl;
| ^~~~
a.cc:98:9: error: expected unqualified-id before 'return'
98 | return 0;
| ^~~~~~
a.cc:99:1: error: expected declaration before '}' token
99 | }
| ^
|
s226209241 | p03758 | Java | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.SplittableRandom;
public class Main {
static final int BUCKET = 10;
static final boolean LOCAL = false
static final boolean DEBUG = LOCAL && true;
static Scanner sc = new Scanner(System.in);
static PrintWriter writer = new PrintWriter(System.out);
static int N;
static char[] query;
static int[][] graph;
static UnionFind uf;
static int edges;
static int qc;
static long seed;
public static void main(String[] args) {
if (args.length >= 1) {
seed = Long.parseLong(args[0]);
}
N = sc.nextInt();
if (LOCAL) generate();
query = new char[N];
Arrays.fill(query, '0');
graph = new int[N][N];
uf = new UnionFind(N);
boolean[] used = new boolean[N];
for (int i = 0; i < N; i++) {
int candI = -1;
int minCount = 1 << 30;
for (int j = 0; j < N; j++) {
if (used[j]) continue;
int count = 0;
for (int k = 0; k < N; k++) {
if (graph[j][k] == 0)++count;
}
if (count < minCount) {
candI = j;
minCount = count;
}
}
used[candI] = true;
solve(candI);
}
if (LOCAL) {
System.out.println("validate:" + validate());
System.out.println("query count:" + qc);
} else {
writer.print("!");
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (graph[i][j] == 1) writer.print(" (" + i + "," + j + ")");
}
}
writer.println();
writer.flush();
}
}
static void solve(int axis) {
ArrayList<Integer> pos = new ArrayList<>();
for (int i = 0; i < N; i++) {
if (uf.find(axis, i) || graph[axis][i] != 0) continue;
pos.add(i);
if (pos.size() == BUCKET) {
solveOne(axis, pos);
pos.clear();
}
}
if (!pos.isEmpty()) {
solveOne(axis, pos);
}
}
static void solveOne(int axis, ArrayList<Integer> pos) {
if (edges == N - 1) return;
pos.add(axis);
int v = query(pos);
if (v == 0) {
nonEdge(pos);
pos.remove(pos.size() - 1);
return;
}
pos.remove(pos.size() - 1);
boolean general = v >= 4;
if (!general) {
int nv = query(pos);
if (nv == v) {
for (int p : pos) {
graph[axis][p] = graph[p][axis] = -1;
}
return;
} else if (nv > 0) {
general = true;
} else {
nonEdge(pos);
}
}
if (general) {
ArrayList<Integer> sub = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
sub.add(pos.get(i));
}
solveSub(axis, sub);
sub.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
sub.add(pos.get(i));
}
solveSub(axis, sub);
} else {
solveEasy(axis, pos, v);
}
}
static void solveEasy(int axis, ArrayList<Integer> pos, int expect) {
if (edges == N - 1) return;
if (expect == 0) {
pos.add(axis);
nonEdge(pos);
return;
} else if (expect == pos.size()) {
for (int p : pos) {
addEdge(axis, p);
}
return;
}
ArrayList<Integer> subPos = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
subPos.add(pos.get(i));
}
subPos.add(axis);
int sv1 = query(subPos);
subPos.remove(subPos.size() - 1);
solveEasy(axis, subPos, sv1);
ArrayList<Integer> subPos2 = new ArrayList<>();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos2.add(pos.get(i));
}
subPos2.add(axis);
solveEasy(axis, subPos2, expect - sv1);
return;
}
static int solveSub(int axis, ArrayList<Integer> pos) {
if (edges == N - 1) return 0;
pos.add(axis);
int v = query(pos);
if (v == 0) {
nonEdge(pos);
pos.remove(pos.size() - 1);
return v;
}
pos.remove(pos.size() - 1);
if (pos.size() == 1 && v == 1) {
addEdge(axis, pos.get(0));
}
if (pos.size() == 1) return v;
ArrayList<Integer> subPos = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
subPos.add(pos.get(i));
}
int sv1 = solveSub(axis, subPos);
if (v < 4 && sv1 == v) {
for (int i = pos.size() / 2; i < pos.size(); i++) {
for (int j = 0; j < i; j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
return v;
}
subPos.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos.add(pos.get(i));
}
int sv2 = solveSub(axis, subPos);
if (pos.size() == 2 && v == 1 && sv1 == 0 && sv2 == 0 && graph[pos.get(0)][pos.get(1)] == 0) {
addEdge(pos.get(0), pos.get(1));
return v;
}
if (v < 4 && sv2 == v) {
for (int i = 0; i < pos.size() / 2; i++) {
for (int j = i + 1; j < pos.size(); j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
}
// if (v < 4 && v - sv1 - sv2 > 0) {
// ArrayList<Integer> left = new ArrayList<>();
// for (int i = 0; i < pos.size() / 2; i++) {
// left.add(pos.get(i));
// }
// solveGroup(left, subPos, v - sv1 - sv2);
// }
return v;
}
static int solveGroup(ArrayList<Integer> left, ArrayList<Integer> right, int expect) {
if (expect > 0) {
for (int i = 0; i < left.size(); i++) {
for (int j = 0; j < right.size(); j++) {
if (graph[left.get(i)][right.get(j)] == 1) --expect;
}
}
}
if (expect == 0) return 0;
if (left.size() == 1 && right.size() == 1) {
left.add(right.get(0));
int v = expect == 1 ? 1 : query(left);
if (v == 1) {
addEdge(left.get(0), right.get(0));
} else {
nonEdge(left);
}
left.remove(1);
return v;
}
if (right.size() == 1) {
return solveGroup(right, left, expect);
}
int v = expect;
if (expect < 0) {
ArrayList<Integer> all = new ArrayList<>(left);
all.addAll(right);
v = query(all);
if (v == 0) {
nonEdge(all);
return v;
}
}
ArrayList<Integer> subRight = new ArrayList<>();
for (int i = 0; i < right.size() / 2; i++) {
subRight.add(right.get(i));
}
int sv1 = solveGroup(left, subRight, -1);
if (v == sv1) {
for (int i = 0; i < left.size(); i++) {
for (int j = right.size() / 2; j < right.size(); j++) {
if (graph[left.get(i)][right.get(j)] == 1) {
System.err.println(left + " " + right);
System.err.println("erased:" + left.get(i) + " " + right.get(j));
}
graph[left.get(i)][right.get(j)] = graph[right.get(j)][left.get(i)] = -1;
}
}
nonEdge(left);
return v;
}
subRight.clear();
for (int i = right.size() / 2; i < right.size(); i++) {
subRight.add(right.get(i));
}
solveGroup(left, subRight, expect - sv1);
return v;
}
static void nonEdge(ArrayList<Integer> pos) {
for (int i = 0; i < pos.size(); i++) {
for (int j = i + 1; j < pos.size(); j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
}
static void addEdge(int a, int b) {
if (graph[a][b] == 1) return;
graph[a][b] = graph[b][a] = 1;
uf.union(a, b);
++edges;
}
static int query(ArrayList<Integer> pos) {
++qc;
int ret;
for (int p : pos) {
query[p] = '1';
}
if (LOCAL) {
ret = processQuery();
} else {
writer.write("? " + String.valueOf(query) + "\n");
writer.flush();
ret = sc.nextInt();
}
for (int p : pos) {
query[p] = '0';
}
return ret;
}
static class UnionFind {
int[] set;
UnionFind(int n) {
set = new int[n];
Arrays.fill(set, -1);
}
void union(int a, int b) {
int rtA = root(a);
int rtb = root(b);
if (rtA == rtb) {
return;
}
set[rtA] += set[rtb];
set[rtb] = rtA;
}
boolean find(int a, int b) {
return root(a) == root(b);
}
int root(int a) {
if (set[a] < 0) {
return a;
} else {
set[a] = root(set[a]);
return set[a];
}
}
int size(int a) {
return -set[root(a)];
}
}
static boolean[][] ans;
static void generate() {
ans = new boolean[N][N];
SplittableRandom rnd = new SplittableRandom(seed);
UnionFind uf = new UnionFind(N);
int count = 0;
while (true) {
int a = rnd.nextInt(N);
int b = rnd.nextInt(N);
if (uf.find(a, b)) continue;
ans[a][b] = ans[b][a] = true;
uf.union(a, b);
++count;
if (count == N - 1) break;
}
}
static int processQuery() {
boolean[] visited = new boolean[N];
int ret = 0;
for (int i = 0; i < N; i++) {
if (query[i] == '0' || visited[i]) continue;
int d = diameter(visited, i);
ret += d * d;
}
if (DEBUG) {
System.err.println("? " + String.valueOf(query) + " " + ret);
}
return ret;
}
static int diameter(boolean[] visited, int pos) {
ArrayList<Integer> list = new ArrayList<>();
list.add(pos);
for (int i = 0; i < list.size(); i++) {
int cur = list.get(i);
OUT:
for (int j = 0; j < N; j++) {
if (query[j] == '0' || !ans[cur][j]) continue;
for (int k = 0; k < i; k++) {
if (list.get(k) == j) continue OUT;
}
list.add(j);
}
}
int farest = list.get(list.size() - 1);
list.clear();
list.add(farest);
visited[farest] = true;
for (int d = 0; ; d++) {
ArrayList<Integer> next = new ArrayList<>();
for (int cur : list) {
for (int i = 0; i < N; i++) {
if (query[i] == '0' || !ans[cur][i] || visited[i]) continue;
next.add(i);
visited[i] = true;
}
}
if (next.isEmpty()) return d;
list = next;
}
}
static boolean validate() {
if (DEBUG) {
System.err.println("expect");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(ans[i][j] ? "1" : "0");
}
System.err.println();
}
System.err.println("actual");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(graph[i][j] == 1 ? "1" : "0");
}
System.err.println();
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if ((graph[i][j] == 1) != ans[i][j]) return false;
}
}
return true;
}
}
| Main.java:9: error: ';' expected
static final boolean LOCAL = false
^
1 error
|
s832073082 | p03758 | Java | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.SplittableRandom;
public class Main {
static final int BUCKET = 12;
static final boolean LOCAL = false
static final boolean DEBUG = LOCAL && true;
static Scanner sc = new Scanner(System.in);
static PrintWriter writer = new PrintWriter(System.out);
static int N;
static char[] query;
static int[][] graph;
static UnionFind uf;
static int edges;
static int qc;
static long seed;
public static void main(String[] args) {
if (args.length >= 1) {
seed = Long.parseLong(args[0]);
}
N = sc.nextInt();
if (LOCAL) generate();
query = new char[N];
Arrays.fill(query, '0');
graph = new int[N][N];
uf = new UnionFind(N);
boolean[] used = new boolean[N];
for (int i = 0; i < N; i++) {
int candI = -1;
int minCount = 1 << 30;
for (int j = 0; j < N; j++) {
if (used[j]) continue;
int count = 0;
for (int k = 0; k < N; k++) {
if (graph[j][k] == 0)++count;
}
if (count < minCount) {
candI = j;
minCount = count;
}
}
used[candI] = true;
solve(candI);
}
if (LOCAL) {
System.out.println("validate:" + validate());
System.out.println("query count:" + qc);
} else {
writer.print("!");
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (graph[i][j] == 1) writer.print(" (" + i + "," + j + ")");
}
}
writer.println();
writer.flush();
}
}
static void solve(int axis) {
ArrayList<Integer> pos = new ArrayList<>();
for (int i = 0; i < N; i++) {
if (uf.find(axis, i) || graph[axis][i] != 0) continue;
pos.add(i);
if (pos.size() == BUCKET) {
solveOne(axis, pos);
pos.clear();
}
}
if (!pos.isEmpty()) {
solveOne(axis, pos);
}
}
static void solveOne(int axis, ArrayList<Integer> pos) {
if (edges == N - 1) return;
pos.add(axis);
int v = query(pos);
if (v == 0) {
nonEdge(pos);
pos.remove(pos.size() - 1);
return;
}
pos.remove(pos.size() - 1);
boolean general = v >= 4;
if (!general) {
int nv = query(pos);
if (nv == v) {
for (int p : pos) {
graph[axis][p] = graph[p][axis] = -1;
}
return;
} else if (nv > 0) {
general = true;
} else {
nonEdge(pos);
}
}
if (general) {
ArrayList<Integer> sub = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
sub.add(pos.get(i));
}
solveSub(axis, sub);
sub.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
sub.add(pos.get(i));
}
solveSub(axis, sub);
} else {
solveEasy(axis, pos, v);
}
}
static void solveEasy(int axis, ArrayList<Integer> pos, int expect) {
if (edges == N - 1) return;
if (expect == 0) {
pos.add(axis);
nonEdge(pos);
return;
} else if (expect == pos.size()) {
for (int p : pos) {
addEdge(axis, p);
}
return;
}
ArrayList<Integer> subPos = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
subPos.add(pos.get(i));
}
subPos.add(axis);
int sv1 = query(subPos);
subPos.remove(subPos.size() - 1);
solveEasy(axis, subPos, sv1);
ArrayList<Integer> subPos2 = new ArrayList<>();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos2.add(pos.get(i));
}
subPos2.add(axis);
solveEasy(axis, subPos2, expect - sv1);
return;
}
static int solveSub(int axis, ArrayList<Integer> pos) {
if (edges == N - 1) return 0;
pos.add(axis);
int v = query(pos);
if (v == 0) {
nonEdge(pos);
pos.remove(pos.size() - 1);
return v;
}
pos.remove(pos.size() - 1);
if (pos.size() == 1 && v == 1) {
addEdge(axis, pos.get(0));
}
if (pos.size() == 1) return v;
ArrayList<Integer> subPos = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
subPos.add(pos.get(i));
}
int sv1 = solveSub(axis, subPos);
if (v < 4 && sv1 == v) {
for (int i = pos.size() / 2; i < pos.size(); i++) {
for (int j = 0; j < i; j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
return v;
}
subPos.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos.add(pos.get(i));
}
int sv2 = solveSub(axis, subPos);
if (pos.size() == 2 && v == 1 && sv1 == 0 && sv2 == 0 && graph[pos.get(0)][pos.get(1)] == 0) {
addEdge(pos.get(0), pos.get(1));
return v;
}
if (v < 4 && sv2 == v) {
for (int i = 0; i < pos.size() / 2; i++) {
for (int j = i + 1; j < pos.size(); j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
}
// if (v < 4 && v - sv1 - sv2 > 0) {
// ArrayList<Integer> left = new ArrayList<>();
// for (int i = 0; i < pos.size() / 2; i++) {
// left.add(pos.get(i));
// }
// solveGroup(left, subPos, v - sv1 - sv2);
// }
return v;
}
static int solveGroup(ArrayList<Integer> left, ArrayList<Integer> right, int expect) {
if (expect > 0) {
for (int i = 0; i < left.size(); i++) {
for (int j = 0; j < right.size(); j++) {
if (graph[left.get(i)][right.get(j)] == 1) --expect;
}
}
}
if (expect == 0) return 0;
if (left.size() == 1 && right.size() == 1) {
left.add(right.get(0));
int v = expect == 1 ? 1 : query(left);
if (v == 1) {
addEdge(left.get(0), right.get(0));
} else {
nonEdge(left);
}
left.remove(1);
return v;
}
if (right.size() == 1) {
return solveGroup(right, left, expect);
}
int v = expect;
if (expect < 0) {
ArrayList<Integer> all = new ArrayList<>(left);
all.addAll(right);
v = query(all);
if (v == 0) {
nonEdge(all);
return v;
}
}
ArrayList<Integer> subRight = new ArrayList<>();
for (int i = 0; i < right.size() / 2; i++) {
subRight.add(right.get(i));
}
int sv1 = solveGroup(left, subRight, -1);
if (v == sv1) {
for (int i = 0; i < left.size(); i++) {
for (int j = right.size() / 2; j < right.size(); j++) {
if (graph[left.get(i)][right.get(j)] == 1) {
System.err.println(left + " " + right);
System.err.println("erased:" + left.get(i) + " " + right.get(j));
}
graph[left.get(i)][right.get(j)] = graph[right.get(j)][left.get(i)] = -1;
}
}
nonEdge(left);
return v;
}
subRight.clear();
for (int i = right.size() / 2; i < right.size(); i++) {
subRight.add(right.get(i));
}
solveGroup(left, subRight, expect - sv1);
return v;
}
static void nonEdge(ArrayList<Integer> pos) {
for (int i = 0; i < pos.size(); i++) {
for (int j = i + 1; j < pos.size(); j++) {
graph[pos.get(i)][pos.get(j)] = graph[pos.get(j)][pos.get(i)] = -1;
}
}
}
static void addEdge(int a, int b) {
if (graph[a][b] == 1) return;
graph[a][b] = graph[b][a] = 1;
uf.union(a, b);
++edges;
}
static int query(ArrayList<Integer> pos) {
++qc;
int ret;
for (int p : pos) {
query[p] = '1';
}
if (LOCAL) {
ret = processQuery();
} else {
writer.write("? " + String.valueOf(query) + "\n");
writer.flush();
ret = sc.nextInt();
}
for (int p : pos) {
query[p] = '0';
}
return ret;
}
static class UnionFind {
int[] set;
UnionFind(int n) {
set = new int[n];
Arrays.fill(set, -1);
}
void union(int a, int b) {
int rtA = root(a);
int rtb = root(b);
if (rtA == rtb) {
return;
}
set[rtA] += set[rtb];
set[rtb] = rtA;
}
boolean find(int a, int b) {
return root(a) == root(b);
}
int root(int a) {
if (set[a] < 0) {
return a;
} else {
set[a] = root(set[a]);
return set[a];
}
}
int size(int a) {
return -set[root(a)];
}
}
static boolean[][] ans;
static void generate() {
ans = new boolean[N][N];
SplittableRandom rnd = new SplittableRandom(seed);
UnionFind uf = new UnionFind(N);
int count = 0;
while (true) {
int a = rnd.nextInt(N);
int b = rnd.nextInt(N);
if (uf.find(a, b)) continue;
ans[a][b] = ans[b][a] = true;
uf.union(a, b);
++count;
if (count == N - 1) break;
}
}
static int processQuery() {
boolean[] visited = new boolean[N];
int ret = 0;
for (int i = 0; i < N; i++) {
if (query[i] == '0' || visited[i]) continue;
int d = diameter(visited, i);
ret += d * d;
}
if (DEBUG) {
System.err.println("? " + String.valueOf(query) + " " + ret);
}
return ret;
}
static int diameter(boolean[] visited, int pos) {
ArrayList<Integer> list = new ArrayList<>();
list.add(pos);
for (int i = 0; i < list.size(); i++) {
int cur = list.get(i);
OUT:
for (int j = 0; j < N; j++) {
if (query[j] == '0' || !ans[cur][j]) continue;
for (int k = 0; k < i; k++) {
if (list.get(k) == j) continue OUT;
}
list.add(j);
}
}
int farest = list.get(list.size() - 1);
list.clear();
list.add(farest);
visited[farest] = true;
for (int d = 0; ; d++) {
ArrayList<Integer> next = new ArrayList<>();
for (int cur : list) {
for (int i = 0; i < N; i++) {
if (query[i] == '0' || !ans[cur][i] || visited[i]) continue;
next.add(i);
visited[i] = true;
}
}
if (next.isEmpty()) return d;
list = next;
}
}
static boolean validate() {
if (DEBUG) {
System.err.println("expect");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(ans[i][j] ? "1" : "0");
}
System.err.println();
}
System.err.println("actual");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(graph[i][j] == 1 ? "1" : "0");
}
System.err.println();
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if ((graph[i][j] == 1) != ans[i][j]) return false;
}
}
return true;
}
}
| Main.java:9: error: ';' expected
static final boolean LOCAL = false
^
1 error
|
s898024437 | p03758 | C++ | int main(void){
int i,j,k,N=200,a;
vector<pair<int,int>> kotae;
scanf("%d",&N);
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
printf("? ");
for(k=0;k<N;k++){
if(k==i||k==j){a=1;} else{a=0;}
printf("%d",a);
}
fflush(stdout);
scanf("%d",&a);
if(a!=0){kotae.pub(mp(i,j));}
}
}
printf("!");
for(i=0;i<kotae.size();i++){
printf(" (%d,%d)",kotae[i].first,kotae[i].second);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:3:9: error: 'vector' was not declared in this scope
3 | vector<pair<int,int>> kotae;
| ^~~~~~
a.cc:3:16: error: 'pair' was not declared in this scope
3 | vector<pair<int,int>> kotae;
| ^~~~
a.cc:3:21: error: expected primary-expression before 'int'
3 | vector<pair<int,int>> kotae;
| ^~~
a.cc:4:9: error: 'scanf' was not declared in this scope
4 | scanf("%d",&N);
| ^~~~~
a.cc:7:25: error: 'printf' was not declared in this scope
7 | printf("? ");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void){
a.cc:13:32: error: 'stdout' was not declared in this scope
13 | fflush(stdout);
| ^~~~~~
a.cc:13:32: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:13:25: error: 'fflush' was not declared in this scope
13 | fflush(stdout);
| ^~~~~~
a.cc:15:34: error: 'kotae' was not declared in this scope
15 | if(a!=0){kotae.pub(mp(i,j));}
| ^~~~~
a.cc:15:44: error: 'mp' was not declared in this scope
15 | if(a!=0){kotae.pub(mp(i,j));}
| ^~
a.cc:18:9: error: 'printf' was not declared in this scope
18 | printf("!");
| ^~~~~~
a.cc:18:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:19:19: error: 'kotae' was not declared in this scope
19 | for(i=0;i<kotae.size();i++){
| ^~~~~
|
s190036367 | p03758 | Java | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.SplittableRandom;
public class Main {
static final boolean LOCAL = fase;
static final boolean DEBUG = LOCAL && true;
static Scanner sc = new Scanner(System.in);
static PrintWriter writer = new PrintWriter(System.out);
static int N;
static char[] query;
static int[][] graph;
static UnionFind uf;
static int edges;
static int qc;
static long seed;
public static void main(String[] args) {
if (args.length >= 1) {
seed = Long.parseLong(args[0]);
}
N = sc.nextInt();
if (LOCAL) generate();
query = new char[N];
Arrays.fill(query, '0');
graph = new int[N][N];
uf = new UnionFind(N);
for (int i = 0; i < N; i++) {
solve(i);
}
if (LOCAL) {
System.out.println("validate:" + validate());
System.out.println("query count:" + qc);
} else {
writer.print("!");
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (graph[i][j] == 1) writer.print(" (" + i + "," + j + ")");
}
}
writer.println();
writer.flush();
}
}
static void solve(int axis) {
final int BUCKET = 8;
ArrayList<Integer> pos = new ArrayList<>();
for (int i = axis + 1; i < N; i++) {
if (uf.find(axis, i) || graph[axis][i] != 0) continue;
pos.add(i);
if (pos.size() == BUCKET) {
solveSub(axis, pos);
pos.clear();
}
}
if (!pos.isEmpty()) {
solveSub(axis, pos);
}
}
static int solveSub(int axis, ArrayList<Integer> pos) {
if (edges == N - 1) return 0;
pos.add(axis);
int v = query(pos);
if (v == 0) {
nonEdge(pos);
return v;
}
pos.remove(pos.size() - 1);
if (pos.size() == 1 && v == 1) {
addEdge(axis, pos.get(0));
}
if (pos.size() == 1) return v;
ArrayList<Integer> subPos = new ArrayList<>();
for (int i = 0; i < pos.size() / 2; i++) {
subPos.add(pos.get(i));
}
int sv = solveSub(axis, subPos);
if (v < 4 && sv == v) {
subPos.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos.add(pos.get(i));
}
nonEdge(subPos);
return v;
}
subPos.clear();
for (int i = pos.size() / 2; i < pos.size(); i++) {
subPos.add(pos.get(i));
}
int sv2 = solveSub(axis, subPos);
if (pos.size() == 2 && v == 1 && sv == 0 && sv2 == 0 && graph[pos.get(0)][pos.get(1)] == 0) {
addEdge(pos.get(0), pos.get(1));
}
return v;
}
static void nonEdge(ArrayList<Integer>pos) {
for (int i = 0; i < pos.size(); i++) {
for (int j = i + 1; j < pos.size(); j++) {
graph[pos.get(i)][pos.get(j)] = -1;
}
}
}
static void addEdge(int a, int b) {
graph[a][b] = graph[b][a] = 1;
uf.union(a, b);
++edges;
}
static int query(ArrayList<Integer> pos) {
++qc;
int ret;
for (int p : pos) {
query[p] = '1';
}
if (LOCAL) {
ret = processQuery();
} else {
writer.write("? " + String.valueOf(query) + "\n");
writer.flush();
ret = sc.nextInt();
}
for (int p : pos) {
query[p] = '0';
}
return ret;
}
static class UnionFind {
int[] set;
UnionFind(int n) {
set = new int[n];
Arrays.fill(set, -1);
}
void union(int a, int b) {
int rtA = root(a);
int rtb = root(b);
if (rtA == rtb) {
return;
}
set[rtA] += set[rtb];
set[rtb] = rtA;
}
boolean find(int a, int b) {
return root(a) == root(b);
}
int root(int a) {
if (set[a] < 0) {
return a;
} else {
set[a] = root(set[a]);
return set[a];
}
}
int size(int a) {
return -set[root(a)];
}
}
static boolean[][] ans;
static void generate() {
ans = new boolean[N][N];
SplittableRandom rnd = new SplittableRandom(seed);
UnionFind uf = new UnionFind(N);
int count = 0;
while (true) {
int a = rnd.nextInt(N);
int b = rnd.nextInt(N);
if (uf.find(a, b)) continue;
ans[a][b] = ans[b][a] = true;
uf.union(a, b);
++count;
if (count == N - 1) break;
}
}
static int processQuery() {
boolean[] visited = new boolean[N];
int ret = 0;
for (int i = 0; i < N; i++) {
if (query[i] == '0' || visited[i]) continue;
int d = diameter(visited, i);
ret += d * d;
}
if (DEBUG) {
System.err.println("? " + String.valueOf(query) + " " + ret);
}
return ret;
}
static int diameter(boolean[] visited, int pos) {
ArrayList<Integer> list = new ArrayList<>();
list.add(pos);
for (int i = 0; i < list.size(); i++) {
int cur = list.get(i);
OUT:
for (int j = 0; j < N; j++) {
if (query[j] == '0' || !ans[cur][j]) continue;
for (int k = 0; k < i; k++) {
if (list.get(k) == j) continue OUT;
}
list.add(j);
}
}
int farest = list.get(list.size() - 1);
list.clear();
list.add(farest);
visited[farest] = true;
for (int d = 0; ; d++) {
ArrayList<Integer> next = new ArrayList<>();
for (int cur : list) {
for (int i = 0; i < N; i++) {
if (query[i] == '0' || !ans[cur][i] || visited[i]) continue;
next.add(i);
visited[i] = true;
}
}
if (next.isEmpty()) return d;
list = next;
}
}
static boolean validate() {
if (DEBUG) {
System.err.println("expect");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(ans[i][j] ? "1" : "0");
}
System.err.println();
}
System.err.println("actual");
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
System.err.print(graph[i][j] == 1 ? "1" : "0");
}
System.err.println();
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if ((graph[i][j] == 1) != ans[i][j]) return false;
}
}
return true;
}
}
| Main.java:8: error: cannot find symbol
static final boolean LOCAL = fase;
^
symbol: variable fase
location: class Main
1 error
|
s325548282 | p03759 | C++ | #include <iostream>
int main () {
int a,b,c;
std::string res;
if (c-b == b-a) {
res = "YES"
} else {
res = "NO"
}
std::cout << res << std::endl;
} | a.cc: In function 'int main()':
a.cc:8:20: error: expected ';' before '}' token
8 | res = "YES"
| ^
| ;
9 | } else {
| ~
a.cc:10:19: error: expected ';' before '}' token
10 | res = "NO"
| ^
| ;
11 | }
| ~
|
s151699457 | p03759 | C++ | #include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
if(b - a = c - b) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:26:8: error: lvalue required as left operand of assignment
26 | if(b - a = c - b) cout << "YES" << endl;
| ~~^~~
|
s186126738 | p03759 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<((b-a==c-b)?"YES":"NO");
return 0:
} | a.cc: In function 'int main()':
a.cc:10:11: error: expected ';' before ':' token
10 | return 0:
| ^
| ;
a.cc:10:11: error: expected primary-expression before ':' token
|
s800137135 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if((b−a) == (c−b)){
cout << "YES" << endl;
}
else cout << "NO" << endl;
} | a.cc:7:9: error: extended character − is not valid in an identifier
7 | if((b−a) == (c−b)){
| ^
a.cc:7:18: error: extended character − is not valid in an identifier
7 | if((b−a) == (c−b)){
| ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'b\U00002212a' was not declared in this scope
7 | if((b−a) == (c−b)){
| ^~~
a.cc:7:18: error: 'c\U00002212b' was not declared in this scope
7 | if((b−a) == (c−b)){
| ^~~
|
s174308342 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if(b−a==c−b){
cout << "YES" << endl;
}
else cout << "NO" << endl;
} | a.cc:7:8: error: extended character − is not valid in an identifier
7 | if(b−a==c−b){
| ^
a.cc:7:13: error: extended character − is not valid in an identifier
7 | if(b−a==c−b){
| ^
a.cc: In function 'int main()':
a.cc:7:8: error: 'b\U00002212a' was not declared in this scope
7 | if(b−a==c−b){
| ^~~
a.cc:7:13: error: 'c\U00002212b' was not declared in this scope
7 | if(b−a==c−b){
| ^~~
|
s834170219 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
// 入力部(a,b,c)
string a, b, c;
cin >> a >> b >>c;
if(b-a == c-b) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:9:7: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
9 | if(b-a == c-b) {
| ~^~
| | |
| | basic_string<[...]>
| basic_string<[...]>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
9 | if(b-a == c-b) {
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
9 | if(b-a == c-b) {
| ^
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
a.cc:9:8: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>'
9 | if(b-a == c-b) {
| ^
a.cc:9:14: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
9 | if(b-a == c-b) {
| ~^~
| | |
| | basic_string<[...]>
| basic_string<[...]>
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~ |
s067565035 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define bn(n) (n).begin(), (n).end()
#define FOR(n) for(int i = 0; i < (int)n; i++)
void solve() {
int a, b, c;
cin >> a >> b >> c;
if (b-a == c-b) {
cout << "YES\n";
} else {
cout << "NO\n"
}
}
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int t = 1, i = 1;
//cin >> t;
while(t--) {
//cout << "Case #" << i << ": ";
solve();
//i++;
}
return 0;
}
| a.cc: In function 'void solve()':
a.cc:18:23: error: expected ';' before '}' token
18 | cout << "NO\n"
| ^
| ;
19 | }
| ~
|
s281787952 | p03759 | Java | import java.util.*;
public class main{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
if(b - a == c - b) {
System.out.println("YES");
}else {
System.out.println("NO");
}
}
}
| Main.java:3: error: class main is public, should be declared in a file named main.java
public class main{
^
1 error
|
s498939996 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
signed main()
{
int a,b,c;
cin >> a >> b >> c;
if(b-a == c-b){cout << "YES";}
else{cout << "NO";} | a.cc: In function 'int main()':
a.cc:11:22: error: expected '}' at end of input
11 | else{cout << "NO";}
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s712615755 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
signed main()
{
int a,b,c;
cin >> a >> b >> c;
cout << ((b-a) == (c-b) ? "YES" : "NO"); | a.cc: In function 'int main()':
a.cc:10:43: error: expected '}' at end of input
10 | cout << ((b-a) == (c-b) ? "YES" : "NO");
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s194875851 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
signed main()
{
int a,b,c;
cin >> a >> b >> c;
cout << (b-a==c-b ? "YES" : "NO"); | a.cc: In function 'int main()':
a.cc:10:37: error: expected '}' at end of input
10 | cout << (b-a==c-b ? "YES" : "NO");
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s979702882 | p03759 | Java | import java.util.Scanner;
public class Main099 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int aa = (b - a);
int bb = (c - b);
if(aa == bb) System.out.println("YES");
else System.out.println("NO");
}
}
| Main.java:3: error: class Main099 is public, should be declared in a file named Main099.java
public class Main099 {
^
1 error
|
s855347887 | p03759 | C | #include <stdio.h>
int main()
{
int a,b,c,z,y;
scanf("%d %d %d", &a, &b, &c);
z=b-a;
y=c-b;
if(x==y)
{
printf("YES");
}
else{
printf("NO");
}
return 0;
} | main.c: In function 'main':
main.c:12:8: error: 'x' undeclared (first use in this function)
12 | if(x==y)
| ^
main.c:12:8: note: each undeclared identifier is reported only once for each function it appears in
|
s772287581 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
// vector
#define ALL(x) x.begin(), x.end()
// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
cout << a;
ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
cout << a << ' ';
}
int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main()
{
int a, b, n, x, y;
cin >> a >> b >> c;
if (b - a == c - b)
Yes();
else
No();
return 0;
} | a.cc: In function 'int main()':
a.cc:59:20: error: 'c' was not declared in this scope
59 | cin >> a >> b >> c;
| ^
|
s433846697 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
// vector
#define ALL(x) x.begin(), x.end()
// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
cout << a;
ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
cout << a << ' ';
}
int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main()
{
int a, b, n, x, y;
cin >> a >> b >> c;
if (b - a == c - b)
Yes();
else
No();
return 0;
} | a.cc: In function 'int main()':
a.cc:59:20: error: 'c' was not declared in this scope
59 | cin >> a >> b >> c;
| ^
|
s608493189 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
// vector
#define ALL(x) x.begin(), x.end()
// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
cout << a;
ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
cout << a << ' ';
}
int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main()
{
int a, b, n, x, y;
cin >> a >> b >> c;
if(b-a==c-b)Yes():
else No();
return 0;
} | a.cc: In function 'int main()':
a.cc:59:20: error: 'c' was not declared in this scope
59 | cin >> a >> b >> c;
| ^
a.cc:60:20: error: expected ';' before ':' token
60 | if(b-a==c-b)Yes():
| ^
|
s101008910 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (b-a == c-b)
cout << "YES";
else
cout << "NO"
} | a.cc: In function 'int main()':
a.cc:11:17: error: expected ';' before '}' token
11 | cout << "NO"
| ^
| ;
12 | }
| ~
|
s647046725 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b >> c;
cout (b-a == c-b ? "YES" : "NO") << endl;
} | a.cc: In function 'int main()':
a.cc:7:8: error: no match for call to '(std::ostream {aka std::basic_ostream<char>}) (const char*)'
7 | cout (b-a == c-b ? "YES" : "NO") << endl;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s845605280 | p03759 | C++ | #include <cstdio>
int main()
{
int a,b,c;
scanf("%d %d %d", &a, &b, &c);
if (b - a == c - b)
{
printf("YES");
}
else
{
printf("NO");
} | a.cc: In function 'int main()':
a.cc:15:2: error: expected '}' at end of input
15 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s124104180 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if (b - a) == (c - a){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
} | a.cc: In function 'int main()':
a.cc:9:14: error: expected primary-expression before '==' token
9 | if (b - a) == (c - a){
| ^~
|
s328800961 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if (b - a) == (c - a){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
} | a.cc: In function 'int main()':
a.cc:9:14: error: expected primary-expression before '==' token
9 | if (b - a) == (c - a){
| ^~
|
s462155860 | p03759 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if (b − a == c − b)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
} | a.cc:7:9: error: extended character − is not valid in an identifier
7 | if (b − a == c − b)
| ^
a.cc:7:18: error: extended character − is not valid in an identifier
7 | if (b − a == c − b)
| ^
a.cc: In function 'int main()':
a.cc:7:8: error: expected ')' before '\U00002212'
7 | if (b − a == c − b)
| ~ ^~
| )
|
s128122787 | p03759 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, c;
cin >> a >> b >> c;
if (b−a==c−b)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
} | a.cc:7:7: error: extended character − is not valid in an identifier
7 | if (b−a==c−b)
| ^
a.cc:7:12: error: extended character − is not valid in an identifier
7 | if (b−a==c−b)
| ^
a.cc: In function 'int main()':
a.cc:7:7: error: 'b\U00002212a' was not declared in this scope
7 | if (b−a==c−b)
| ^~~
a.cc:7:12: error: 'c\U00002212b' was not declared in this scope
7 | if (b−a==c−b)
| ^~~
|
s527434901 | p03759 | C | #include <stdio.h>
int main(void)
{
int a,b.c;
scanf("%d%d%d",&a,&b,&c);
if(b-c==c-b)printf("YES\n");
else printf("NO\n");
return 0;
}
| main.c: In function 'main':
main.c:5:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
5 | int a,b.c;
| ^
main.c:6:28: error: 'b' undeclared (first use in this function)
6 | scanf("%d%d%d",&a,&b,&c);
| ^
main.c:6:28: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:31: error: 'c' undeclared (first use in this function)
6 | scanf("%d%d%d",&a,&b,&c);
| ^
|
s721064965 | p03759 | C | #include <stdio.h>
int main(void)
{
int a.b.c;
scanf("%d%d%d",&a,&b,&c);
if(b-c==c-b)printf("YES\n");
else printf("NO\n");
return 0;
}
| main.c: In function 'main':
main.c:5:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
5 | int a.b.c;
| ^
main.c:5:14: error: expected expression before '.' token
main.c:6:25: error: 'a' undeclared (first use in this function)
6 | scanf("%d%d%d",&a,&b,&c);
| ^
main.c:6:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:28: error: 'b' undeclared (first use in this function)
6 | scanf("%d%d%d",&a,&b,&c);
| ^
main.c:6:31: error: 'c' undeclared (first use in this function)
6 | scanf("%d%d%d",&a,&b,&c);
| ^
|
s004572051 | p03759 | C | #include <stdio.h>
int main(void){
int A, B, C;
scanf("%d %d", &A, &B, &C);
if (B-A = C-B){
printf("YES");
} else {
printf("NO");
}
return 0;
}
| main.c: In function 'main':
main.c:6:11: error: lvalue required as left operand of assignment
6 | if (B-A = C-B){
| ^
|
s369846315 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
int k=a.size(),l=b.size();
string s;
if(k>=l){
for(int i=0;i<k-1;i++){
s+=k[i]+l[i];
}
s +=a[k-1];
cout << s <<endl;
}
else{
for(int i=0;i<k-1;i++){
s+=l[i]+k[i];
}
s +=b[k-1];
cout << s <<endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:7: error: invalid types 'int[int]' for array subscript
11 | s+=k[i]+l[i];
| ^
a.cc:11:12: error: invalid types 'int[int]' for array subscript
11 | s+=k[i]+l[i];
| ^
a.cc:18:7: error: invalid types 'int[int]' for array subscript
18 | s+=l[i]+k[i];
| ^
a.cc:18:12: error: invalid types 'int[int]' for array subscript
18 | s+=l[i]+k[i];
| ^
|
s728588946 | p03759 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b<<c;
if(b-a==c-b) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:12: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
7 | cin>>a>>b<<c;
| ~~~~~~~~~^~~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:7:12: note: candidate: 'operator<<(int, int)' (built-in)
7 | cin>>a>>b<<c;
| ~~~~~~~~~^~~
a.cc:7:12: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:7:9: note: cannot convert '(& std::cin.std::basic_istream<char>::operator>>(a))->std::basic_istream<char>::operator>>(b)' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte'
7 | cin>>a>>b<<c;
| ~~~~~~^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:7:14: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:7:14: required from here
7 | cin>>a>>b<<c;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
|
s614394823 | p03759 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = nextInt();
int b = nextInt();
int c = nextInt();
System.out.println(b-a==c-b ? "YES" : "NO");
}
}
| Main.java:6: error: cannot find symbol
int a = nextInt();
^
symbol: method nextInt()
location: class Main
Main.java:7: error: cannot find symbol
int b = nextInt();
^
symbol: method nextInt()
location: class Main
Main.java:8: error: cannot find symbol
int c = nextInt();
^
symbol: method nextInt()
location: class Main
3 errors
|
s271531289 | p03759 | C++ | #include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
int main() {
char a, b, c
cin >> a >> b >> c;
cout << (b-a==c-b ? "YES" : "NO");
} | a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'cin'
9 | cin >> a >> b >> c;
| ^~~
a.cc:10:17: error: 'c' was not declared in this scope
10 | cout << (b-a==c-b ? "YES" : "NO");
| ^
|
s790755641 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
int a, b;
cin >> a >> b >> c ;
//*
if(b - a == c - b){
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
//*/
//cout << ( a + b ) % 24 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:22: error: 'c' was not declared in this scope
6 | cin >> a >> b >> c ;
| ^
|
s904653982 | p03759 | C | #include <stdio.h>
int main(void){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(b - a == c - d){
printf("Yes\n");
}else {
printf("No\n");
}
}
| main.c: In function 'main':
main.c:7:21: error: 'd' undeclared (first use in this function)
7 | if(b - a == c - d){
| ^
main.c:7:21: note: each undeclared identifier is reported only once for each function it appears in
|
s868974565 | p03759 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if((abs(c - b) == abs(b - a)) cout << "YES" << endl;
else cout << "NO"<< endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:32: error: expected ';' before 'cout'
12 | if((abs(c - b) == abs(b - a)) cout << "YES" << endl;
| ^~~~~
| ;
a.cc:13:6: error: expected primary-expression before 'else'
13 | else cout << "NO"<< endl;
| ^~~~
a.cc:12:55: error: expected ')' before 'else'
12 | if((abs(c - b) == abs(b - a)) cout << "YES" << endl;
| ~ ^
| )
13 | else cout << "NO"<< endl;
| ~~~~
|
s580671090 | p03759 | C++ | #include<iostream>
using namespae std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(2*b==a+c)
cout<<"YES";
else
cout<<"NO";
}
| a.cc:2:7: error: expected nested-name-specifier before 'namespae'
2 | using namespae std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin>>a>>b>>c;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:8:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
8 | cout<<"YES";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<"NO";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s778193927 | p03759 | C++ | #include <iostream>
using namespace std;
int main(void){
// Your code here!
int a,b,c;
cin >> a << b >> c;
if (b-a==c-b)
cout << "YES" << endl;
else
cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:6:14: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
6 | cin >> a << b >> c;
| ~~~~~~~~ ^~ ~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:6:14: note: candidate: 'operator<<(int, int)' (built-in)
6 | cin >> a << b >> c;
| ~~~~~~~~~^~~~
a.cc:6:14: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:6:9: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(a)' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte'
6 | cin >> a << b >> c;
| ~~~~^~~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:6:17: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:6:17: required from here
6 | cin >> a << b >> c;
| ^
/usr/include/c++/14/ostream:810:5: |
s694381065 | p03759 | C++ | #include <iostream>
using namespace std;
int main(void){
// Your code here!
int a, b, c;
cin >> a >> b >> c;
if ( b - a == c - b )
cout << "Yes" << endl;
else
cout << "No" << endl;
retrun 0;
}
| a.cc: In function 'int main()':
a.cc:16:5: error: 'retrun' was not declared in this scope
16 | retrun 0;
| ^~~~~~
|
s772668994 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if(b-a=c-b)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: lvalue required as left operand of assignment
8 | if(b-a=c-b)
| ~^~
|
s596993294 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if((b-a)==(c-b)){
cout<<"Yes";
}
else(){
cout<<"No";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:6: error: expected primary-expression before ')' token
9 | else(){
| ^
|
s121607213 | p03759 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] n=new int[3];
for(int i=0;i<3;i++){
n[i]=sc.nextInt();
}
if(n[1]-n[0]==n[2]-n[1]){
System.out.println("YES");
}else{
System.out.pritnln("NO");
}
}
}
| Main.java:15: error: cannot find symbol
System.out.pritnln("NO");
^
symbol: method pritnln(String)
location: variable out of type PrintStream
1 error
|
s791002739 | p03759 | C++ | a, b, c = map(int, input().split())
if b - a == c - b:
print("YES")
else:
print("NO")
| a.cc:1:1: error: 'a' does not name a type
1 | a, b, c = map(int, input().split())
| ^
|
s063829268 | p03759 | C++ | YES | a.cc:1:1: error: 'YES' does not name a type
1 | YES
| ^~~
|
s849562074 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main ()
{
int a, b, c;
cin >> a >> b >> c;
if (c-b == b-a) cout << "YES\n";
else cout << "NO\n;
return 0;
} | a.cc:9:16: warning: missing terminating " character
9 | else cout << "NO\n;
| ^
a.cc:9:16: error: missing terminating " character
9 | else cout << "NO\n;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: expected primary-expression before 'return'
10 | return 0;
| ^~~~~~
|
s327554135 | p03759 | C++ | #include<bits/sdtc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if(b-a==c-b){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
} | a.cc:1:9: fatal error: bits/sdtc++.h: No such file or directory
1 | #include<bits/sdtc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s118895671 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if(b-a==c-b){
cout<<"YES";
}
else{
cout<<"NO"+
}
} | a.cc: In function 'int main()':
a.cc:11:3: error: expected primary-expression before '}' token
11 | }
| ^
|
s348114888 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (b - a == c - b) cout << "YES";
else cout << "NO"
} | a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before '}' token
8 | else cout << "NO"
| ^
| ;
9 | }
| ~
|
s459943108 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
if (b - a == c - b) cout << "YES";
else "NO"
} | a.cc: In function 'int main()':
a.cc:8:14: error: expected ';' before '}' token
8 | else "NO"
| ^
| ;
9 | }
| ~
|
s717438420 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(){
int a,b,c;
cin >> a >> b >> c;
if(a - b = b - c) cout << "YES" << endl;
else cout << "NO" << endl;
}
| a.cc: In function 'int main()':
a.cc:9:8: error: lvalue required as left operand of assignment
9 | if(a - b = b - c) cout << "YES" << endl;
| ~~^~~
|
s222924465 | p03759 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.next();
int b = sc.next();
int c = sc.next();
if(b - a == c - b) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
} | Main.java:6: error: incompatible types: String cannot be converted to int
int a = sc.next();
^
Main.java:7: error: incompatible types: String cannot be converted to int
int b = sc.next();
^
Main.java:8: error: incompatible types: String cannot be converted to int
int c = sc.next();
^
3 errors
|
s140171546 | p03759 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.next();
int b = sc.next();
int c = sc.next();
if(b - a == c - b) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
} | Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s791826825 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a , b , c ;
cin >> a >> b >> c ;
if (b-a == c-a){
cout << "YES" << endl;
}
else){
cout << "NO" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:7: error: expected primary-expression before ')' token
11 | else){
| ^
|
s326523058 | p03759 | C++ | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;
int main() {
vector<int> v(3);
for(int i = 0; i < 3; i++){
cin >> v[i];
}
sort(v.begin(), v.sort());
if(v[1] - v[0] == v[2] - v[1]){
cout << "YES";
}
else{
cout << "NO";
}
cout << endl;
}
| a.cc: In function 'int main()':
a.cc:16:23: error: 'class std::vector<int>' has no member named 'sort'
16 | sort(v.begin(), v.sort());
| ^~~~
|
s706881106 | p03759 | C++ | #include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if((b-a)==(c-b)){
printf("YES");
}else{
printf("NO");
}
putchar('\n');
return 0;
}
¥ | a.cc:13:1: error: extended character ¥ is not valid in an identifier
13 | ¥
| ^
a.cc:13:1: error: '\U000000a5' does not name a type
13 | ¥
| ^
|
s700388757 | p03759 | C | #include<stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
char y_n[5];
y_n=(b-a==c-b)?"YES":"NO";
printf("%s",y_n);
return 0;
} | main.c: In function 'main':
main.c:6:6: error: assignment to expression with array type
6 | y_n=(b-a==c-b)?"YES":"NO";
| ^
|
s602078660 | p03759 | C++ | #include<iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if(a - b = b - c)
cout << "YES";
else
cout << "NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:7:8: error: lvalue required as left operand of assignment
7 | if(a - b = b - c)
| ~~^~~
|
s976995594 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;
int main(){
int a,b,c;
cin >> a >> b >> c;
string ans = (b*2 == a+c) ? "YES" : "NO";
cout << and << endl;
} | a.cc: In function 'int main()':
a.cc:15:15: error: expected identifier before '<<' token
15 | cout << and << endl;
| ^~
|
s337669567 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(b-c==c-b)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return: 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: expected primary-expression before ':' token
13 | return: 0;
| ^
a.cc:13:9: error: expected ';' before ':' token
13 | return: 0;
| ^
| ;
a.cc:13:9: error: expected primary-expression before ':' token
|
s651041669 | p03759 | C++ | #iclude<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c ;
cin>>a>>b>>c;
if(b-c==c-b)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
} | a.cc:1:2: error: invalid preprocessing directive #iclude; did you mean #include?
1 | #iclude<bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:7:1: error: 'cin' was not declared in this scope
7 | cin>>a>>b>>c;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #iclude<bits/stdc++.h>
a.cc:10:1: error: 'cout' was not declared in this scope
10 | cout<<"YES"<<endl;
| ^~~~
a.cc:10:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:14: error: 'endl' was not declared in this scope
10 | cout<<"YES"<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #iclude<bits/stdc++.h>
a.cc:12:9: error: 'cout' was not declared in this scope
12 | cout<<"NO"<<endl;
| ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:21: error: 'endl' was not declared in this scope
12 | cout<<"NO"<<endl;
| ^~~~
a.cc:12:21: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s747178500 | p03759 | C++ | #incude<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(b-a==c-b)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;
}
| a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include?
1 | #incude<bits/stdc++.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin>>a>>b>>c;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incude<bits/stdc++.h>
a.cc:8:5: error: 'cout' was not declared in this scope
8 | cout<<"YES"<<endl;
| ^~~~
a.cc:8:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:18: error: 'endl' was not declared in this scope
8 | cout<<"YES"<<endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #incude<bits/stdc++.h>
a.cc:10:5: error: 'cout' was not declared in this scope
10 | cout<<"NO"<<endl;
| ^~~~
a.cc:10:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:17: error: 'endl' was not declared in this scope
10 | cout<<"NO"<<endl;
| ^~~~
a.cc:10:17: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s823039597 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
int a, b, c; cin >> a >> b >> c;
string ans;
if(b-a = c-b) ans = "YES";
else ans = "NO";
cout << ans;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: lvalue required as left operand of assignment
9 | if(b-a = c-b) ans = "YES";
| ~^~
|
s407645786 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define b begin()
#define e end()
#define em emplace
#define eb emplace_back
#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>
#define pss pair<string,string>
#define pcc pair<char,char>
#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>
#define vi vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>
#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;
int arr[g_size];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n,m,T,res;
int maxi=-mx,mini=mx,count=0;
int i,j,k;
bool flag;
string s1,s2;
char s[100000];
int ara[n_size],ara2[n_size];
cin>>n>>m>>k;
(m-n==l-m)?cout<<"YES"<<endl:cout<<"NO"<<endl;
}
| a.cc: In function 'int main()':
a.cc:108:15: error: 'l' was not declared in this scope
108 | (m-n==l-m)?cout<<"YES"<<endl:cout<<"NO"<<endl;
| ^
|
s428963323 | p03759 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
bool ans = true;
if(b-a == c-b) ans = true;
cout << (ans ? "YES"|"NO") << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:23: error: invalid operands of types 'const char [4]' and 'const char [3]' to binary 'operator|'
13 | cout << (ans ? "YES"|"NO") << endl;
| ~~~~~^~~~~
| | |
| | const char [3]
| const char [4]
a.cc:13:28: error: expected ':' before ')' token
13 | cout << (ans ? "YES"|"NO") << endl;
| ^
| :
a.cc:13:28: error: expected primary-expression before ')' token
|
s645029249 | p03759 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(void) {
int a, b, c;
cin >> a >> b >> c;
bool ans = true;
if(b-a = c-b) ans = true;
cout << (ans ? "Yes"|"No") << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:7: error: lvalue required as left operand of assignment
12 | if(b-a = c-b) ans = true;
| ~^~
a.cc:13:23: error: invalid operands of types 'const char [4]' and 'const char [3]' to binary 'operator|'
13 | cout << (ans ? "Yes"|"No") << endl;
| ~~~~~^~~~~
| | |
| | const char [3]
| const char [4]
a.cc:13:28: error: expected ':' before ')' token
13 | cout << (ans ? "Yes"|"No") << endl;
| ^
| :
a.cc:13:28: error: expected primary-expression before ')' token
|
s397833254 | p03759 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin >> a >> b >> c;
if b - a == c - b{
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:6: error: expected '(' before 'b'
6 | if b - a == c - b{
| ^
| (
a.cc:8:4: error: 'else' without a previous 'if'
8 | }else{
| ^~~~
|
s073759627 | p03759 | Java | import java.util.*;
import java.io.*;
public class Solution1 {
static class Reader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public Reader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
public static void main(String[] args) throws IOException{
Reader in = new Reader(System.in);
int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
if(b-a == c-b) System.out.println("YES");
else System.out.println("NO");
}
}
| Main.java:4: error: class Solution1 is public, should be declared in a file named Solution1.java
public class Solution1 {
^
1 error
|
s818857609 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main () {
int a, b, c;
cin >> a >> b >> c;
if(b==(a+c)/2) { | a.cc: In function 'int main()':
a.cc:7:19: error: expected '}' at end of input
7 | if(b==(a+c)/2) {
| ~^
a.cc:7:19: error: expected '}' at end of input
a.cc:4:13: note: to match this '{'
4 | int main () {
| ^
|
s460409550 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if((b-a)==(c-b)){
cout<<"YES";
else
cout<<"NO";
return 1;
} | a.cc: In function 'int main()':
a.cc:8:1: error: expected '}' before 'else'
8 | else
| ^~~~
a.cc:6:17: note: to match this '{'
6 | if((b-a)==(c-b)){
| ^
|
s709234932 | p03759 | C++ | #include<bits.stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
if((b-a)==(c-b)){
cout<<"YES";
else
cout<<"NO";
return 1;
} | a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory
1 | #include<bits.stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s415656352 | p03759 | C++ | #include<bits/stdc++.h>
using namespace std
int main(){
int a,b,c;
cin>>a>>b>>c;
if((b-a)==(c-b)){
cout<<"YES";
else
cout<<"NO";
return 1;
} | a.cc:2:20: error: expected ';' before 'int'
2 | using namespace std
| ^
| ;
3 | int main(){
| ~~~
a.cc: In function 'int main()':
a.cc:8:1: error: expected '}' before 'else'
8 | else
| ^~~~
a.cc:6:17: note: to match this '{'
6 | if((b-a)==(c-b)){
| ^
|
s441718618 | p03759 | C++ | .
| a.cc:1:1: error: expected unqualified-id before '.' token
1 | .
| ^
|
s256310439 | p03759 | C++ | #include<stdio.h>
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(abs(b-a)==abs(c-b))
printf("YES");
else
printf("NO");
return 0;
} | a.cc: In function 'int main()':
a.cc:6:12: error: 'abs' was not declared in this scope
6 | if(abs(b-a)==abs(c-b))
| ^~~
|
s891145773 | p03759 | C++ | #include<stdio.h>
void main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(abs(b-a)==abs(c-b))
printf("YES");
else
printf("NO");
} | a.cc:2:1: error: '::main' must return 'int'
2 | void main()
| ^~~~
a.cc: In function 'int main()':
a.cc:6:12: error: 'abs' was not declared in this scope
6 | if(abs(b-a)==abs(c-b))
| ^~~
|
s996769445 | p03759 | C | #include<stdio.h>
int main()
{
int a,b,c;
clrscr();
scanf("%d %d %d",&a,&b,&c);
if(b-a==c-b)
printf("YES");
else
printf("NO");
return 0;
} | main.c: In function 'main':
main.c:5:1: error: implicit declaration of function 'clrscr' [-Wimplicit-function-declaration]
5 | clrscr();
| ^~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.