submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s235641870 | p03741 | C++ | #include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif
using namespace std;
using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
//struct edge {int from, to, cost;};
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);
//constexpr int INF = INT_MAX;
template<class T> inline T sqr(T x) {return x*x;}
int main() {
int n;
cin >> n;
VI a(n);
int in, diff,sum = 0;
LL cnt = 0;
REP(i,0,n) cin >> a[i];
sum = a[0];
bool isz = (sum == 0);
REP(i,1,n) {
in = a[i];
dump(i);
if (sum < 0) {
if (sum + in < 0) {
cnt += abs(sum + in) + 1;
sum = 1;
dump(cnt);
} else if (sum + in > 0) {
sum = sum + in;
} else {
++cnt;
sum = 1;
}
} else if (sum > 0) {
if (sum + in < 0) {
sum = sum + in;
} else if (sum + in > 0) {
cnt += abs(sum + in) + 1;
sum = -1;
dump(cnt);
} else {
++cnt;
sum = -1;
}
} else {
if (in != 0) {
isz = false;
if (in > 0) sum = in - 1;
else sum = in + 1;
cnt = 2 * i - 1;
if (in == 1) {
++sum;
++cnt++;
}
if (in == -1) {
--sum;
++cnt;
}
}
}
}
//cout << cnt << endl;
LL cnt2 = cnt;
if (a[0] > 0) sum = -1;
else if (a[0] < 0) sum = 1;
else sum = 0;
cnt = a[0] + 1;
if (sum == 0) cnt = 0;
//isz = (sum == 0);
REP(i,1,n) {
in = a[i];
dump(i);
if (sum < 0) {
if (sum + in < 0) {
cnt += abs(sum + in) + 1;
sum = 1;
dump(cnt);
} else if (sum + in > 0) {
sum = sum + in;
} else {
++cnt;
sum = 1;
}
} else if (sum > 0) {
if (sum + in < 0) {
sum = sum + in;
} else if (sum + in > 0) {
cnt += abs(sum + in) + 1;
sum = -1;
dump(cnt);
} else {
++cnt;
sum = -1;
}
} else {
if (in != 0) {
isz = false;
if (in > 0) sum = - 1;
else sum = 1;
cnt = 2 * i - 1 + abs(in) + 2;
}
}
}
if (sum == 0) cout << 2 * n - 1 << endl;
else cout << min(cnt, cnt2) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:98:26: error: lvalue required as increment operand
98 | ++cnt++;
| ~~~^~
|
s465940772 | p03741 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
long long x,y;
int main()
{
scanf("%lld%lld",&x,&y);
if (x<y)
swap(x,y);
if (x==y)
puts("Brown");
else if (x<=2)
puts("Brown");
else put("Alice");
return 0;
} | a.cc: In function 'int main()':
a.cc:14:14: error: 'put' was not declared in this scope; did you mean 'putw'?
14 | else put("Alice");
| ^~~
| putw
|
s596014923 | p03741 | C++ | #include <cstdio>
long long x,y;
int main()
{
scanf("%lld%lld",&x,&y);
if (x<y)
swap(x,y);
if (x==y)
puts("Brown");
else if (x<=2)
puts("Brown");
else put("Alice");
return 0;
} | a.cc: In function 'int main()':
a.cc:7:17: error: 'swap' was not declared in this scope
7 | swap(x,y);
| ^~~~
a.cc:12:14: error: 'put' was not declared in this scope; did you mean 'putw'?
12 | else put("Alice");
| ^~~
| putw
|
s377724173 | p03741 | C++ | /*
* 17-04-22_ARC072_C.cpp
*
* Created on: 2017/04/22
* Author: ryoma
*/
#include<iostream>
#include<algorithm>
using namespace std;
typedef unsigned long long ll;
int N;
ll a[100010];
ll ans;
ll solve(ll prev,ll sum,ll p){
ll res = p;
for(int i=1;i<N;i++){
//cout<<sum<<endl;
sum += a[i];
if(sum == 0){
res ++;
sum = -prev/abs(prev);
}
else if(sum * prev > 0){
res += abs(sum)+1;
sum = -prev/abs(prev);
}
prev = sum;
}
return res;
}
int main(){
cin >> N;
for(int i=0;i<N;i++){
cin >> a[i];
}
ll r1,r2;
if(a[0] == 0){
r1 = solve(1,1,1);
r2 = solve(-1,-1,1);
}
else{
r1 = solve(a[0],a[0],0);
r2 = solve(-a[0]/a[0],-a[0]/a[0],abs(a[0])+1);
}
ans = min(r1,r2);
//cout << r1 << " "<<r2<<endl;
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'll solve(ll, ll, ll)':
a.cc:25:40: error: call of overloaded 'abs(ll&)' is ambiguous
25 | sum = -prev/abs(prev);
| ~~~^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
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:8:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
a.cc:28:35: error: call of overloaded 'abs(ll&)' is ambiguous
28 | res += abs(sum)+1;
| ~~~^~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
a.cc:29:40: error: call of overloaded 'abs(ll&)' is ambiguous
29 | sum = -prev/abs(prev);
| ~~~^~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
a.cc: In function 'int main()':
a.cc:47:53: error: call of overloaded 'abs(ll&)' is ambiguous
47 | r2 = solve(-a[0]/a[0],-a[0]/a[0],abs(a[0])+1);
| ~~~^~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s317532915 | p03741 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
int main(){
int n,s=0,sum=0,pum=0,pre;
cin>>n;
int a[n],b[n];
r(i,n)cin>>a[i];
b[0]=a[0];
for(int i=1;i<n;i++){
b[i]=a[i]+b[i-1];
if(b[i]==0){
if(b[i-1]<0)b[i]++,sum++;
else b[i]--,sum++;
}
if(b[i]>=0&&b[i-1]>=0){
while(b[i]>=0)b[i]--,sum++;
}
if(b[i]<0&&b[i-1]<0){
while(b[i]<=0)b[i]++,sum++;
}
//cout<<sum<<endl;
}
cout<<sum<<endl;
} | cc1plus: error: '::main' must return 'int'
|
s349574584 | p03741 | C++ | #include<bits/stdc++.h>
#define mk make_pair
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
main(){
n,s=0,sum=0,pum=0,pre;
cin>>n;
int a[n],b[n];
r(i,n)cin>>a[i];
b[0]=a[0];
for(int i=1;i<n;i++){
b[i]=a[i]+b[i-1];
if(b[i]==0){
if(b[i-1]<0)b[i]++,sum++;
else b[i]--,sum++;
}
if(b[i]>=0&&b[i-1]>=0){
while(b[i]>=0)b[i]--,sum++;
}
if(b[i]<0&&b[i-1]<0){
while(b[i]<=0)b[i]++,sum++;
}
//cout<<sum<<endl;
}
cout<<sum<<endl;
} | a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:7:4: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | n,s=0,sum=0,pum=0,pre;
| ^
| yn
a.cc:7:6: error: 's' was not declared in this scope
7 | n,s=0,sum=0,pum=0,pre;
| ^
a.cc:7:10: error: 'sum' was not declared in this scope
7 | n,s=0,sum=0,pum=0,pre;
| ^~~
a.cc:7:16: error: 'pum' was not declared in this scope
7 | n,s=0,sum=0,pum=0,pre;
| ^~~
a.cc:7:22: error: 'pre' was not declared in this scope; did you mean 'pread'?
7 | n,s=0,sum=0,pum=0,pre;
| ^~~
| pread
a.cc:10:14: error: 'a' was not declared in this scope
10 | r(i,n)cin>>a[i];
| ^
a.cc:11:3: error: 'b' was not declared in this scope
11 | b[0]=a[0];
| ^
a.cc:11:8: error: 'a' was not declared in this scope
11 | b[0]=a[0];
| ^
|
s386336383 | p03741 | C++ | #include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) For(i,0,n)
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
int main() {
int n;
cin >> n;
vector<ll> v(n);
rep(i, n)
cin >> v[i];
ll result = 0;
ll goukei = v[0];
if (v[0] != 0){
bool upper = false;
ll result1 = 0;
if(v[0] < 0){
upper = true;
}
For(i, 1, n) {
goukei += v[i];
if (upper) {
if (goukei <= 0){
result += (1 - goukei);
goukei = 1;
}
upper = false;
}
else {
if (goukei >= 0){
result += (1 + goukei);
goukei = -1;
}
upper = true;
}
// cout << goukei << " : " << result1 << endl;
}
}else{
v[0]= 1;
ll goukei = v[0];
bool upper = false;
ll result1 = 0;
if(v[0] < 0){
upper = true;
}
For(i, 1, n) {
goukei += v[i];
if (upper) {
if (goukei <= 0){
result1 += (1 - goukei);
goukei = 1;
}
upper = false;
}
else {
if (goukei >= 0){
result1 += (1 + goukei);
goukei = -1;
}
upper = true;
| a.cc: In function 'int main()':
a.cc:96:38: error: expected '}' at end of input
96 | upper = true;
| ^
a.cc:91:22: note: to match this '{'
91 | else {
| ^
a.cc:96:38: error: expected '}' at end of input
96 | upper = true;
| ^
a.cc:82:22: note: to match this '{'
82 | For(i, 1, n) {
| ^
a.cc:96:38: error: expected '}' at end of input
96 | upper = true;
| ^
a.cc:74:14: note: to match this '{'
74 | }else{
| ^
a.cc:96:38: error: expected '}' at end of input
96 | upper = true;
| ^
a.cc:41:12: note: to match this '{'
41 | int main() {
| ^
|
s990311577 | p03741 | C++ | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool ok(ll a, ll b) {
if (a < 0 && b > 0) return true;
if (a > 0 && b < 0) return true;
return false;
}
int n;
vector<ll> a;
ll f(vector<ll> a, ll d) {
a[0] -= d;
ll sum = a[0];
ll ans = abs(d);
if (sum == 0) return INF;
rep(i, n) if (i) {
if (!ok(sum, sum + a[i])) {
if (sum + a[i] == 0) {
ll t;
if (sum > 0)
t = sum + a[i] + 1;
else
t = sum + a[i] - 1;
ans += abs(t);
a[i] -= t;
} else if (sum + a[i] > 0) {
ll t = sum + 1 + a[i];
ans += abs(t);
a[i] -= t;
} else {
ll t = sum + a[i] - 1;
ans += abs(t);
a[i] -= t;
}
}
sum += a[i];
assert(sum != 0);
}
rep(i, n) cout << a[i] << " ";
cout << endl;
cout << ans << endl;
return ans;
}
int main() {
cin >> n;
a.resize(n);
rep(i, n) cin >> a[i];
ll ans = f(a, 0);
ans = min(ans, f(a, a[0] + 1));
ans = min(ans, f(a, a[0] - 1));
cout << ans << endl;
return 0;
}
| a.cc: In function 'll f(std::vector<long long int>, ll)':
a.cc:63:9: error: 'assert' was not declared in this scope
63 | assert(sum != 0);
| ^~~~~~
a.cc:11:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
10 | #include <sstream>
+++ |+#include <cassert>
11 | #include <string>
|
s902590283 | p03741 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
ll solve(vector<ll>& a, int n){
ll ans = 0, s = a[0];
for(int i=1;i<n;i++){
ll s_next = s + a[i];
if(s < 0){
// cout << s_next << " " << a[i] << endl;
ll diff = 0;
if(s_next <= 0){
diff = -s_next + 1;
}
s_next += diff;
ans += diff;
// cout << s_next << " " << diff << endl;
assert(s_next > 0);
}else{
// cout << s_next << " " << a[i] << endl;
ll diff = 0;
if(s_next >= 0){
diff = s_next + 1;
}
s_next -= diff;
ans += diff;
// cout << s_next << " " << diff << endl;
assert(s_next < 0);
}
s = s_next;
// cout << ans << endl;
}
return ans;
}
int main(){
int n;
cin >> n;
vector<ll> a(n+1);
for(int i=1;i<=n;i++){
cin >> a[i];
}
ll ans;
a[0] = -1;
ll ans = solve(a, n+1);
a[0] = 1;
ans = min(ans, solve(a, n+1));
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:49:12: error: redeclaration of 'll ans'
49 | ll ans = solve(a, n+1);
| ^~~
a.cc:47:12: note: 'll ans' previously declared here
47 | ll ans;
| ^~~
|
s270900976 | p03741 | C++ | #include<stdio.h>
int main(void){
long long int x,y;
scanf("%lld %lld",&x,&y);
if(abs(x-y)<=1){printf("Brown\n");}
else{printf("Alice\n");}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:12: error: 'abs' was not declared in this scope
5 | if(abs(x-y)<=1){printf("Brown\n");}
| ^~~
|
s190522050 | p03741 | C++ | #include<iostream>
#include<vector>
#include<utility>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;
#define pb push_back
#define mod 1000000007
#define inf 999999999
#define rep(i, n) for(int i = 0; i < (n); i++)
#define For(i, a, n) for(int i = a; i < (n); i++)
#define out(n) cout << n << endl;
#define vut(v) rep(i, v.size()) out(v[i]);
int main(){
int n, ans = 0;
cin >> n;
ll a(n);
rep(i, n) cin >> a[i];
int gou = a[0];
int flag = gou < 0 ? -1 : 1;
For(i, 1, n) {
gou += a[i];
if(flag == 1) {
if(gou < 0 && i < n - 1 && gou + a[i + 1] < 0) {
while(gou + a[i + 1] > 0 && gou < 0) {
gou++;
ans++;
}
}
while(gou >= 0) {
ans++;
gou--;
}
flag = -1;
}else {
if(gou > 0 && i < n - 1 && gou + a[i + 1] > 0) {
while(gou + a[i + 1] < 0 && gou > 0) {
gou--;
ans++;
}
}
while(gou <= 0) {
ans++;
gou++;
}
flag = 1;
}
}
out(ans);
}
| a.cc: In function 'int main()':
a.cc:26:21: error: invalid types 'll {aka long long int}[int]' for array subscript
26 | rep(i, n) cin >> a[i];
| ^
a.cc:28:14: error: invalid types 'll {aka long long int}[int]' for array subscript
28 | int gou = a[0];
| ^
a.cc:32:13: error: invalid types 'll {aka long long int}[int]' for array subscript
32 | gou += a[i];
| ^
a.cc:34:41: error: invalid types 'll {aka long long int}[int]' for array subscript
34 | if(gou < 0 && i < n - 1 && gou + a[i + 1] < 0) {
| ^
a.cc:35:22: error: invalid types 'll {aka long long int}[int]' for array subscript
35 | while(gou + a[i + 1] > 0 && gou < 0) {
| ^
a.cc:46:41: error: invalid types 'll {aka long long int}[int]' for array subscript
46 | if(gou > 0 && i < n - 1 && gou + a[i + 1] > 0) {
| ^
a.cc:47:22: error: invalid types 'll {aka long long int}[int]' for array subscript
47 | while(gou + a[i + 1] < 0 && gou > 0) {
| ^
|
s807514416 | p03741 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
lint main()
{
ll n; cin >> n;
vector<ll>a(n);
vector<ll>rui(n);
for (ll i = 0; i < n; i++) {
cin >> a[i];
if (i)rui[i] += rui[i - 1] + a[i];
else rui[i] = a[i];
}
vector<ll>tmp = rui;
ll pm;
ll b;
if (rui[0] == 0) {
rui = tmp;
rui[0] = 1;
pm = 1;
b = 1;
ll cnt1 = 1;
for (ll i = 1; i < n; i++) {
if (rui[i] + b > 0 && rui[i - 1] + b > 0) {
cnt1 += rui[i] + b + 1;
b -= rui[i] + b + 1;
pm = -1;
}
else if (rui[i] + b < 0 && rui[i - 1] + b < 0) {
cnt1 -= rui[i] + b - 1;
b -= rui[i] + b - 1;
pm = 1;
}
else if (rui[i]+b == 0) {
if (pm == 1) {
rui[i] = -1;
b--;
cnt1++;
pm = -1;
}
else if (pm == -1) {
rui[i] = 1;
b++;
cnt1++;
pm = 1;
}
}
else if (rui[i]+b > 0)pm = 1;
else if (rui[i]+b < 0)pm = -1;
}
rui = tmp;
rui[0] = -1;
pm = -1;
b = -1;
ll cnt2 = 1;
for (ll i = 1; i < n; i++) {
if (rui[i] + b > 0 && rui[i - 1] + b > 0) {
cnt2 += rui[i] + b + 1;
b -= rui[i] + b + 1;
pm = -1;
}
else if (rui[i] + b < 0 && rui[i - 1] + b < 0) {
cnt2 -= rui[i] + b - 1;
b -= rui[i] + b - 1;
pm = 1;
}
else if (rui[i]+b == 0) {
if (pm == 1) {
rui[i] = -1;
b--;
cnt2++;
pm = -1;
}
else if (pm == -1) {
rui[i] = 1;
b++;
cnt2++;
pm = 1;
}
}
else if (rui[i]+b > 0)pm = 1;
else if (rui[i]+b < 0)pm = -1;
}
cout << min(cnt1, cnt2) << endl;
}
else {
if(rui[0]>0)pm = 1;
else pm = -1;
b = 0;
ll cnt = 0;
for (ll i = 1; i < n; i++) {
if (rui[i]+b > 0 && rui[i - 1] + b > 0) {
cnt += rui[i] + b + 1;
b -= rui[i]+b + 1;
pm = -1;
}
else if (rui[i]+b < 0 && rui[i - 1]+b < 0) {
cnt -= rui[i] + b - 1;
b -= rui[i]+b - 1;
pm = 1;
}
else if (rui[i]+b == 0) {
if (pm == 1) {
rui[i] = -1;
b--;
cnt++;
pm = -1;
}
else if (pm == -1) {
rui[i] = 1;
b++;
cnt++;
pm = 1;
}
}
else if (rui[i]+b > 0)pm = 1;
else if (rui[i]+b < 0)pm = -1;
}
cout << cnt << endl;
}
return 0;
}
| a.cc:8:1: error: 'lint' does not name a type; did you mean 'uint'?
8 | lint main()
| ^~~~
| uint
|
s693263035 | p03741 | Java | import java.util.*;
import java.io.*;
public class Sequence {
public static void main(String [] args) {
Reader in = new Reader ();
Writer out = new Writer ();
int n = in.nextInt();
int [] a = new int [n + 5];
for(int i = 1; i <= n; i++) {
a[i] = in.nextInt();
}
long ans = (long) 1e16;
for(int cs = 0; cs <= 1; cs++) {
int pos = cs;
long sum = 0;
long res = 0;
for(int i = 1; i <= n; i++) {
if(pos == 1) {
long can = -sum + 1;
if(a[i] >= can) sum += a[i];
else {
res += Math.abs(can - a[i]);
sum += can;
}
} else {
long can = -sum - 1;
if(a[i] <= can) sum += a[i];
else {
res += Math.abs(can - a[i]);
sum += can;
}
}
pos ^= 1;
}
ans = Math.min(ans, res);
}
System.out.println(ans);
}
static class Reader {
private StringTokenizer a;
private BufferedReader b;
Reader () {
a = null;
b = new BufferedReader (new InputStreamReader (System.in));
}
public String next () {
while(a == null || !a.hasMoreTokens()) {
try {
a = new StringTokenizer (b.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return a.nextToken();
}
public int nextInt() {
return Integer.parseInt(this.next());
}
public long nextLong () {
return Long.parseLong(this.next());
}
public double nextDouble () {
return Double.parseDouble(this.next());
}
public String nextLine() {
try {
return b.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
}
static class Writer {
private PrintWriter a;
private StringBuffer b;
Writer () {
a = new PrintWriter (System.out);
b = new StringBuffer ("");
}
public void write (Object s) {
b.append(s);
}
public void writeln(Object s) {
b.append(s).append('\n');
}
public void flush () {
a.print(b);
a.flush();
a.close();
}
}
static class Pair implements Comparator <Pair> {
int first;
int second;
Pair (int a, int b) {
this.first = a;
this.second = b;
}
Pair (Pair a) {
this.first = a.first;
this.second = a.second;
}
Pair () {}
public String toString () {
return "[" + first + ", " + second + "]";
}
public int compare (Pair a, Pair b) {
if(a.first == b.first) {
return a.second - b.second;
} else {
return a.first - b.first;
}
}
}
}
| Main.java:4: error: class Sequence is public, should be declared in a file named Sequence.java
public class Sequence {
^
1 error
|
s277025933 | p03741 | 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 MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
ll a[1000001];
int main(void){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
}
ll res=0;
bool flag=true;
ll now=0;
for(int i=0;i<n;i++){
if(now==0){
now+=a[i];
if(now==0){
now++;
res++;
}else if(now<0){
ll b=-now+1LL;
res+=b;
now=1;
}
}else if(now>0){
if(now+a[i]<0){
now=now+a[i];
}else{
ll b=now+a[i]+1LL;
now=-1;
res+=b;
}
}else{
if(now+a[i]>0){
now=now+a[i];
}else{
ll b=-(now+a[i])+1LL;
now=1;
res+=b;
}
}
}
ll ans=res;
res=0;
now=0;
for(int i=0;i<n;i++){
if(now==0){
now+=a[i];
if(now==0){
now--;
res++;
}else if(now>0){
ll b=now+1LL;
res+=b;
now=-1;
}
}else if(now>0){
if(now+a[i]<0){
now=now+a[i];
}else{
ll b=now+a[i]+1LL;
now=-1;
res+=b;
}
}else{
if(now+a[i]>0){
now=now+a[i];
}else{
ll b=-(now+a[i])+1LL;
now=1;
res+=b;
}
}
}
ans=min(res,ans);
printf("%lld\n",ans);
return 0;
} | a.cc:17:1: error: extended character is not valid in an identifier
17 |
| ^
a.cc:20:1: error: extended character is not valid in an identifier
20 |
| ^
a.cc:17:1: error: '\U000000a0' does not name a type
17 |
| ^
a.cc:20:1: error: '\U000000a0' does not name a type
20 |
| ^
|
s299839102 | p03741 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int n, a[100010];
int main(){
while(scanf("%d", &n)!=EOF){
for(int i=0; i<n; i++){
scanf("%d", &a[i]);
//b[i] = a[i];
}
int sum=0, ans=0;
for(int i=0; i<n; i++){
sum += a[i];
if((i%2)==0){
if(sum<=0){
ans += 1-sum;
sum = 1;
}
}
else{
if(sum>=0){
ans += sum+1;
sum = -1;
}
}
}
int ans2 = ans;
sum = 0; ans = 0;
for(int i=0; i<n; i++){
sum += a[i];
if(i%2){
if(sum<=0){a
ans += 1-sum;
sum = 1;
}
}
else{
if(sum>=0){
ans += sum+1;
sum = -1;
}
}
}
ans2= min(ans, ans2);
printf("%d\n", ans2);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:45: error: expected ';' before 'ans'
40 | if(sum<=0){a
| ^
| ;
41 | ans += 1-sum;
| ~~~
|
s261114855 | p03741 | Java | //package ap;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import ap.one.InputReader;
//import ap.one.pair;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
InputReader scnr = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int n=scnr.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++){
ar[i]=scnr.nextInt();
}
int ct1=0;
int sum=0;
int ct=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<=0){
temp=Math.max(temp,1);
ct+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct+=Math.abs(temp-x);
sum=temp;
}
}
sum=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<0){
temp=Math.max(temp,1);
ct1+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct1+=Math.abs(temp-x);
sum=temp;
}
}
out.println(Math.min(ct1, ct));
out.close();
}
static class pair implements Comparable<pair> {
int val;
int index;
@Override
public int compareTo(pair arg0) {
// TODO Auto-generated method stub
return -1 * (this.val - arg0.val);
}
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream st) {
this.stream = st;
}
public int read() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public String readString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
}
}
| Main.java:8: error: package ap.one does not exist
import ap.one.InputReader;
^
1 error
|
s085016415 | p03741 | Java | //package ap;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import ap.one.InputReader;
import ap.one.pair;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
InputReader scnr = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int n=scnr.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++){
ar[i]=scnr.nextInt();
}
int ct1=0;
int sum=0;
int ct=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<=0){
temp=Math.max(temp,1);
ct+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct+=Math.abs(temp-x);
sum=temp;
}
}
sum=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<0){
temp=Math.max(temp,1);
ct1+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct1+=Math.abs(temp-x);
sum=temp;
}
}
out.println(Math.min(ct1, ct));
out.close();
}
static class pair implements Comparable<pair> {
int val;
int index;
@Override
public int compareTo(pair arg0) {
// TODO Auto-generated method stub
return -1 * (this.val - arg0.val);
}
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream st) {
this.stream = st;
}
public int read() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public String readString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
}
}
| Main.java:8: error: package ap.one does not exist
import ap.one.InputReader;
^
Main.java:9: error: package ap.one does not exist
import ap.one.pair;
^
2 errors
|
s018920838 | p03741 | Java | //package ap;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import ap.one.InputReader;
import ap.one.pair;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
InputReader scnr = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int n=scnr.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++){
ar[i]=scnr.nextInt();
}
int ct1=0;
int sum=0;
int ct=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<=0){
temp=Math.max(temp,1);
ct+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct+=Math.abs(temp-x);
sum=temp;
}
}
sum=0;
for(int i=0;i<n;i++){
int temp=ar[i];
temp=temp+sum;
int x=temp;
if(sum<0){
temp=Math.max(temp,1);
ct1+=Math.abs(temp-x);
sum=temp;
}
else{
temp=Math.min(temp,-1);
ct1+=Math.abs(temp-x);
sum=temp;
}
}
out.println(Math.min(ct1, ct));
out.close();
}
static class pair implements Comparable<pair> {
int val;
int index;
@Override
public int compareTo(pair arg0) {
// TODO Auto-generated method stub
return -1 * (this.val - arg0.val);
}
}
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream st) {
this.stream = st;
}
public int read() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public int[] nextIntArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
public String readString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
}
}
| Main.java:8: error: package ap.one does not exist
import ap.one.InputReader;
^
Main.java:9: error: package ap.one does not exist
import ap.one.pair;
^
2 errors
|
s360555430 | p03741 | C++ | #include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
using namespace std;
LL solve(const vector<LL> &a, bool plus){
LL res = 0;
LL sum = 0;
int n = a.size();
REP(i, n){
sum += a[i];
if(plus){
if(sum <= 0){
res += 1LL - sum;
sum = 1LL;
}
}else{
if(sum >= 0){
res -= -1LL - sum;
sum = -1LL;
}
}
//cout << sum << endl;
plus = !plus;
}
return res;
}
int main(){
int n;
cin >> n;
vector<LL> a(n);
REP(i, n)cin >> a[i];
LL res = min(solve(a, true), solve(a, false));
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:49:5: error: 'cin' was not declared in this scope
49 | cin >> n;
| ^~~
a.cc:15:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
14 | #include <cstring>
+++ |+#include <iostream>
15 |
a.cc:53:5: error: 'cout' was not declared in this scope
53 | cout << res << endl;
| ^~~~
a.cc:53:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s905978099 | p03741 | C | #include<stdio.h>
long a[100000];
int main(int argc, char const *argv[]){
long a,sum,bsum,ans=0,n,i,f=0,min=1;
scanf("%ld",&n);
scanf("%ld",&a[0]);
if(a[0]==0){
ans++;
sum=1;
f=1;
}else sum=a[0];
for(i=1;i<n;i++){
scanf("%ld",&a[i]);
bsum=sum;
sum+=a[i];
if(bsum>0){
if(sum>=0){
ans+=sum+1;
sum-=1;
}else{
if(sum<=0){
ans+=1-sum;
sum=1;
}
}
}
if(f==1){
sum=-1;
for(i=1;i<n;i++){
bsum=sum;
sum+=a[i];
if(bsum>0){
if(sum>=0){
min+=sum+1;
sum-=1;
}else{
if(sum<=0){
min+=1-sum;
sum=1;
}
}
}
if(ans<min) printf("%ld\n",ans);
else printf("%ld\n",min);
}else{
printf("%ld\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:7:23: error: subscripted value is neither array nor pointer nor vector
7 | scanf("%ld",&a[0]);
| ^
main.c:8:13: error: subscripted value is neither array nor pointer nor vector
8 | if(a[0]==0){
| ^
main.c:12:20: error: subscripted value is neither array nor pointer nor vector
12 | }else sum=a[0];
| ^
main.c:14:31: error: subscripted value is neither array nor pointer nor vector
14 | scanf("%ld",&a[i]);
| ^
main.c:16:23: error: subscripted value is neither array nor pointer nor vector
16 | sum+=a[i];
| ^
main.c:32:31: error: subscripted value is neither array nor pointer nor vector
32 | sum+=a[i];
| ^
main.c:46:10: error: expected '}' before 'else'
46 | }else{
| ^~~~
main.c:50:1: error: expected declaration or statement at end of input
50 | }
| ^
|
s414822168 | p03741 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int n;
cin >> n;
vector< int > a;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int cnt = 0;
int sum = 0;
for (int i = 0; i < n; ++i) {
if (i == 0 && a[0] == 0) {
if (a[1] > 0) {
cnt++;
a[0] = -1;
sum = -1;
} else {
cnt++;
a[0] = 1;
sum = 1;
}
continue;
} else if (i == 0) {
sum = a[0];
continue;
}
if (sum * (sum+a[i]) >= 0) {
if (sum > 0) {
cnt += abs(sum+a[i], -1);
sum = -1;
} else {
cnt += abs(sum+a[i], 1);
sum = 1;
}
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:36:19: error: no matching function for call to 'abs(int, int)'
36 | cnt += abs(sum+a[i], -1);
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
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/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/stdlib.h:980:12: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate expects 1 argument, 2 provided
a.cc:39:19: error: no matching function for call to 'abs(int, int)'
39 | cnt += abs(sum+a[i], 1);
| ~~~^~~~~~~~~~~~~
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/stdlib.h:980:12: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate expects 1 argument, 2 provided
|
s382433214 | p03741 | C++ | #include <iostream>
using namespace std;
int main(void)
{
int n;
cin >> n;
vector< int > a;
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int cnt = 0;
int sum = 0;
for (int i = 0; i < n; ++i) {
if (i == 0 && a[0] == 0) {
if (a[1] > 0) {
cnt++;
a[0] = -1;
sum = -1;
} else {
cnt++;
a[0] = 1;
sum = 1;
}
continue;
} else if (i == 0) {
sum = a[0];
continue;
}
if (sum * (sum+a[i]) >= 0) {
if (sum > 0) {
cnt += abs(sum+a[i], -1);
sum = -1;
} else {
cnt += abs(sum+a[i], 1);
sum = 1;
}
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
9 | vector< int > a;
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:9:11: error: expected primary-expression before 'int'
9 | vector< int > a;
| ^~~
a.cc:11:12: error: 'a' was not declared in this scope
11 | cin >> a[i];
| ^
a.cc:18:19: error: 'a' was not declared in this scope
18 | if (i == 0 && a[0] == 0) {
| ^
a.cc:33:20: error: 'a' was not declared in this scope
33 | if (sum * (sum+a[i]) >= 0) {
| ^
|
s531855514 | p03741 | Java | import java.io.*;
import java.util.*;
public class C
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Integer.parseInt(br.readLine()), ans = 0;
StringTokenizer st = new StringTokenizer(br.readLine());
long sum = Long.parseLong(st.nextToken());
for(int i = 0; i < n-1; i++)
{
long num = Long.parseLong(st.nextToken());
if(sum > 0)
{
sum += num;
if(sum >= 0)
{
ans += sum + 1;
sum = -1;
}
}
else if(sum < 0)
{
sum += num;
if(sum <= 0)
{
ans += -sum + 1;
sum = 1;
}
}
}
pw.println(ans);
br.close();
pw.close();
System.exit(0);
}
} | Main.java:4: error: class C is public, should be declared in a file named C.java
public class C
^
1 error
|
s133927401 | p03741 | C++ | use std::io;
use std::io::{Read, BufReader};
use std::cmp;
fn next_token<R: Read>(reader: &mut R) -> Vec<u8> {
let mut buf: [u8; 1] = [0];
let mut read_chars = false;
let mut ret: Vec<u8> = vec![];
loop {
if reader.read(&mut buf).unwrap() == 0 {
break;
} else {
if buf[0] == '\r' as u8 || buf[0] == '\n' as u8 || buf[0] == ' ' as u8 {
if read_chars {
break;
}
} else {
read_chars = true;
ret.push(buf[0]);
}
}
};
ret
}
fn next_i64<R: Read>(reader: &mut R) -> i64 {
let token = next_token(reader);
let mut ret: i64 = 0;
let mut sgn = false;
for c in token {
if '0' as u8 <= c && c <= '9' as u8 {
ret = ret * 10 + (c - ('0' as u8)) as i64;
} else if '-' as u8 == c {
sgn = true;
}
};
ret * if sgn { -1 } else { 1 }
}
fn next_i32<R: Read>(reader: &mut R) -> i32 {
next_i64(reader) as i32
}
fn main() {
let buf = &mut BufReader::new(io::stdin());
let n = next_i32(buf);
let mut a = vec![];
for _ in 0..n {
a.push(next_i32(buf));
}
let mut ret1 = 0;
let mut sum = 0;
for i in 0..n {
sum += a[i as usize];
if i % 2 == 0 {
// target: +
let diff = cmp::max(0, 1 - sum);
sum += diff;
ret1 += diff;
} else {
// target: -
let diff = cmp::max(0, sum + 1);
sum -= diff;
ret1 += diff;
}
// println!("{} {}", ret1, sum);
}
let mut ret2 = 0;
let mut sum = 0;
for i in 0..n {
sum += a[i as usize];
if i % 2 == 1 {
// target: +
let diff = cmp::max(0, 1 - sum);
sum += diff;
ret2 += diff;
} else {
// target: -
let diff = cmp::max(0, sum + 1);
sum -= diff;
ret2 += diff;
}
}
println!("{}", cmp::min(ret1, ret2));
}
| a.cc:49:14: error: too many decimal points in number
49 | for _ in 0..n {
| ^~~~
a.cc:55:14: error: too many decimal points in number
55 | for i in 0..n {
| ^~~~
a.cc:72:14: error: too many decimal points in number
72 | for i in 0..n {
| ^~~~
a.cc:1:1: error: 'use' does not name a type
1 | use std::io;
| ^~~
a.cc:2:1: error: 'use' does not name a type
2 | use std::io::{Read, BufReader};
| ^~~
a.cc:3:1: error: 'use' does not name a type
3 | use std::cmp;
| ^~~
a.cc:5:1: error: 'fn' does not name a type
5 | fn next_token<R: Read>(reader: &mut R) -> Vec<u8> {
| ^~
a.cc:26:1: error: 'fn' does not name a type
26 | fn next_i64<R: Read>(reader: &mut R) -> i64 {
| ^~
a.cc:40:1: error: 'fn' does not name a type
40 | fn next_i32<R: Read>(reader: &mut R) -> i32 {
| ^~
a.cc:44:1: error: 'fn' does not name a type
44 | fn main() {
| ^~
|
s860099653 | p03742 | C++ | #include <iostream>
int main() {
long long a,b;
std::cin >> a >> b;
if(abs(a-b)<=1){
std::cout << "Brown" << endl;
}
else{
std::cout << "Alice" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
7 | std::cout << "Brown" << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:10:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | std::cout << "Alice" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s242447289 | p03742 | C++ | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define Pause system("pause")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main()
{
IOS;
ull x,y,cnt0=0,cnt1=0;
cin>>x>>y;
if(abs(x-y)>1)
cout<<"Alice";
else
cout<<"Brown";
return 0;
} | a.cc: In function 'int main()':
a.cc:21:11: error: call of overloaded 'abs(ull)' is ambiguous
21 | if(abs(x-y)>1)
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/bits/stl_algo.h:71,
from /usr/include/c++/14/algorithm:61,
from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s074787540 | p03742 | C++ | #include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define Pause system("pause")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main()
{
IOS;
ull x,y,cnt0=0,cnt1=0;
cin>>x>>y;
if(abs(x-y)>1)
cout<<"Alice";
else
cout<<"Brown";
return 0;
}
| a.cc: In function 'int main()':
a.cc:21:11: error: call of overloaded 'abs(ull)' is ambiguous
21 | if(abs(x-y)>1)
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/bits/stl_algo.h:71,
from /usr/include/c++/14/algorithm:61,
from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s975491219 | p03742 | C++ |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll N = 300030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod = 1e9+7;
int main()
{ fast
ll n,m;
cin>>n>>m;
if(abs(p-q)>1)
cout<<"Alice";
else
cout<<"Brown";
}
| a.cc: In function 'int main()':
a.cc:19:8: error: 'p' was not declared in this scope
19 | if(abs(p-q)>1)
| ^
a.cc:19:10: error: 'q' was not declared in this scope
19 | if(abs(p-q)>1)
| ^
|
s585277568 | p03742 | C++ | #include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
int main () {
ll x, y;
cin >> x >> y;
if (fabs(x, y) <= 1) cout << "Brown\n";
else cout << "Alice\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:13: error: no matching function for call to 'fabs(ll&, ll&)'
10 | if (fabs(x, y) <= 1) cout << "Brown\n";
| ~~~~^~~~~~
In file included from a.cc:2:
/usr/include/c++/14/cmath:250:5: note: candidate: 'template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::fabs(_Tp)'
250 | fabs(_Tp __x)
| ^~~~
/usr/include/c++/14/cmath:250:5: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/bits/requires_hosted.h:31,
from /usr/include/c++/14/iostream:38,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note: candidate: 'double fabs(double)'
195 | __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
| ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:195:1: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:242:3: note: candidate: 'constexpr long double std::fabs(long double)'
242 | fabs(long double __x)
| ^~~~
/usr/include/c++/14/cmath:242:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/cmath:238:3: note: candidate: 'constexpr float std::fabs(float)'
238 | fabs(float __x)
| ^~~~
/usr/include/c++/14/cmath:238:3: note: candidate expects 1 argument, 2 provided
|
s471814323 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
cerr << H << ' ';
dout(T...);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
if (abs(x - y) > 1)
cout << "Alice\n";
else
cout << "Brown\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:35:13: error: 'x' was not declared in this scope
35 | if (abs(x - y) > 1)
| ^
a.cc:35:17: error: 'y' was not declared in this scope
35 | if (abs(x - y) > 1)
| ^
|
s801165770 | p03742 | C++ | #include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int main() {
LL X, Y;
scanf("%lld %lld", &X, &Y);
if (abs(X, Y) < 2) puts("Brown");
else puts("Alice");
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:12: error: no matching function for call to 'abs(LL&, LL&)'
24 | if (abs(X, Y) < 2) puts("Brown");
| ~~~^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
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:2:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/stdlib.h:980:12: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate expects 1 argument, 2 provided
|
s285666121 | p03742 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
ll X, Y;
int main(){
cin >> X >> Y;
if(abs(X - Y) <= 1){
cout << "Brown" << endl;
}else cout << "Alice" << endl;
return 0;
} | a.cc:6:1: error: 'll' does not name a type
6 | ll X, Y;
| ^~
a.cc: In function 'int main()':
a.cc:9:16: error: 'X' was not declared in this scope
9 | cin >> X >> Y;
| ^
a.cc:9:21: error: 'Y' was not declared in this scope
9 | cin >> X >> Y;
| ^
|
s418731112 | p03742 | C++ |
※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const ll INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
const ll MAX = 1e6;
ll modpow(ll x, ll b){
ll res = 1;
while(b){
if(b&1)res = res * x % MOD;
x = x * x % MOD;
b>>=1;
}
return res;
}
ll modinv(ll x){
return modpow(x, MOD-2);
}
int main(){
ll a, b;
cin >> a >> b;
cout << (abs(a-b)<=1?"Brown":"Alice") << endl;
return 0;
}
| a.cc:2:1: error: extended character ※ is not valid in an identifier
2 | ※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
| ^
a.cc:2:3: error: extended character 「 is not valid in an identifier
2 | ※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
| ^
a.cc:2:24: error: extended character 」 is not valid in an identifier
2 | ※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
| ^
a.cc:2:36: error: stray '#' in program
2 | ※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
| ^
a.cc:2:1: error: '\U0000203b' does not name a type
2 | ※ ソースコードは「Main.拡張子」で保#include<bits/stdc++.h>
| ^
a.cc: In function 'long long int modpow(long long int, long long int)':
a.cc:24:40: error: 'MOD' was not declared in this scope
24 | if(b&1)res = res * x % MOD;
| ^~~
a.cc:25:29: error: 'MOD' was not declared in this scope
25 | x = x * x % MOD;
| ^~~
a.cc: In function 'long long int modinv(long long int)':
a.cc:32:26: error: 'MOD' was not declared in this scope
32 | return modpow(x, MOD-2);
| ^~~
a.cc: In function 'int main()':
a.cc:37:9: error: 'cin' was not declared in this scope
37 | cin >> a >> b;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 |
a.cc:40:9: error: 'cout' was not declared in this scope
40 | cout << (abs(a-b)<=1?"Brown":"Alice") << endl;
| ^~~~
a.cc:40:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:18: error: 'abs' was not declared in this scope
40 | cout << (abs(a-b)<=1?"Brown":"Alice") << endl;
| ^~~
a.cc:40:50: error: 'endl' was not declared in this scope
40 | cout << (abs(a-b)<=1?"Brown":"Alice") << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 |
|
s062939493 | p03742 | C++ | #include <iostream>
using namespace std;
int main(){
long long x,y;
cin >> x >> y;
if(x<y) swap(x,y);
if((x==1&&y==0) || (x==1&&y==1) || (x==2&&y==1) || (X==0&&y==0)) cout << "Brown" << endl;
else cout << "Alice" << endl;
} | a.cc: In function 'int main()':
a.cc:7:57: error: 'X' was not declared in this scope
7 | if((x==1&&y==0) || (x==1&&y==1) || (x==2&&y==1) || (X==0&&y==0)) cout << "Brown" << endl;
| ^
|
s072208794 | p03742 | C++ |
Copy
Copy
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long
#define ull unsigned ll
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP1(i,n) for (int i=1;i<=(n);i++)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define pii pair<int,int>
#define f first
#define s second
#define SZ(x) x.size()
#define ALL(x) x.begin(), x.end()
#define ull unsigned ll
#define pb push_back
#define SQ(x) (x)*(x)
#define endl '\n'
using namespace std;
ll mod=1e9+7;
int main()
{
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ll x,y; cin>>x>>y;
if (abs(x-y)<=1) cout<<"Brown"<<endl;
else cout<<"Alice"<<endl;
} | a.cc:2:1: error: 'Copy' does not name a type
2 | Copy
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:4:
/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'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) 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)>
| ^~~~~~
/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_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/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/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/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/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/incl |
s987767684 | p03742 | C++ | #include <bits/stdc++.h
using namespace std:
int main () {
long long x, y;
cin >> x >> y;
if (abs (x - y) < 2)
cout << "Brown" << endl:
else
cout << "Alice" << endl;
return 0;
} | a.cc:1:24: error: missing terminating > character
1 | #include <bits/stdc++.h
| ^
a.cc:2:20: error: expected ';' before ':' token
2 | using namespace std:
| ^
| ;
a.cc:2:20: error: expected unqualified-id before ':' token
|
s509963684 | p03742 | C++ | #include<bits/stdc++.h>
typedef long long ll;
int main()
{
ll x,y;
cin>>x>>y;
if(abs(x-y)<=1)
{
cout<<"Brown"<<endl;
}
else
{
cout<<"Alice"<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>x>>y;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
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:10:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<"Brown"<<endl;
| ^~~~
| 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:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | cout<<"Brown"<<endl;
| ^~~~
| std::endl
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:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:14:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
14 | cout<<"Alice"<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:14:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
14 | cout<<"Alice"<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s639592063 | p03742 | C++ | #include<bits/stdc++.h>
typedef long long ll;
int main()
{
ll x,y;
cin>>x>>y;
if(abs(x-y)<=1)
{
cout<<"Brown"<<endl;
}
else
{
cout<<"Alice"<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>x>>y;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
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:10:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<"Brown"<<endl;
| ^~~~
| 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:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | cout<<"Brown"<<endl;
| ^~~~
| std::endl
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:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:14:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
14 | cout<<"Alice"<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:14:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
14 | cout<<"Alice"<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s390628549 | p03742 | C++ | #include <bits/stdc++.h>
typedef long long ll;
ll x, y;
int main()
{
scanf("%lld%lld", &x, &y);
printf("%s\n", max(0ll, x - 1) > y? "Alice" : "Brown");
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'max' was not declared in this scope; did you mean 'std::max'?
10 | printf("%s\n", max(0ll, x - 1) > y? "Alice" : "Brown");
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s241853559 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll long long;
int main() {
ll X,Y; cin >> X >> Y;
bool alice = (llabs(X-Y) >= 2);
cout << (alice ? "Alice" : "Brown") << endl;
return 0;
} | a.cc:4:7: error: expected nested-name-specifier before 'll'
4 | using ll long long;
| ^~
a.cc: In function 'int main()':
a.cc:7:5: error: 'll' was not declared in this scope
7 | ll X,Y; cin >> X >> Y;
| ^~
a.cc:7:20: error: 'X' was not declared in this scope
7 | ll X,Y; cin >> X >> Y;
| ^
a.cc:7:25: error: 'Y' was not declared in this scope
7 | ll X,Y; cin >> X >> Y;
| ^
|
s086057558 | p03742 | C++ | #include #include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b) ((a >> b) & 1)
#define bitset(a,b) ( a |= (1 << b))
#define bitunset(a,b) (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
struct Edge {
int from, to;
ll w;
};
typedef vector<vector<Edge>> Graph;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a%b);
}
bool BellmanFord(Graph g, int s, vector<ll>& dis) { //is huheiro aru
#define INF 10000000000000LL
fill(ALL(dis), INF);
dis[s] = 0;
REP(cc, g.size()*10) {
REP(v, g.size()) {
for (auto e : g[v]) {
if (cc >= g.size() && e.to == g.size()-1 && dis[e.to] > dis[e.from] + e.w) return 1;
dis[e.to] = min(dis[e.to], dis[e.from] + e.w);
}
}
}
return 0;
}
signed main(void) {
ll x, y;
cin >> x >> y;
cout << (abs(x-y) <= 1 ? "Alice" : "Brown") << endl;
return 0;
}
| a.cc:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include #include <iostream>
| ^
a.cc:69:9: warning: "INF" redefined
69 | #define INF 10000000000000LL
| ^~~
a.cc:54:9: note: this is the location of the previous definition
54 | #define INF 10000000000000000LL
| ^~~
a.cc: In function 'int main()':
a.cc:91:9: error: 'cin' was not declared in this scope
91 | cin >> x >> y;
| ^~~
a.cc:17:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
16 | #include <complex>
+++ |+#include <iostream>
17 | #include <unordered_map>
a.cc:93:9: error: 'cout' was not declared in this scope
93 | cout << (abs(x-y) <= 1 ? "Alice" : "Brown") << endl;
| ^~~~
a.cc:93:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s851658369 | p03742 | C++ | #include <iostream>
using namespace std;
int main(){
long long x,y;
cin >> x >> y;
abs(x-y)<=1? cout <<"Brown"<<endl : cout << "Alice" << endl; | a.cc: In function 'int main()':
a.cc:6:65: error: expected '}' at end of input
6 | abs(x-y)<=1? cout <<"Brown"<<endl : cout << "Alice" << endl;
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s864140619 | p03742 | C++ | int main()
{
long long X, Y;
std::cin>>X>>Y;
if (abs(X - Y) <= 1)
std::cout<<"Brown\n";
else
std::cout<<"Alice\n";
} | a.cc: In function 'int main()':
a.cc:4:10: error: 'cin' is not a member of 'std'
4 | std::cin>>X>>Y;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | int main()
a.cc:5:9: error: 'abs' was not declared in this scope
5 | if (abs(X - Y) <= 1)
| ^~~
a.cc:6:14: error: 'cout' is not a member of 'std'
6 | std::cout<<"Brown\n";
| ^~~~
a.cc:6:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:14: error: 'cout' is not a member of 'std'
8 | std::cout<<"Alice\n";
| ^~~~
a.cc:8:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s504895735 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long long int x,y;cin>>x>>y
string ans;
if(abs(x-y)<=1)ans='Brown';
else ans='Alice';
cout<<ans<<endl;
} | a.cc:6:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
6 | if(abs(x-y)<=1)ans='Brown';
| ^~~~~~~
a.cc:7:12: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
7 | else ans='Alice';
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:4:30: error: expected ';' before 'string'
4 | long long int x,y;cin>>x>>y
| ^
| ;
5 | string ans;
| ~~~~~~
a.cc:6:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
6 | if(abs(x-y)<=1)ans='Brown';
| ^~~
| abs
a.cc:7:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
7 | else ans='Alice';
| ^~~
| abs
a.cc:8:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
8 | cout<<ans<<endl;
| ^~~
| abs
|
s074523543 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long long int x,y;cin>>x>>y;
if(abs(x-y)<=1)ans='Brown';
else ans='Alice';
cout<<ans<<endl;
} | a.cc:5:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
5 | if(abs(x-y)<=1)ans='Brown';
| ^~~~~~~
a.cc:6:12: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
6 | else ans='Alice';
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
5 | if(abs(x-y)<=1)ans='Brown';
| ^~~
| abs
a.cc:6:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
6 | else ans='Alice';
| ^~~
| abs
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
7 | cout<<ans<<endl;
| ^~~
| abs
|
s417473882 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;cin>>x>>y;
if(abs(x-y)<=1)string ans="Brown";
else string ans="Alice";
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
7 | cout<<ans<<endl;
| ^~~
| abs
|
s361659949 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;cin>>x>>y;
if(abs(x-y)<=1)string ans='Brown';
else string ans='Alice';
cout<<ans<<endl;
}
| a.cc:5:29: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
5 | if(abs(x-y)<=1)string ans='Brown';
| ^~~~~~~
a.cc:6:19: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
6 | else string ans='Alice';
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:29: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | if(abs(x-y)<=1)string ans='Brown';
| ^~~~~~~
a.cc:6:19: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
6 | else string ans='Alice';
| ^~~~~~~
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
7 | cout<<ans<<endl;
| ^~~
| abs
|
s355215604 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;cin>>x>>y;
if(abs(x-y)<=1)ans='Brown';
else ans='Alice';
cout<<ans<<endl;
} | a.cc:5:22: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
5 | if(abs(x-y)<=1)ans='Brown';
| ^~~~~~~
a.cc:6:12: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
6 | else ans='Alice';
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
5 | if(abs(x-y)<=1)ans='Brown';
| ^~~
| abs
a.cc:6:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
6 | else ans='Alice';
| ^~~
| abs
a.cc:7:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
7 | cout<<ans<<endl;
| ^~~
| abs
|
s045350000 | p03742 | C++ | #include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
//#include <boost/multiprecision/cpp_int.hpp>
#define BIT(a) (1 << (a))
#define EPS (1e-10)
using namespace std;
//using namespace boost::multiprecision;
const long long MOD = 1000000007;
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;
class DisjointSet{
public:
vector<int> rank, p;
DisjointSet(){}
DisjointSet(int size){
rank.resize(size, 0);
p.resize(size, 0);
for (int i = 0; i < size; i++) makeSet(i);
}
void makeSet(int x){
p[x] = x;
rank[x] = 0;
}
bool same(int x, int y){
return findSet(x) == findSet(y);
}
void unite(int x, int y){
link(findSet(x), findSet(y));
}
void link(int x, int y){
if (rank[x] > rank[y]){
p[y] = x;
}else{
p[x] = y;
if (rank[x] == rank[y]){
rank[y]++;
}
}
}
int findSet(int x){
if (x != p[x]){
p[x] = findSet(p[x]);
}
return p[x];
}
};
class Point{
public:
double x, y;
Point(double x = 0, double y = 0): x(x), y(y) {}
Point operator+(Point p){return Point(x + p.x, y + p.y);}
Point operator-(Point p){return Point(x - p.x, y - p.y);}
Point operator*(double a){return Point(a * x, a * y);}
Point operator/(double a){return Point(x / a, y / a);}
bool operator < (const Point &p) const {
return y != p.y ? y < p.y : x < p.x;
}
double norm(){return x * x + y * y;}
};
typedef Point Vector;
typedef vector<Vector> Polygon;
double cross(Vector a, Vector b){
return a.x*b.y - a.y*b.x;
}
double dot(Vector a, Vector b){
return a.x * b.x + a.y * b.y;
}
int ccw(Point p0, Point p1, Point p2){
Vector a = p1 - p0;
Vector b = p2 - p0;
if (cross(a, b) > EPS)return COUNTER_CLOCKWISE;
if (cross(a, b) > -EPS)return CLOCKWISE;
if (dot(a, b) < -EPS)return ONLINE_BACK;
if (a.norm() < b.norm())return ONLINE_FRONT;
return ON_SEGMENT;
}
Polygon andrewScan(Polygon s){
Polygon u, l;
if (s.size() < 3) return s;
sort(s.begin(), s.end());
u.push_back(s[0]);
u.push_back(s[1]);
l.push_back(s[s.size()-1]);
l.push_back(s[s.size()-2]);
for (size_t i = 2; i < s.size(); i++){
for (size_t n = u.size(); n >= 2 && ccw(u[n-2], u[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
u.pop_back();
}
u.push_back(s[i]);
}
for (int i = (int)s.size() - 3; i >= 0; i--){
for (size_t n = l.size(); n >= 2 && ccw(l[n-2], l[n-1], s[i]) == COUNTER_CLOCKWISE; n--){
l.pop_back();
}
l.push_back(s[i]);
}
reverse(l.begin(), l.end());
for (size_t i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);
return l;
}
long long mod_pow(long long x, long long n){
long long res = 1;
for(int i = 0;i < 60; i++){
if(n >> i & 1) res = res * x % MOD;
x = x * x % MOD;
}
return res;
}
int main(void){
long long X, Y;
long long A, B;
cin >> X >> Y;
A = X;
B = Y;
for (int i = 0; i < 100; i++){
if (X/2){
if (i % 2){
A += X/2;
}else{
B += X/2;
}
X /= 2;
}else{
break;
}
}
for (int i = 0; i < 100; i++){
if (Y/2){
if (i % 2){
B += X/2;
}else{
A += X/2;
}
Y /= 2;
}else{
break;
}
}
if (A % 2) A--;
if (B % 2) B--;
if (A == B || ){
cout << "Brown" << endl;
}else{
cout << "Alice" << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:188:19: error: expected primary-expression before ')' token
188 | if (A == B || ){
| ^
|
s376445524 | p03742 | C++ | #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<bitset>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン!!!!
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
ll to, cost;
};
struct E {//辺の情報を入れる変数
ll from, to, cost;
};
bool operator<(E a, E b) {
return a.cost < b.cost;
}
struct H {
ll x, y;
};
bool operator<(H a, H b) {
if (a.x != b.x) return a.x < b.x;
return a.y < b.y;
}
bool operator>(H a, H b) {
if (a.x != b.x) return a.x > b.x;
return a.y > b.y;
}
bool operator==(H a, H b) {
return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
if (i > j) swap(i, j);
if (i == 0) return j;
return gcm(j%i, i);
}
ld rad(H a, H b) {
return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad=座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
return (a + b)*c / 2;
}//等差数列の和
ll fact(ll x, ll k, ll p) {//最大値、個数、あまり
ll sum = 1;
for (int i = 0; i < k; i++) {
sum *= (x--);
sum %= p;
}
return sum;
}//階乗(正)
ll mod_pow(ll x, ll n, ll p) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res*x%p;
x = x*x%p;
n >>= 1;
}
return res;
}//x^n%p
short ctos(char a) {
return (int)(a - '0');
}
#define int long long
const long long Inf = 4523372036854775807;
const int inf = 15000000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
int x, y;
cin >> x >> y;
if (abs(x, y) <= 1) cout << "Brown\n";
else cout << "Alice\n";
} | a.cc: In function 'int main()':
a.cc:97:16: error: no matching function for call to 'abs(long long int&, long long int&)'
97 | if (abs(x, y) <= 1) cout << "Brown\n";
| ~~~^~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
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/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
/usr/include/stdlib.h:980:12: note: candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate expects 1 argument, 2 provided
|
s247074585 | p03742 | C++ | #include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
struct edge{int to,cost;};
vector<int> G[100005];
long long int n,m,i,j=1,t;
long long int b,l;
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1,};
std::vector<P> tree[100010];
long long int dp[100005];
long long int a,k;
bool flag=false;
bool used[100005];
char s[20];
ll ans=0;
long long int x,y,a,b;
int main(){
cin>>x>>y;
a=max(x,y);
b=min(x,y);
if(max(x,y)>=4){
cout<<"Alice";
}else{
if((a<=1 && b==0) || (a==2 && b==1) || (a==1 && b==1) )cout<<"Brown";
if((a>=2 && b==0) || (a==3 && b==1) )cout<<"Alice";
}
cout<<endl;
return 0;
} | a.cc:38:19: error: redefinition of 'long long int a'
38 | long long int x,y,a,b;
| ^
a.cc:32:15: note: 'long long int a' previously declared here
32 | long long int a,k;
| ^
a.cc:38:21: error: redefinition of 'long long int b'
38 | long long int x,y,a,b;
| ^
a.cc:26:15: note: 'long long int b' previously declared here
26 | long long int b,l;
| ^
|
s586375148 | p03742 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P2;
const int inf=1000000000;
int dp[101][101][301]={};
ll w1[101]={};
int v1[101]={};
ll km[101]={};
int main() {
ll x,y;
cin>x>>y;
if(abs(x-y)<=1){
cout<<"Brown"<<endl;
}else{
cout<<"Alice"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:12: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'll' {aka 'long long int'})
20 | cin>x>>y;
| ~~~^~~~~
| | |
| | ll {aka long long int}
| std::istream {aka std::basic_istream<char>}
a.cc:20:12: note: candidate: 'operator>(int, ll {aka long long int})' (built-in)
20 | cin>x>>y;
| ~~~^~~~~
a.cc:20:12: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/string:48,
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_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | cin>x>>y;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::vector<_Tp, _Alloc>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:4:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::deque<_Tp, _Alloc>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:20:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::queue<_Tp, _Seq>'
20 | cin>x>>y;
| ^
In file included from /usr/include/c++/14/stack:63,
from a.cc:6:
/usr/include/c++/14/bits/stl_stack.h:387:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const s |
s951630222 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
__attribute__((constructor))
void initial() {
cin.tie(0);
ios::sync_with_stdio(false);
}
int main() {
ll a, b;
cin >> a >> b;
cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
}
| a.cc: In function 'int main()':
a.cc:19:22: error: no match for 'operator<=' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'int')
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ~~~~~~~~~~~~~~~~~~ ^~ ~
| | |
| | int
| std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
a.cc:19:22: note: candidate: 'operator<=(int, int)' (built-in)
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ~~~~~~~~~~~~~~~~~~~^~~~
a.cc:19:22: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1154:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1154 | operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1154:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1260:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1260 | operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1260:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1353:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1353 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1353:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1427:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1427 | operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1427:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1521:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1521 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1521:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1599:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1599 | operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1599:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/regex.h:1699:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1699 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1699:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
469 | operator<=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
513 | operator<=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1704 | operator<=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1767 | operator<=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
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/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
717 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/include/c++/14/string_view:724:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
724 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed:
a.cc:19:25: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
19 | cout << abs(a - b) <= 1 ? "Brown" : "Alice" << endl;
| ^
/usr/i |
s508301837 | p03742 | C++ | #include<bits/stdc++.h>
using namespace std;
LL x,y;
int main()
{
cin>>x>>y;
printf(abs(x-y)<=1 ? "Brown" : "Alice");
return 0;
} | a.cc:3:1: error: 'LL' does not name a type
3 | LL x,y;
| ^~
a.cc: In function 'int main()':
a.cc:6:6: error: 'x' was not declared in this scope
6 | cin>>x>>y;
| ^
a.cc:6:9: error: 'y' was not declared in this scope; did you mean 'yn'?
6 | cin>>x>>y;
| ^
| yn
|
s925949779 | p03742 | C++ | #include<iostream>
using namespace std;
int main (){
int n,m;
cin>>n>>m;
if(n>m){int k=n;n=m;m=k;}
if((m-n)>1)cout<<Alice<<endl;
else cout<<Brown<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:18: error: 'Alice' was not declared in this scope
8 | if((m-n)>1)cout<<Alice<<endl;
| ^~~~~
a.cc:9:12: error: 'Brown' was not declared in this scope
9 | else cout<<Brown<<endl;
| ^~~~~
|
s367985942 | p03742 | C++ | #include <iostream>
using namespace std;
long long x, y;
long long abs(long long x) { return x < 0 ? -x : x; }
int main(){
cin>>x>>y;
if(abs(x-y) <= 1) cout<<"Alice";
else cout<<"Brown";
} | a.cc: In function 'int main()':
a.cc:7:9: error: call of overloaded 'abs(long long int)' is ambiguous
7 | if(abs(x-y) <= 1) cout<<"Alice";
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
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/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
a.cc:4:11: note: candidate: 'long long int abs(long long int)'
4 | long long abs(long long x) { return x < 0 ? -x : x; }
| ^~~
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
137 | abs(__float128 __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
| ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
79 | abs(long double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
75 | abs(float __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
71 | abs(double __x)
| ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
61 | abs(long long __x) { return __builtin_llabs (__x); }
| ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
56 | abs(long __i) { return __builtin_labs(__i); }
| ^~~
|
s336336423 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;
int memo[105][105];
bool rec(int x, int y, bool a){
if(x < 2 && y < 2){
//cout << !a << endl;
return false;
}
if(memo[x][y] != -1) return memo[x][y];
if(memo[x][y] == -1){
for(int i=1; 2*i <= x; i++){
//cout << x << y << endl;
if(rec(x-2*i, y+i, !a) == false){
return memo[x][y] = 1;
}
}
for(int i=1; 2*i <= y; i++){
//cout << x << y << endl;
if(rec(x+i, y-2*i, !a) == false){
return memo[x][y] = 1;
}
}
}
return memo[x][y] = 0;
}
int main(void) {
//ios_base::sync_with_stdio(false);
//cin.tie(0);
//cout << rec(2, 1, true) << endl;
memset(memo, 0xff, sizeof(memo));
//rec(3, 3, true);
/*
for(int i=0; i<=20; i++){
for(int j=0; j<=20; j++){
if(rec(i, j, true) == true){
printf("A");
}else{
printf("B");
}
}
puts("");
}
*/
int x, y;
cin >> x >> y;
printf("%s\n", (abs(x - y) <= 1) ? "Brown" : "Alice")
return 0;
}
| a.cc: In function 'int main()':
a.cc:62:62: error: expected ';' before 'return'
62 | printf("%s\n", (abs(x - y) <= 1) ? "Brown" : "Alice")
| ^
| ;
......
65 | return 0;
| ~~~~~~
|
s387822309 | p03742 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b;
cin>>a>>b;
if(abs(x-y)>1)cout<<"Alice"<<endl;
else cout<<"Brown"<<endl;
} | a.cc: In function 'int main()':
a.cc:6:10: error: 'x' was not declared in this scope
6 | if(abs(x-y)>1)cout<<"Alice"<<endl;
| ^
a.cc:6:12: error: 'y' was not declared in this scope
6 | if(abs(x-y)>1)cout<<"Alice"<<endl;
| ^
|
s263286294 | p03742 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
ll x,y;
cin>>x>>y;
if(x==0 && y==0){
puts("Brown");
}else if(abs(x-y)==1){
puts("Brown");
}else puts("Alice");
}
| a.cc: In function 'int main()':
a.cc:15:9: error: 'll' was not declared in this scope; did you mean 'all'?
15 | ll x,y;
| ^~
| all
a.cc:16:14: error: 'x' was not declared in this scope
16 | cin>>x>>y;
| ^
a.cc:16:17: error: 'y' was not declared in this scope; did you mean 'yn'?
16 | cin>>x>>y;
| ^
| yn
|
s512515034 | p03742 | Java | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
System.out.println(Math.abs(sc.nextLong() - sc.nextLong()) <= 1 ? "Brown" : "Alice");
out.flush();
out.close();
}
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
br = new BufferedReader(new InputStreamReader(s));
}
public Scanner (FileReader f) {br = new BufferedReader(f);}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(br.readLine());
return st.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public String nextLine() throws IOException {
return br.readLine();
}
public double nextDouble() throws IOException {
String x = next();
StringBuilder sb = new StringBuilder("0");
double res = 0, f = 1;
boolean dec = false, neg = false;
int start = 0;
if (x.charAt(0) == '-') {
neg = true;
start++;
}
for (int i = start; i < x.length(); i++)
if (x.charAt(i) == '.') {
res = Long.parseLong(sb.toString());
sb = new StringBuilder("0");
dec = true;
} else {
sb.append(x.charAt(i));
if (dec)
f *= 10;
}
res += Long.parseLong(sb.toString()) / f;
return res * (neg ? -1 : 1);
}
public boolean ready() throws IOException {
return br.ready();
}
}
} | Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s977609077 | p03742 | C++ | #include<iostream>
#include<vector>
#include<cmath>
#include<utility>
using namespace std;
typedef long long LL;
#define F first
#define S second
int main() {
LL a, b;
cin >> a >> b;
if (abs(a - b) >= 2)cout << "Alice" << endl;
else cout << "Brown" << endl;
return;
} | a.cc: In function 'int main()':
a.cc:15:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
15 | return;
| ^~~~~~
|
s847446894 | p03742 | C++ | #include<iostream>
#include<vector>
#include<cmath>
#include<utility>
using namespace std;
typedef long long LL;
#define F first
#define S second
#define int LL
void main() {
LL a, b;
cin >> a >> b;
if (abs(a - b) >= 2)cout << "Alice" << endl;
else cout << "Brown" << endl;
return;
} | a.cc:11:1: error: '::main' must return 'int'
11 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:16:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
16 | return;
| ^~~~~~
|
s515425522 | p03742 | C++ | #include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second
const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
out << "{";
rep(i,v.size()) out << v[i] << ", " ;
return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
return out << "(" << p.fs << ", " << p.sc << ")";
}
int main(){
cpp_int x, y;
cin >> x >> y;
s = abs(x - y);
cout << (s < (cpp_int)2 ?"Beown":"Alice") << endl;
return 0;
}
| a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
2 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s372504436 | p03742 | C++ | #include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second
const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
out << "{";
rep(i,v.size()) out << v[i] << ", " ;
return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
return out << "(" << p.fs << ", " << p.sc << ")";
}
int main(){
cpp_int x, y;
cin >> x >> y;
s = abs(x - y);
cout << (s < (cpp_int)2 ?"Beown":"Alice") << endl;
return 0;
}
| a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
2 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s625217523 | p03742 | C++ | #include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second
const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
out << "{";
rep(i,v.size()) out << v[i] << ", " ;
return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
return out << "(" << p.fs << ", " << p.sc << ")";
}
int main(){
cpp_int x, y;
cin >> x >> y;
s = abs(x - y);
cout << (s < (cpp_int)2 ?"Beown":"Alice") << endl;
return 0;
}
| a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
2 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s019469536 | p03742 | C++ | #include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb push_back
#define fs first
#define sc second
const char dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
out << "{";
rep(i,v.size()) out << v[i] << ", " ;
return out << "}" << endl;
}
template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
return out << "(" << p.fs << ", " << p.sc << ")";
}
int main(){
cppint x, y;
cin >> x >> y;
s = abs(x - y);
cout << (s < (cpp_int)2 ?"Beown":"Alice") << endl;
return 0;
}
| a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
2 | #include <boost/multiprecision/cpp_int.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s699318046 | p03742 | C++ | #include <iostream>
#include <cstdio>
#define A() printf("Alice\n");
#define B() printf("Brown\n");
#define int long long
#define INF 1e+18
using namespace std;
signed main(){
int n,m;
cin >> n >> m;
if(n <= 1 && m <= 1) B();
else if(n == 0 || m == 0) A();
else{
if((n + m) % 2) A();
else B();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'else' without a previous 'if'
13 | else if(n == 0 || m == 0) A();
| ^~~~
a.cc:14:9: error: 'else' without a previous 'if'
14 | else{
| ^~~~
a.cc:16:17: error: 'else' without a previous 'if'
16 | else B();
| ^~~~
|
s509352155 | p03742 | C++ | #include <iostream>
#include <cstdio>
#define A() printf("Alice\n");
#define B() printf("Brown\n");
#define int long long
#define INF 1e+18
#define
using namespace std;
signed main(){
int n,m;
cin >> n >> m;
if(n <= 1 && m <= 1) B();
else if(n == 0 || m == 0) A();
else{
if((n + m) % 2) A();
else B();
}
return 0;
} | a.cc:7:9: error: no macro name given in #define directive
7 | #define
| ^
a.cc: In function 'int main()':
a.cc:14:9: error: 'else' without a previous 'if'
14 | else if(n == 0 || m == 0) A();
| ^~~~
a.cc:15:9: error: 'else' without a previous 'if'
15 | else{
| ^~~~
a.cc:17:17: error: 'else' without a previous 'if'
17 | else B();
| ^~~~
|
s242438403 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;
int main(void){
ll X, Y;
cin >> X >> Y;
if(X <= 1 && Y <= 1){
printf("Brown\n");
return 0;
}
dfs(X, Y, 0);
if(flag){
printf("Alice\n");return 0;
}
if(X == Y){
if(X % 2 && Y % 2){
printf("Alice\n");
}else{
printf("Brown\n");
}
}else if(X > Y){
if(X % 2 == 1 && Y % 2 == 1){
printf("Alice\n");
}else if(X % 2 == 0 && Y % 2 == 1){
printf("Brown\n"); // ok
}else if(X % 2 == 1 && Y % 2 == 0){
printf("Alice\n");
}else{
printf("Alice\n");
}
}else if(X < Y){
if(X % 2 == 1 && Y % 2 == 1){
printf("Alice\n");
}else if(X % 2 == 0 && Y % 2 == 1){
printf("Alice\n");
}else if(X % 2 == 1 && Y % 2 == 0){
printf("Brown\n");
}else{
printf("Alice\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:31:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
31 | dfs(X, Y, 0);
| ^~~
| ffs
a.cc:32:12: error: 'flag' was not declared in this scope
32 | if(flag){
| ^~~~
|
s430573278 | p03742 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
typedef unsigned long long int ulld;
//const lld mod = 1e9+7;
//const lld INF = 1e9;
//const lld MAXN = 1e9;
int main()
{
ulld x,y;
cin >> x >> y;
string sol;
if (x > y)
{
ulld temp = x;
x = y;
y = temp;
}
if (x == y)
{
sol = "Brown";
}else if (y - x == 1)
{
sol = "Brown";
}else if (x == 0)
{
sol = "Alice";
}else
{
sol = "Alice"
// if ((x%2 + y%2)%2 == 0)
// {
// sol = "Alice";
// }else
// {
// sol = "Brown";
// }
}
cout << sol << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:44:30: error: expected ';' before '}' token
44 | sol = "Alice"
| ^
| ;
......
52 | }
| ~
|
s461346536 | p03742 | C++ | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}
namespace std {
bool operator<(const P& a, const P& b) {
return a.X != b.X ? a.X < b.X : a.Y < b.Y;
}
}
int memo[1010][1010][2];
int solve(int x, int y, int turn) {
// printf("x = %lld, y = %lld, turn = %lld\n", x, y, turn);
if(x > y) swap(x, y);
if(memo[x][y][turn] != -1) return memo[x][y][turn];
if(x == 0 && y == 0) return memo[x][y][turn] = (turn % 2 ? 0 : 1);
if(x == 0 && y == 1) return memo[x][y][turn] = (turn % 2 ? 0 : 1);
if(x == 1 && y == 1) return memo[x][y][turn] = (turn % 2 ? 0 : 1);
bool ok = false;
for(int t = 2; t <= x; t += 2) {
if(turn % 2 && solve(x-t, y+t/2, turn^1)) ok = true;
else if(turn % 2 == 0 && !solve(x-t, y+t/2, turn^1)) ok = true;
}
for(int t = 2; t <= y; t += 2) {
if(turn % 2 && solve(x+t/2, y-t, turn^1)) ok = true;
else if(turn % 2 == 0 && !solve(x+t/2, y-t, turn^1)) ok = true;
}
if(turn % 2) {
return memo[x][y][turn] = (ok ? 1 : 0);
}
else return memo[x][y][turn] = (ok ? 0 : 1);
}
signed main() {
if(x > y) swap(x, y);
if(y == x || y == x+1) cout << "Brown" << endl;
else cout << "Alice" << endl;
/*
memset(memo, -1, sizeof(memo));
rep(i,0,100) rep(j,i,100) {
int ans = solve(i, j, 0);
// if(ans == 0) continue;
printf("%lld, %lld, ", i, j);
cout << (ans ? "Brown" : "Alice") << endl;
}
*/
return 0;
} | a.cc: In function 'int main()':
a.cc:95:8: error: 'x' was not declared in this scope; did you mean 'dx'?
95 | if(x > y) swap(x, y);
| ^
| dx
a.cc:95:12: error: 'y' was not declared in this scope; did you mean 'yn'?
95 | if(x > y) swap(x, y);
| ^
| yn
a.cc:96:8: error: 'y' was not declared in this scope; did you mean 'yn'?
96 | if(y == x || y == x+1) cout << "Brown" << endl;
| ^
| yn
a.cc:96:13: error: 'x' was not declared in this scope; did you mean 'dx'?
96 | if(y == x || y == x+1) cout << "Brown" << endl;
| ^
| dx
|
s959738767 | p03742 | C++ | #include <cstdio>
long long X,Y;
int main()
{
scanf("%lld%lld",&X,&Y);
if (x<y)
swap(x,y);
if (x==y)
puts("Brown");
else if (x<=2)
puts("Brown");
else put("Alice");
return 0;
} | a.cc: In function 'int main()':
a.cc:6:13: error: 'x' was not declared in this scope
6 | if (x<y)
| ^
a.cc:6:15: error: 'y' was not declared in this scope
6 | if (x<y)
| ^
a.cc:7:17: error: 'swap' was not declared in this scope
7 | swap(x,y);
| ^~~~
a.cc:8:13: error: 'x' was not declared in this scope
8 | if (x==y)
| ^
a.cc:8:16: error: 'y' was not declared in this scope
8 | if (x==y)
| ^
a.cc:12:14: error: 'put' was not declared in this scope; did you mean 'putw'?
12 | else put("Alice");
| ^~~
| putw
|
s653591576 | p03742 | C++ | #include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
class JNum{
static constexpr uint64_t mod = 1000000007;
uint64_t num;
public:
JNum(uint64_t x):num(x%mod){}
JNum operator+(const JNum& j)const{
return (num + j.num)%mod;
}
JNum operator*(const JNum& j)const{
return (num * j.num)%mod;
}
void operator+=(const JNum& j){
num += j.num;
num %= mod;
}
void operator*=(const JNum& j){
num *= j.num;
num %=mod;
}
uint64_t out()const{return num;}
};
int main(void){
uint64_t x,y;
std::cin >> x;
std::cin >> y;
if(std::abs(x - y)>=2)
std::cout << "Alice"<<std::endl;
else
std::cout << "Brown"<<std::endl;
} | a.cc:7:26: error: 'uint64_t' does not name a type
7 | static constexpr uint64_t mod = 1000000007;
| ^~~~~~~~
a.cc:6:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
5 | #include <cstring>
+++ |+#include <cstdint>
6 | class JNum{
a.cc:8:9: error: 'uint64_t' does not name a type
8 | uint64_t num;
| ^~~~~~~~
a.cc:8:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:10:22: error: expected ')' before 'x'
10 | JNum(uint64_t x):num(x%mod){}
| ~ ^~
| )
a.cc:25:9: error: 'uint64_t' does not name a type
25 | uint64_t out()const{return num;}
| ^~~~~~~~
a.cc:25:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc: In member function 'JNum JNum::operator+(const JNum&) const':
a.cc:12:25: error: 'num' was not declared in this scope; did you mean 'enum'?
12 | return (num + j.num)%mod;
| ^~~
| enum
a.cc:12:33: error: 'const class JNum' has no member named 'num'
12 | return (num + j.num)%mod;
| ^~~
a.cc:12:38: error: 'mod' was not declared in this scope
12 | return (num + j.num)%mod;
| ^~~
a.cc: In member function 'JNum JNum::operator*(const JNum&) const':
a.cc:15:25: error: 'num' was not declared in this scope; did you mean 'enum'?
15 | return (num * j.num)%mod;
| ^~~
| enum
a.cc:15:33: error: 'const class JNum' has no member named 'num'
15 | return (num * j.num)%mod;
| ^~~
a.cc:15:38: error: 'mod' was not declared in this scope
15 | return (num * j.num)%mod;
| ^~~
a.cc: In member function 'void JNum::operator+=(const JNum&)':
a.cc:18:17: error: 'num' was not declared in this scope; did you mean 'enum'?
18 | num += j.num;
| ^~~
| enum
a.cc:18:26: error: 'const class JNum' has no member named 'num'
18 | num += j.num;
| ^~~
a.cc:19:24: error: 'mod' was not declared in this scope
19 | num %= mod;
| ^~~
a.cc: In member function 'void JNum::operator*=(const JNum&)':
a.cc:22:17: error: 'num' was not declared in this scope; did you mean 'enum'?
22 | num *= j.num;
| ^~~
| enum
a.cc:22:26: error: 'const class JNum' has no member named 'num'
22 | num *= j.num;
| ^~~
a.cc:23:23: error: 'mod' was not declared in this scope
23 | num %=mod;
| ^~~
a.cc: In function 'int main()':
a.cc:29:9: error: 'uint64_t' was not declared in this scope
29 | uint64_t x,y;
| ^~~~~~~~
a.cc:29:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
a.cc:30:21: error: 'x' was not declared in this scope
30 | std::cin >> x;
| ^
a.cc:31:21: error: 'y' was not declared in this scope
31 | std::cin >> y;
| ^
|
s859294475 | p03742 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
typedef unsigned long long int ulld;
const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;
int main()
{
ulld x,y;
cin >> x >> y;
string sol;
if (x > y)
{
ulld temp = x;
x = y;
y = temp;
}
if (x == y)
{
sol = "Brown";
}else if (x == 0 && y == 1)
{
sol = "Brown";
}else if (x == 0)
{
sol = "Alice";
}else
{
if ((x%2 + y%2)%2 == 0)
{
sol = "Alice";
}else
{
sol = "Brown";
}
}
cout << sol << endl;
return 0;
} | a.cc:15:7: error: 'lld' does not name a type; did you mean 'ulld'?
15 | const lld mod = 1e9+7;
| ^~~
| ulld
a.cc:16:7: error: 'lld' does not name a type; did you mean 'ulld'?
16 | const lld INF = 1e9;
| ^~~
| ulld
|
s383254216 | p03742 | C++ | #include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#define INF 2147483600
bool solve(long x, long y){
if(x+y<=1) return dp[x][y] = false;
if( (x==2 && y==0) || (x==0 && y==2) ) return dp[x][y] = true;
if((y-x)%3 ==0) return false;
else return true;
}
int main(){
long x,y;
cin>>x>>y;
//
// rep(i,100){
// rep(j,100) cout << solve(i,j);
// cout << endl;
// }
if(solve(x,y)) cout << "Alice" << endl;
else cout << "Brown" << endl;
return 0;
}
| a.cc: In function 'bool solve(long int, long int)':
a.cc:18:21: error: 'dp' was not declared in this scope; did you mean 'dup'?
18 | if(x+y<=1) return dp[x][y] = false;
| ^~
| dup
a.cc:19:49: error: 'dp' was not declared in this scope; did you mean 'dup'?
19 | if( (x==2 && y==0) || (x==0 && y==2) ) return dp[x][y] = true;
| ^~
| dup
|
s876194409 | p03742 | Java | import java.util.*;
public class Main {
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long X = sc.nextLong();
long Y = sc.nextLong();
System.out.println(Math.abs(X-Y)<=1 ? "Brown" : "Alice");
sc.close();
}
}
| Main.java:13: error: reached end of file while parsing
}
^
1 error
|
s569578857 | p03742 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;
main()
{
int X, Y;
cin >> X >> Y;
if( X <=2 && Y <= 2 ) cout << "Brown" << endl;
else cout << "Alice" << endl;
}
0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;
main()
{
int X, Y;
cin >> X >> Y;
if( X <=2 && Y <= 2 ) cout << "Brown" << endl;
else cout << "Alice" << endl;
}
| a.cc:8:16: error: '#' is not followed by a macro parameter
8 | #define Rep(i,n) for(int i=#include<bits/stdc++.h>
| ^
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
20 | main()
| ^~~~
a.cc:28:1: error: expected unqualified-id before numeric constant
28 | 0;i<(n);i++)
| ^
a.cc:28:3: error: 'i' does not name a type
28 | 0;i<(n);i++)
| ^
a.cc:28:9: error: 'i' does not name a type
28 | 0;i<(n);i++)
| ^
a.cc:31:11: error: redefinition of 'const long long int INF'
31 | const int INF = 1107110711071107;
| ^~~
a.cc:18:11: note: 'const long long int INF' previously defined here
18 | const int INF = 1107110711071107;
| ^~~
a.cc:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
33 | main()
| ^~~~
a.cc:33:1: error: redefinition of 'int main()'
a.cc:20:1: note: 'int main()' previously defined here
20 | main()
| ^~~~
|
s439380700 | p03742 | C++ | #include<stdio.h>
int main(void){
long long int x,y;
scanf("%lld %lld",&x,&y);
if(abs(x-y)<=1){printf("Brown\n");}
else{printf("Alice\n");}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:12: error: 'abs' was not declared in this scope
5 | if(abs(x-y)<=1){printf("Brown\n");}
| ^~~
|
s340813355 | p03742 | C++ | /*
This code has been written by MinakoKojima, feel free to ask me question. Blog: http://www.shuizilong.com/house
Template Date: 2015.10.12
Note: ...
*/
#pragma comment(linker, "/STACK:36777216")
//#pragma GCC optimize ("O2")
#define LOCAL
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
//#include <tr1/unordered_set>
//#include <tr1/unordered_map>
//#include <array>
using namespace std;
#define REP(i, n) for (int i=0;i<n;++i)
#define FOR(i, a, b) for (int i=a;i<b;++i)
#define DWN(i, b, a) for (int i=b-1;i>=a;--i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define FOR_1(i, a, b) for (int i=a;i<=b;++i)
#define DWN_1(i, b, a) for (int i=b;i>=a;--i)
#define REP_C(i, n) for (int n____=n,i=0;i<n____;++i)
#define FOR_C(i, a, b) for (int b____=b,i=a;i<b____;++i)
#define DWN_C(i, b, a) for (int a____=a,i=b-1;i>=a____;--i)
#define REP_N(i, n) for (i=0;i<n;++i)
#define FOR_N(i, a, b) for (i=a;i<b;++i)
#define DWN_N(i, b, a) for (i=b-1;i>=a;--i)
#define REP_1_C(i, n) for (int n____=n,i=1;i<=n____;++i)
#define FOR_1_C(i, a, b) for (int b____=b,i=a;i<=b____;++i)
#define DWN_1_C(i, b, a) for (int a____=a,i=b;i>=a____;--i)
#define REP_1_N(i, n) for (i=1;i<=n;++i)
#define FOR_1_N(i, a, b) for (i=a;i<=b;++i)
#define DWN_1_N(i, b, a) for (i=b;i>=a;--i)
#define REP_C_N(i, n) for (int n____=(i=0,n);i<n____;++i)
#define FOR_C_N(i, a, b) for (int b____=(i=0,b);i<b____;++i)
#define DWN_C_N(i, b, a) for (int a____=(i=b-1,a);i>=a____;--i)
#define REP_1_C_N(i, n) for (int n____=(i=1,n);i<=n____;++i)
#define FOR_1_C_N(i, a, b) for (int b____=(i=a,b);i<=b____;++i)
#define DWN_1_C_N(i, b, a) for (int a____=(i=b,a);i>=a____;--i)
#define ECH(it, A) for (__typeof((A).begin()) it=(A).begin(); it != (A).end(); ++it)
#define rECH(it, A) for (__typeof((A).rbegin()) it=(A).rbegin(); it != (A).rend(); ++it)
#define REP_S(i, str) for (char*i=str;*i;++i)
#define REP_L(i, hd, suc) for (int i=hd;i;i=suc[i])
#define REP_G(i, u) REP_L(i,hd[u],suc)
#define REP_SS(x, s) for (int x=s;x;x=(x-1)&s)
#define DO(n) for ( int ____n = n; ____n-->0; )
#define REP_2(i, j, n, m) REP(i, n) REP(j, m)
#define REP_2_1(i, j, n, m) REP_1(i, n) REP_1(j, m)
#define REP_3(i, j, k, n, m, l) REP(i, n) REP(j, m) REP(k, l)
#define REP_3_1(i, j, k, n, m, l) REP_1(i, n) REP_1(j, m) REP_1(k, l)
#define REP_4(i, j, k, ii, n, m, l, nn) REP(i, n) REP(j, m) REP(k, l) REP(ii, nn)
#define REP_4_1(i, j, k, ii, n, m, l, nn) REP_1(i, n) REP_1(j, m) REP_1(k, l) REP_1(ii, nn)
#define ALL(A) A.begin(), A.end()
#define LLA(A) A.rbegin(), A.rend()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define LBD(A, x) (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x) (upper_bound(ALL(A), x) - A.begin())
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int((A).size())
#define PB push_back
#define MP(A, B) make_pair(A, B)
#define PTT pair<T, T>
#define Ts *this
#define rTs return Ts
#define fi first
#define se second
#define re real()
#define im imag()
#define Rush for(int ____T=RD(); ____T--;)
#define Display(A, n, m) { \
REP(i, n){ \
REP(j, m-1) cout << A[i][j] << " "; \
cout << A[i][m-1] << endl; \
} \
}
#define Display_1(A, n, m) { \
REP_1(i, n){ \
REP_1(j, m-1) cout << A[i][j] << " "; \
cout << A[i][m] << endl; \
} \
}
typedef long long LL;
//typedef long double DB;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<string> VS;
typedef vector<LL> VL;
typedef vector<DB> VF;
typedef set<int> SI;
typedef set<string> SS;
typedef map<int, int> MII;
typedef map<string, int> MSI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<VII> VVII;
template<class T> inline T& RD(T &);
template<class T> inline void OT(const T &);
//inline int RD(){int x; return RD(x);}
inline LL RD(){LL x; return RD(x);}
inline DB& RF(DB &);
inline DB RF(){DB x; return RF(x);}
inline char* RS(char *s);
inline char& RC(char &c);
inline char RC();
inline char& RC(char &c){scanf(" %c", &c); return c;}
inline char RC(){char c; return RC(c);}
//inline char& RC(char &c){c = getchar(); return c;}
//inline char RC(){return getchar();}
template<class T> inline T& RDD(T &);
inline LL RDD(){LL x; return RDD(x);}
template<class T0, class T1> inline T0& RD(T0 &x0, T1 &x1){RD(x0), RD(x1); return x0;}
template<class T0, class T1, class T2> inline T0& RD(T0 &x0, T1 &x1, T2 &x2){RD(x0), RD(x1), RD(x2); return x0;}
template<class T0, class T1, class T2, class T3> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3){RD(x0), RD(x1), RD(x2), RD(x3); return x0;}
template<class T0, class T1, class T2, class T3, class T4> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6); return x0;}
template<class T0, class T1> inline void OT(const T0 &x0, const T1 &x1){OT(x0), OT(x1);}
template<class T0, class T1, class T2> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2){OT(x0), OT(x1), OT(x2);}
template<class T0, class T1, class T2, class T3> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3){OT(x0), OT(x1), OT(x2), OT(x3);}
template<class T0, class T1, class T2, class T3, class T4> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5, const T6 &x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}
inline char& RC(char &a, char &b){RC(a), RC(b); return a;}
inline char& RC(char &a, char &b, char &c){RC(a), RC(b), RC(c); return a;}
inline char& RC(char &a, char &b, char &c, char &d){RC(a), RC(b), RC(c), RC(d); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e){RC(a), RC(b), RC(c), RC(d), RC(e); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f, char &g){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f), RC(g); return a;}
inline DB& RF(DB &a, DB &b){RF(a), RF(b); return a;}
inline DB& RF(DB &a, DB &b, DB &c){RF(a), RF(b), RF(c); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d){RF(a), RF(b), RF(c), RF(d); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e){RF(a), RF(b), RF(c), RF(d), RF(e); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f, DB &g){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f), RF(g); return a;}
inline void RS(char *s1, char *s2){RS(s1), RS(s2);}
inline void RS(char *s1, char *s2, char *s3){RS(s1), RS(s2), RS(s3);}
template<class T0,class T1>inline T0& RDD(T0&a, T1&b){RDD(a),RDD(b); return a;}
template<class T0,class T1,class T2>inline T1& RDD(T0&a, T1&b, T2&c){RDD(a),RDD(b),RDD(c); return a;}
template<class T> inline void RST(T &A){memset(A, 0, sizeof(A));}
template<class T> inline void FLC(T &A, int x){memset(A, x, sizeof(A));}
template<class T> inline void CLR(T &A){A.clear();}
template<class T0, class T1> inline void RST(T0 &A0, T1 &A1){RST(A0), RST(A1);}
template<class T0, class T1, class T2> inline void RST(T0 &A0, T1 &A1, T2 &A2){RST(A0), RST(A1), RST(A2);}
template<class T0, class T1, class T2, class T3> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3){RST(A0), RST(A1), RST(A2), RST(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}
template<class T0, class T1> inline void FLC(T0 &A0, T1 &A1, int x){FLC(A0, x), FLC(A1, x);}
template<class T0, class T1, class T2> inline void FLC(T0 &A0, T1 &A1, T2 &A2, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x);}
template<class T0, class T1, class T2, class T3> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x);}
template<class T0, class T1, class T2, class T3, class T4> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x), FLC(A6, x);}
template<class T> inline void CLR(priority_queue<T, vector<T>, less<T> > &Q){while (!Q.empty()) Q.pop();}
template<class T> inline void CLR(priority_queue<T, vector<T>, greater<T> > &Q){while (!Q.empty()) Q.pop();}
template<class T> inline void CLR(stack<T> &S){while (!S.empty()) S.pop();}
template<class T> inline void CLR(queue<T> &Q){while (!Q.empty()) Q.pop();}
template<class T0, class T1> inline void CLR(T0 &A0, T1 &A1){CLR(A0), CLR(A1);}
template<class T0, class T1, class T2> inline void CLR(T0 &A0, T1 &A1, T2 &A2){CLR(A0), CLR(A1), CLR(A2);}
template<class T0, class T1, class T2, class T3> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}
template<class T> inline void CLR(T &A, int n){REP(i, n) CLR(A[i]);}
template<class T> inline bool EPT(T &a){return a.empty();}
template<class T> inline T& SRT(T &A){sort(ALL(A)); return A;}
template<class T, class C> inline T& SRT(T &A, C cmp){sort(ALL(A), cmp); return A;}
template<class T> inline T& RVS(T &A){reverse(ALL(A)); return A;}
template<class T> inline T& UNQQ(T &A){A.resize(unique(ALL(A))-A.begin());return A;}
template<class T> inline T& UNQ(T &A){SRT(A);return UNQQ(A);}
template<class T, class C> inline T& UNQ(T &A, C cmp){SRT(A, cmp);return UNQQ(A);}
//}
/** Constant List .. **/ //{
const int MOD = int(1e9) + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
//}
/** Add On .. **/ //{
// <<= '0. Nichi Joo ., //{
template<class T> inline bool checkMin(T &a,const T b){return b < a ? a = b, 1 : 0;}
template<class T> inline bool checkMax(T &a,const T b){return a < b ? a = b, 1 : 0;}
template <class T, class C> inline bool checkUpd(T& a, const T b, C c){return c(b,a) ? a = b, 1 : 0;}
template<class T> inline T min(T a, T b, T c){return min(min(a, b), c);}
template<class T> inline T max(T a, T b, T c){return max(max(a, b), c);}
template<class T> inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template<class T> inline T max(T a, T b, T c, T d){return max(max(a, b), max(c, d));}
template<class T> inline T min(T a, T b, T c, T d, T e){return min(min(min(a,b),min(c,d)),e);}
template<class T> inline T max(T a, T b, T c, T d, T e){return max(max(max(a,b),max(c,d)),e);}
template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T cub(T a){return a*a*a;}
template<class T> inline T ceil(T x, T y){return (x - 1) / y + 1;}
template<class T> T abs(T x){return x>0?x:-x;}
inline int sgn(DB x){return x < -EPS ? -1 : x > EPS;}
inline int sgn(DB x, DB y){return sgn(x - y);}
inline DB cos(DB a, DB b, DB c){return (sqr(a)+sqr(b)-sqr(c))/(2*a*b);}
inline DB cot(DB x){return 1./tan(x);};
inline DB sec(DB x){return 1./cos(x);};
inline DB csc(DB x){return 1./sin(x);};
//}
// <<= '1. Bitwise Operation ., //{
namespace BO{
inline bool _1(int x, int i){return bool(x&1<<i);}
inline bool _1(LL x, int i){return bool(x&1LL<<i);}
inline LL _1(int i){return 1LL<<i;}
inline LL _U(int i){return _1(i) - 1;};
inline int reverse_bits(int x){
x = ((x >> 1) & 0x55555555) | ((x << 1) & 0xaaaaaaaa);
x = ((x >> 2) & 0x33333333) | ((x << 2) & 0xcccccccc);
x = ((x >> 4) & 0x0f0f0f0f) | ((x << 4) & 0xf0f0f0f0);
x = ((x >> 8) & 0x00ff00ff) | ((x << 8) & 0xff00ff00);
x = ((x >>16) & 0x0000ffff) | ((x <<16) & 0xffff0000);
return x;
}
inline LL reverse_bits(LL x){
x = ((x >> 1) & 0x5555555555555555LL) | ((x << 1) & 0xaaaaaaaaaaaaaaaaLL);
x = ((x >> 2) & 0x3333333333333333LL) | ((x << 2) & 0xccccccccccccccccLL);
x = ((x >> 4) & 0x0f0f0f0f0f0f0f0fLL) | ((x << 4) & 0xf0f0f0f0f0f0f0f0LL);
x = ((x >> 8) & 0x00ff00ff00ff00ffLL) | ((x << 8) & 0xff00ff00ff00ff00LL);
x = ((x >>16) & 0x0000ffff0000ffffLL) | ((x <<16) & 0xffff0000ffff0000LL);
x = ((x >>32) & 0x00000000ffffffffLL) | ((x <<32) & 0xffffffff00000000LL);
return x;
}
template<class T> inline bool odd(T x){return x&1;}
template<class T> inline bool even(T x){return !odd(x);}
template<class T> inline T low_bit(T x) {return x & -x;}
template<class T> inline T high_bit(T x) {T p = low_bit(x);while (p != x) x -= p, p = low_bit(x);return p;}
template<class T> inline T cover_bit(T x){T p = 1; while (p < x) p <<= 1;return p;}
template<class T> inline int cover_idx(T x){int p = 0; while (_1(p) < x ) ++p; return p;}
inline int clz(int x){return __builtin_clz(x);}
inline int clz(LL x){return __builtin_clzll(x);}
inline int ctz(int x){return __builtin_ctz(x);}
inline int ctz(LL x){return __builtin_ctzll(x);}
inline int lg2(int x){return !x ? -1 : 31 - clz(x);}
inline int lg2(LL x){return !x ? -1 : 63 - clz(x);}
inline int low_idx(int x){return !x ? -1 : ctz(x);}
inline int low_idx(LL x){return !x ? -1 : ctz(x);}
inline int high_idx(int x){return lg2(x);}
inline int high_idx(LL x){return lg2(x);}
inline int parity(int x){return __builtin_parity(x);}
inline int parity(LL x){return __builtin_parityll(x);}
inline int count_bits(int x){return __builtin_popcount(x);}
inline int count_bits(LL x){return __builtin_popcountll(x);}
} using namespace BO;//}
// <<= '2. Number Theory .,//{
namespace NT{
#define gcd __gcd
inline LL lcm(LL a, LL b){return a*b/gcd(a,b);}
inline void INC(int &a, int b){a += b; if (a >= MOD) a -= MOD;}
inline int sum(int a, int b){a += b; if (a >= MOD) a -= MOD; return a;}
/* 模数两倍刚好超 int 时。
inline int sum(uint a, int b){a += b; a %= MOD;if (a < 0) a += MOD; return a;}
inline void INC(int &a, int b){a = sum(a, b);}
*/
inline void DEC(int &a, int b){a -= b; if (a < 0) a += MOD;}
inline int dff(int a, int b){a -= b; if (a < 0) a += MOD; return a;}
inline void MUL(int &a, int b){a = (LL)a * b % MOD;}
//inline int pdt(int a, int b){return (LL)a * b % MOD;}
inline int pdt(int x,int y) {
int ret; __asm__ __volatile__ ("\tmull %%ebx\n\tdivl %%ecx\n":"=d"(ret):"a"(x),"b"(y),"c"(MOD));
return ret;
}
inline int gcd(int m, int n, int &x, int &y){
x = 1, y = 0; int xx = 0, yy = 1, q;
while (1){
q = m / n, m %= n;
if (!m){x = xx, y = yy; return n;}
DEC(x, pdt(q, xx)), DEC(y, pdt(q, yy));
q = n / m, n %= m;
if (!n) return m;
DEC(xx, pdt(q, x)), DEC(yy, pdt(q, y));
}
}
inline int sum(int a, int b, int c){return sum(a, sum(b, c));}
inline int sum(int a, int b, int c, int d){return sum(sum(a, b), sum(c, d));}
inline int pdt(int a, int b, int c){return pdt(a, pdt(b, c));}
inline int pdt(int a, int b, int c, int d){return pdt(pdt(a, b), pdt(c, d));}
inline int pow(int a, LL b){
int c(1); while (b){
if (b&1) MUL(c, a);
MUL(a, a), b >>= 1;
}
return c;
}
template<class T> inline T pow(T a, LL b){
T c(1); while (b){
if (b&1) c *= a;
a *= a, b >>= 1;
}
return c;
}
template<class T> inline T pow(T a, int b){
return pow(a, (LL)b);
}
inline int _I(int b){
int a = MOD, x1 = 0, x2 = 1, q; while (1){
q = a / b, a %= b;
if (!a) return x2;
DEC(x1, pdt(q, x2));
q = b / a, b %= a;
if (!b) return x1;
DEC(x2, pdt(q, x1));
}
}
inline void DIV(int &a, int b){MUL(a, _I(b));}
inline int qtt(int a, int b){return pdt(a, _I(b));}
struct Int{
int val;
operator int() const{return val;}
Int(int _val = 0):val(_val){
val %= MOD; if (val < 0) val += MOD;
}
Int(LL _val):val(_val){
_val %= MOD; if (_val < 0) _val += MOD;
val = _val;
}
Int& operator +=(const int& rhs){INC(val, rhs);rTs;}
Int operator +(const int& rhs) const{return sum(val, rhs);}
Int& operator -=(const int& rhs){DEC(val, rhs);rTs;}
Int operator -(const int& rhs) const{return dff(val, rhs);}
Int& operator *=(const int& rhs){MUL(val, rhs);rTs;}
Int operator *(const int& rhs) const{return pdt(val, rhs);}
Int& operator /=(const int& rhs){DIV(val, rhs);rTs;}
Int operator /(const int& rhs) const{return qtt(val, rhs);}
Int operator-()const{return MOD-*this;}
};
} using namespace NT;//}
//}
/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
#define d isdigit(g)
#define p x=x*10+c-'0'
#define n x=x*10+'0'-c
#define pp l/=10,p
#define nn l/=10,n
template<class T> inline T& RD(T &x){
char c;while(!d);x=c-'0';while(d)p;
return x;
}
template<class T> inline T& RDD(T &x){
char c;while(g,c!='-'&&!isdigit(c));
if (c=='-'){x='0'-g;while(d)n;}
else{x=c-'0';while(d)p;}
return x;
}
inline DB& RF(DB &x){
//scanf("%lf", &x);
char c;while(g,c!='-'&&c!='.'&&!isdigit(c));
if(c=='-')if(g=='.'){x=0;DB l=1;while(d)nn;x*=l;}
else{x='0'-c;while(d)n;if(c=='.'){DB l=1;while(d)nn;x*=l;}}
else if(c=='.'){x=0;DB l=1;while(d)pp;x*=l;}
else{x=c-'0';while(d)p;if(c=='.'){DB l=1;while(d)pp;x*=l;}}
return x;
}
#undef nn
#undef pp
#undef n
#undef p
#undef d
#undef g
inline char* RS(char *s){
//gets(s);
scanf("%s", s);
return s;
}
LL last_ans; int Case; template<class T> inline void OT(const T &x){
//printf("Case #%d: ", ++Case);
//printf("%lld\n", x);
//printf("%I64d\n", x);
//printf("%.9f\n", x);
//printf("%d\n", x);
cout << x << endl;
//last_ans = x;
}
//}/* .................................................................................................................................. */
const int N = int(1e5) + 9;
int dp[N][N];
LL a, b;
int f(LL a, LL b){
if (b > a) swap(a, b);
int &z = dp[a][b];
if (!z){
REP_1(i, a/2){
if (f(a-2*i, b+i) == -1){
z = 1;
return z;
}
}
REP_1(i, b/2){
if (f(a+i, b-2*i) == -1){
z = 1;
return z;
}
}
z = -1;
}
return z;
}
int main(){
#ifndef ONLINE_JUDGE
//freopen("/users/minakokojima/Documents/ACM-Training/Workspace/in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif
RD(a, b);
if (abs(a-b) <= 1){
puts("Brown");
}
else{
puts("Alice");
}
/*
dp[0][0] = -1;
dp[1][0] = dp[0][1] = -1;
dp[1][1] = -1;
dp[2][0] = dp[0][2] = 1;
dp[2][1] = dp[1][2] = -1;
dp[3][0] = dp[0][3] = 1;
REP(i, 60+1){
REP(j, 60+1){
//a = i-j; b = j;
//if (b > a) break;
cout << f(i, j) << " ";
}
cout << endl;
}
*/
}
| /tmp/cczpAQHu.o: in function `main':
a.cc:(.text+0x159): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cczpAQHu.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cczpAQHu.o
a.cc:(.text+0x172): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cczpAQHu.o
a.cc:(.text+0x179): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cczpAQHu.o
collect2: error: ld returned 1 exit status
|
s365474999 | p03742 | C++ | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
LL x,y;
cin>>x>>y;
if(x==y||abs(x-y)==1)
cout<<"Brown"<<endl;
else cout<<"Alice"<<endl;g
} | a.cc: In function 'int main()':
a.cc:17:34: error: 'g' was not declared in this scope
17 | else cout<<"Alice"<<endl;g
| ^
|
s471743235 | p03743 | C++ | #include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>
const int MAX_N = 500050;
int N, Q, q[MAX_N];
long long D, d[MAX_N];
long long area[MAX_N], loc[MAX_N];
int main(int argc, char **argv) {
std::cin >> N >> D;
for (int i = 1; i <= N; i++) {
std::cin >> d[i];
}
std::cin >> Q;
for (int i = 1; i <= Q; i++) {
std::cin >> q[i];
}
area[N+1] = 0;
for (int i = N; 1 <= i; i--) {
if (d[i] <= area[i+1] * 2 + 1) {
area[i] = area[i+1] + d[i];
} else {
area[i] = area[i+1];
}
//std::cout << i << " " << area[i] << std::endl;
}
loc[0] = D;
for (int i = 1; i <= N; i++) {
loc[i] = std::min(abs(loc[i-1] - d[i]), loc[i-1]);
//std::cout << i << " " << loc[i] << std::endl;
}
for (int i = 1; i <= Q; i++) {
if (loc[q[i]-1] > area[q[i]+1]) {
std::cout << "YES" << std::endl;
} else {
std::cout << "NO" << std::endl;
}
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:50:26: error: no matching function for call to 'min(int, long long int&)'
50 | loc[i] = std::min(abs(loc[i-1] - d[i]), loc[i-1]);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/istream:40,
from /usr/include/c++/14/fstream:40,
from a.cc:3:
/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:50:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
50 | loc[i] = std::min(abs(loc[i-1] - d[i]), loc[i-1]);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:5:
/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:50:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
50 | loc[i] = std::min(abs(loc[i-1] - d[i]), loc[i-1]);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s914723831 | p03743 | C++ | // ConsoleApplication7.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
using namespace std;
typedef long long i64;
int n;
int D;
int Q;
i64 d[500005];
i64 a[500005];
i64 b[500005];
i64 q[500005];
bool f[500005];
int main()
{
scanf("%d%d", &n, &D);
for (int i = 0; i < n; ++i) {
scanf("%d", d + i);
}
scanf("%d", &Q);
for (int i = 0; i < Q; ++i) {
scanf("%d", q + i);
--q[i];
}
b[n] = 1;
for (int i = 0; i < n; ++i) {
if (abs((i > 0 ? a[i - 1] : 0) + d[i] - D) < abs((i > 0 ? a[i - 1] : 0) - D)) {
a[i] = D - abs((i > 0 ? a[i - 1] : 0) + d[i] - D);
}
else {
a[i] = (i > 0 ? a[i - 1] : 0);
}
}
for (int i = n - 1; i >= 0; --i) {
if (d[i] >= 2 * b[i + 1]) {
b[i] = b[i + 1];
}
else {
b[i] = b[i + 1] + d[i];
}
}
for (int i = 0; i < Q; ++i) {
bool f = (q > 0 ? a[q[i] - 1] : 0) <= (D - b[q[i] + 1]);
if (f) {
printf("YES\n");
}
else {
printf("NO\n");
}
}
return 0;
}
| a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s081548527 | p03743 | C++ | // ConsoleApplication7.cpp : Defines the entry point for the console application.
//
#include "iostream"
using namespace std;
int n;
int D;
int Q;
long long d[500005];
long long a[500005];
long long b[500005];
long long d[500005];
long long q[500005];
bool f[500005];
int main()
{
scanf("%d%d", &n, &d);
for (int i = 0; i < n; ++i) {
scanf("%d", d + i);
}
scanf("%d", Q);
for (int i = 0; i < Q; ++i) {
scanf("%d", q + i);
--q[i];
}
b[n] = 1;
for (int i = 0; i < n; ++i) {
if (abs((i > 0 ? a[i - 1] : 0) + d[i] - D) < abs((i > 0 ? a[i - 1] : 0) - D)) {
a[i] = D - abs((i > 0 ? a[i - 1] : 0) + d[i] - D);
}
else {
a[i] = (i > 0 ? a[i - 1] : 0);
}
}
for (int i = n - 1; i >= 0; --i) {
if (d[i] >= 2 * b[i + 1]) {
b[i] = b[i + 1];
}
else {
b[i] = b[i + 1] + d[i];
}
}
for (int i = 0; i < Q; ++i) {
bool f = (q > 0 ? a[q[i] - 1] : 0) <= (D - b[q[i] + 1]);
if (f) {
printf("YES\n");
}
else {
printf("NO\n");
}
}
return 0;
}
| a.cc:13:11: error: redefinition of 'long long int d [500005]'
13 | long long d[500005];
| ^
a.cc:10:11: note: 'long long int d [500005]' previously declared here
10 | long long d[500005];
| ^
a.cc: In function 'int main()':
a.cc:45:29: error: ordered comparison of pointer with integer zero ('long long int*' and 'int')
45 | bool f = (q > 0 ? a[q[i] - 1] : 0) <= (D - b[q[i] + 1]);
| ~~^~~
|
s517074723 | p03743 | C++ | // ConsoleApplication7.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
using namespace std;
int n;
int D;
int Q;
long long d[500005];
long long a[500005];
long long b[500005];
long long d[500005];
long long q[500005];
bool f[500005];
int main()
{
scanf("%d%d", &n, &d);
for (int i = 0; i < n; ++i) {
scanf("%d", d + i);
}
scanf("%d", Q);
for (int i = 0; i < Q; ++i) {
scanf("%d", q + i);
--q[i];
}
b[n] = 1;
for (int i = 0; i < n; ++i) {
if (abs((i > 0 ? a[i - 1] : 0) + d[i] - D) < abs((i > 0 ? a[i - 1] : 0) - D)) {
a[i] = D - abs((i > 0 ? a[i - 1] : 0) + d[i] - D);
}
else {
a[i] = (i > 0 ? a[i - 1] : 0);
}
}
for (int i = n - 1; i >= 0; --i) {
if (d[i] >= 2 * b[i + 1]) {
b[i] = b[i + 1];
}
else {
b[i] = b[i + 1] + d[i];
}
}
for (int i = 0; i < Q; ++i) {
bool f = (q > 0 ? a[q[i] - 1] : 0) <= (D - b[q[i] + 1]);
if (f) {
printf("YES\n");
}
else {
printf("NO\n");
}
}
return 0;
}
| a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s985255485 | p03743 | C | #include<stdio.h>
#define abs(a) ((a)<0)?-(a):(a)
long d[500000],q[500000],a[500001],b[500001];
int main(int argc, char const *argv[]){
long n,d,Q,i;
scanf("%ld %ld",&n,&d);
a[0]=d;
for(i=0;i<n;i++){
scanf("%ld",&d[i]);
if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
else a[i+1]=a[i];
}
b[n]=1;
for(i=n-1;i>=0;i--){
if(b[i+1]<d[i]/2) b[i]=b[i+1];
else b[i]=b[i+1]+d[i];
}
scanf("%ld",&Q);
for(i=0;i<Q;i++){
scanf("%ld",&q[i]);
}
for(i=0;i<Q;i++){
if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
else printf("NO\n");
}
return 0;
} | main.c: In function 'main':
main.c:10:31: error: subscripted value is neither array nor pointer nor vector
10 | scanf("%ld",&d[i]);
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:16:28: error: subscripted value is neither array nor pointer nor vector
16 | if(b[i+1]<d[i]/2) b[i]=b[i+1];
| ^
main.c:17:35: error: subscripted value is neither array nor pointer nor vector
17 | else b[i]=b[i+1]+d[i];
| ^
|
s209770306 | p03743 | C | #include<stdio.h>
#define abs(a) ((a)<0)?-(a):(a)
long d[500000],q[500000],a[500001],b[500001];
int main(int argc, char const *argv[]){
long n,d,q,i;
scanf("%ld %ld",&n,&d);
a[0]=d;
for(i=0;i<n;i++){
scanf("%ld",&d[i]);
if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
else a[i+1]=a[i];
}
b[n]=1;
for(i=n-1;i>=0;i--){
if(b[i+1]<d[i]/2) b[i]=b[i+1];
else b[i]=b[i+1]+d[i];
}
scanf("%ld",&q);
for(i=0;i<q;i++){
scanf("%ld",&q[i]);
}
for(i=0;i<q;i++){
if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
else printf("NO\n");
}
return 0;
} | main.c: In function 'main':
main.c:10:31: error: subscripted value is neither array nor pointer nor vector
10 | scanf("%ld",&d[i]);
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a)
| ^
main.c:16:28: error: subscripted value is neither array nor pointer nor vector
16 | if(b[i+1]<d[i]/2) b[i]=b[i+1];
| ^
main.c:17:35: error: subscripted value is neither array nor pointer nor vector
17 | else b[i]=b[i+1]+d[i];
| ^
main.c:21:31: error: subscripted value is neither array nor pointer nor vector
21 | scanf("%ld",&q[i]);
| ^
main.c:24:23: error: subscripted value is neither array nor pointer nor vector
24 | if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
| ^
main.c:24:34: error: subscripted value is neither array nor pointer nor vector
24 | if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
| ^
|
s246139725 | p03743 | C | #include<stdio.h>
#define abs(a) ((a)<0)?-(a):(a);
long d[500000],q[500000],a[500001],b[500001];
int main(int argc, char const *argv[]){
long n,d,q,i;
scanf("%ld %ld",&n,&d);
a[0]=d;
for(i=0;i<n;i++){
scanf("%ld",&d[i]);
if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
else a[i+1]=a[i];
}
b[n]=1;
for(i=n-1;i>=0;i--){
if(b[i+1]<d[i]/2) b[i]=b[i+1];
else b[i]=b[i+1]+d[i];
}
scanf("%ld",&q);
for(i=0;i<q;i++){
scanf("%ld",&q[i]);
}
for(i=0;i<q;i++){
if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
else printf("NO\n");
}
return 0;
} | main.c: In function 'main':
main.c:10:31: error: subscripted value is neither array nor pointer nor vector
10 | scanf("%ld",&d[i]);
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:11:30: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:2:32: error: expected ')' before ';' token
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:11:20: note: in expansion of macro 'abs'
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^~~
main.c:11:19: note: to match this '('
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:18: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:26: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:11:58: error: subscripted value is neither array nor pointer nor vector
11 | if(abs(a[i]-d[i])<a[i]) a[i+1]=abs(a[i]-d[i]);
| ^
main.c:2:30: note: in definition of macro 'abs'
2 | #define abs(a) ((a)<0)?-(a):(a);
| ^
main.c:12:17: error: 'else' without a previous 'if'
12 | else a[i+1]=a[i];
| ^~~~
main.c:16:28: error: subscripted value is neither array nor pointer nor vector
16 | if(b[i+1]<d[i]/2) b[i]=b[i+1];
| ^
main.c:17:35: error: subscripted value is neither array nor pointer nor vector
17 | else b[i]=b[i+1]+d[i];
| ^
main.c:21:31: error: subscripted value is neither array nor pointer nor vector
21 | scanf("%ld",&q[i]);
| ^
main.c:24:23: error: subscripted value is neither array nor pointer nor vector
24 | if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
| ^
main.c:24:34: error: subscripted value is neither array nor pointer nor vector
24 | if(a[q[i]-1]>=b[q[i]]) printf("YES\n");
| ^
|
s999024835 | p03743 | C++ | #include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define MAX 500002
int n;
int d;
vector<long long int> v;
int q;
vector<int> ask[MAX];
bool ans[MAX];
void outt(){
for (int i = 0; i < q; i++){
if (ans[i] == false){
puts("NO");
}
else{
puts("YES");
}
}
exit(0);
}
int main(){
cin >> n >> d;
for (int i = 0; i < n; i++){
int a;
scanf("%d", &a);
v.push_back(a);
}
cin >> q;
for (int i = 0; i < q; i++){
int a;
scanf("%d", &a);
ask[a - 1].push_back(i);
}
long long int cur = d;
for (int i = 0; i < n; i++){
cur=min(cur,abs(cur-v[i]));
}
return 0;
}
エラー | a.cc:49:1: error: '\U000030a8\U000030e9\U000030fc' does not name a type
49 | エラー
| ^~~~~~
|
s193168206 | p03743 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,D;
cin>>n>>D;
vector<long long int> d(n);
for(int i=0;i<n;i++){
cin>>d[i];
}
int q;
cin>>q;
vector<long long int> dis(n);
dis[0]=D;
for(int i=1;i<n;i++){
dis[i]=min(dis[i-1],abs(dis[i-1]-d[i-1]));
}
for(int i=0;i<q;i++){
int query;
cin>>query;
query--;
int k=dis[query];
for(int i=query+1;i<n;i++){
k=min(max(k-d[i],d[i]/2),k);
}
if(k==0) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:27:12: error: no matching function for call to 'min(const long long int&, int&)'
27 | k=min(max(k-d[i],d[i]/2),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: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:27:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
27 | k=min(max(k-d[i],d[i]/2),k);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
/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:
/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:27:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
27 | k=min(max(k-d[i],d[i]/2),k);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
|
s535512808 | p03743 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,D;
cin>>n>>D;
vector<long long int> d(n);
for(int i=0;i<n;i++){
cin>>d[i];
}
int q;
cin>>q;
vector<long long int> dis(n);
dis[0]=D;
for(int i=1;i<n;i++){
dis[i]=min(dis[i-1],abs(dis[i-1]-d[i-1]));
}
for(int i=0;i<q;i++){
int query;
cin>>query;
query--;
int k=dis[query];
for(int i=query+1;i<n;i++){
k=min(max(k-d[i],d[i]/2),k);
}
if(k==0) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:27:12: error: no matching function for call to 'min(const long long int&, int&)'
27 | k=min(max(k-d[i],d[i]/2),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: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:27:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
27 | k=min(max(k-d[i],d[i]/2),k);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
/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:
/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:27:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
27 | k=min(max(k-d[i],d[i]/2),k);
| ~~~^~~~~~~~~~~~~~~~~~~~~~
|
s416988254 | p03744 | C++ | #include<bits/stdc++.h>
using namespace std;
#define INFS (1LL<<28)
#define DEKAI 1000000007
//#define MOD 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,n) for(int i=1;i<=n;i++)
#define all(c) begin(c), end(c)
//#define int long long
namespace {
#define __DECLARE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &, const C<T> &);
#define __DECLAREM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &, const C<T, U> &);
__DECLARE__(std::vector)
__DECLARE__(std::deque)
__DECLARE__(std::set)
__DECLARE__(std::stack)
__DECLARE__(std::queue)
__DECLARE__(std::priority_queue)
__DECLARE__(std::unordered_set)
__DECLAREM__(std::map)
__DECLAREM__(std::unordered_map)
template <typename T, typename U>
std::ostream &operator<<(std::ostream &, const std::pair<T, U> &);
template <typename... T>
std::ostream &operator<<(std::ostream &, const std::tuple<T...> &);
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &, const std::array<T, N> &);
template <typename Tuple, std::size_t N>
struct __TuplePrinter__ {
static void print(std::ostream &os, const Tuple &t) {
__TuplePrinter__<Tuple, N - 1>::print(os, t);
os << ", " << std::get<N - 1>(t);
}
};
template <typename Tuple>
struct __TuplePrinter__<Tuple, 1> {
static void print(std::ostream &os, const Tuple &t) { os << std::get<0>(t); }
};
template <typename... T>
std::ostream &operator<<(std::ostream &os, const std::tuple<T...> &t) {
os << '(';
__TuplePrinter__<decltype(t), sizeof...(T)>::print(os, t);
os << ')';
return os;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &v) {
return os << '(' << v.first << ", " << v.second << ')';
}
#define __INNER__ \
os << '['; \
for (auto it = begin(c); it != end(c);) { \
os << *it; \
os << (++it != end(c) ? ", " : ""); \
} \
return os << ']';
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &os, const std::array<T, N> &c) {
__INNER__
}
#define __DEFINE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
__INNER__ \
}
#define __DEFINEM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &os, const C<T, U> &c) { \
__INNER__ \
}
#define __DEFINEW__(C, M1, M2) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
std::deque<T> v; \
for (auto d = c; !d.empty(); d.pop()) v.M1(d.M2()); \
return os << v; \
}
__DEFINE__(std::vector)
__DEFINE__(std::deque)
__DEFINE__(std::set)
__DEFINEW__(std::stack, push_front, top)
__DEFINEW__(std::queue, push_back, front)
__DEFINEW__(std::priority_queue, push_front, top)
__DEFINE__(std::unordered_set)
__DEFINEM__(std::map)
__DEFINEM__(std::unordered_map)
}
#define pii pair<int,int>
#define ll long long
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// modint
template <signed M, unsigned T>
struct mod_int {
constexpr static signed MODULO = M;
constexpr static unsigned TABLE_SIZE = T;
signed x;
mod_int() : x(0) {}
mod_int(long long y) : x(static_cast<signed>(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO)) {}
mod_int(int y) : x(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO) {}
mod_int &operator+=(const mod_int &rhs) {
if ((x += rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator-=(const mod_int &rhs) {
if ((x += MODULO - rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator*=(const mod_int &rhs) {
x = static_cast<signed>(1LL * x * rhs.x % MODULO);
return *this;
}
mod_int &operator/=(const mod_int &rhs) {
x = static_cast<signed>((1LL * x * rhs.inv().x) % MODULO);
return *this;
}
mod_int operator-() const { return mod_int(-x); }
mod_int operator+(const mod_int &rhs) const { return mod_int(*this) += rhs; }
mod_int operator-(const mod_int &rhs) const { return mod_int(*this) -= rhs; }
mod_int operator*(const mod_int &rhs) const { return mod_int(*this) *= rhs; }
mod_int operator/(const mod_int &rhs) const { return mod_int(*this) /= rhs; }
bool operator<(const mod_int &rhs) const { return x < rhs.x; }
mod_int inv() const {
assert(x != 0);
if (x <= static_cast<signed>(TABLE_SIZE)) {
if (_inv[1].x == 0) prepare();
return _inv[x];
} else {
signed a = x, b = MODULO, u = 1, v = 0, t;
while (b) {
t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
return mod_int(u);
}
}
mod_int pow(long long t) const {
assert(!(x == 0 && t == 0));
mod_int e = *this, res = mod_int(1);
for (; t; e *= e, t >>= 1)
if (t & 1) res *= e;
return res;
}
mod_int fact() {
if (_fact[0].x == 0) prepare();
return _fact[x];
}
mod_int inv_fact() {
if (_fact[0].x == 0) prepare();
return _inv_fact[x];
}
mod_int choose(mod_int y) {
assert(y.x <= x);
return this->fact() * y.inv_fact() * mod_int(x - y.x).inv_fact();
}
static mod_int _inv[TABLE_SIZE + 1];
static mod_int _fact[TABLE_SIZE + 1];
static mod_int _inv_fact[TABLE_SIZE + 1];
static void prepare() {
_inv[1] = 1;
for (int i = 2; i <= (int)TABLE_SIZE; ++i) {
_inv[i] = 1LL * _inv[MODULO % i].x * (MODULO - MODULO / i) % MODULO;
}
_fact[0] = 1;
for (unsigned i = 1; i <= TABLE_SIZE; ++i) {
_fact[i] = _fact[i - 1] * int(i);
}
_inv_fact[TABLE_SIZE] = _fact[TABLE_SIZE].inv();
for (int i = (int)TABLE_SIZE - 1; i >= 0; --i) {
_inv_fact[i] = _inv_fact[i + 1] * (i + 1);
}
}
};
template <int M, unsigned F>
std::ostream &operator<<(std::ostream &os, const mod_int<M, F> &rhs) {
return os << rhs.x;
}
template <int M, unsigned F>
std::istream &operator>>(std::istream &is, mod_int<M, F> &rhs) {
long long s;
is >> s;
rhs = mod_int<M, F>(s);
return is;
}
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
bool operator==(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return lhs.x == rhs.x;
}
template <int M, unsigned F>
bool operator!=(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return !(lhs == rhs);
}
const int MF = 1000010;
const int MOD = 1000000007;
using mint = mod_int<MOD, MF>;
mint binom(int n, int r) { return (r < 0 || r > n || n < 0) ? 0 : mint(n).choose(r); }
mint fact(int n) { return mint(n).fact(); }
mint inv_fact(int n) { return mint(n).inv_fact(); }
// above
#define int long long
#define double long double
vector<pair<double,double>> v;
vector<pair<int,int>> as;
double getval(int need){
if(need==0)return 0;
double ans=0;
for(int i=v.size()-1;i>=0;i--){
if(i%100==0&&i!=0){
int j=i/100;
int l=as[j].second;
if(l!=-1){
int val=as[j].first*l;
if(need>l){
ans+=val;
need-=l;
i-=99;
continue;
}
}
}
double l=v[i].second;
double val=v[i].first*l;
if(need<=l){
ans+=val*need/l;
return ans;
}
else{
ans+=val;
need-=l;
}
}
assert(false);
}
signed main(){
cout<<fixed<<setprecision(10);
double n,l;
cin>>n>>l;
int befg=-1,vcnt=102;
lp(i,n){
if(v.size()==vcnt){
long long val=0;
int totall=0;
for(int z=vcnt-101;z<vcnt-1;z++){
totall+=v[z].second;
}
if(totall>=l){
as.push_back({-1,-1});
}
for(int z=vcnt-101;z<vcnt-1;z++){
val+=v[z].first*v[z].second;
}
as.push_back({(long double)val/totall,totall});
vcnt+=100;
}
double a,b;
cin>>a>>b;
double x=a*b+getval(l-b);
cout<<x/l<<endl;
if(befg>a){
int z=v.size()-1;
int ls=v[z].second;
double val=v[z].first*ls;
double lbs=min(l-b,(double)ls);
double remv=a*b+val*(lbs)/ls;
v[z]={(remv)/(lbs+b),lbs+b};
}
else{
v.push_back({(a*b)/(b),b});
}
befg=a;
//cout<<v<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:267:16: error: 'long long' specified with 'double'
267 | #define double long double
| ^~~~
a.cc:320:45: note: in expansion of macro 'double'
320 | as.push_back({(long double)val/totall,totall});
| ^~~~~~
|
s085683019 | p03744 | C++ | #include<bits/stdc++.h>
using namespace std;
#define INFS (1LL<<28)
#define DEKAI 1000000007
//#define MOD 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,n) for(int i=1;i<=n;i++)
#define all(c) begin(c), end(c)
//#define int long long
namespace {
#define __DECLARE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &, const C<T> &);
#define __DECLAREM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &, const C<T, U> &);
__DECLARE__(std::vector)
__DECLARE__(std::deque)
__DECLARE__(std::set)
__DECLARE__(std::stack)
__DECLARE__(std::queue)
__DECLARE__(std::priority_queue)
__DECLARE__(std::unordered_set)
__DECLAREM__(std::map)
__DECLAREM__(std::unordered_map)
template <typename T, typename U>
std::ostream &operator<<(std::ostream &, const std::pair<T, U> &);
template <typename... T>
std::ostream &operator<<(std::ostream &, const std::tuple<T...> &);
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &, const std::array<T, N> &);
template <typename Tuple, std::size_t N>
struct __TuplePrinter__ {
static void print(std::ostream &os, const Tuple &t) {
__TuplePrinter__<Tuple, N - 1>::print(os, t);
os << ", " << std::get<N - 1>(t);
}
};
template <typename Tuple>
struct __TuplePrinter__<Tuple, 1> {
static void print(std::ostream &os, const Tuple &t) { os << std::get<0>(t); }
};
template <typename... T>
std::ostream &operator<<(std::ostream &os, const std::tuple<T...> &t) {
os << '(';
__TuplePrinter__<decltype(t), sizeof...(T)>::print(os, t);
os << ')';
return os;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &v) {
return os << '(' << v.first << ", " << v.second << ')';
}
#define __INNER__ \
os << '['; \
for (auto it = begin(c); it != end(c);) { \
os << *it; \
os << (++it != end(c) ? ", " : ""); \
} \
return os << ']';
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &os, const std::array<T, N> &c) {
__INNER__
}
#define __DEFINE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
__INNER__ \
}
#define __DEFINEM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &os, const C<T, U> &c) { \
__INNER__ \
}
#define __DEFINEW__(C, M1, M2) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
std::deque<T> v; \
for (auto d = c; !d.empty(); d.pop()) v.M1(d.M2()); \
return os << v; \
}
__DEFINE__(std::vector)
__DEFINE__(std::deque)
__DEFINE__(std::set)
__DEFINEW__(std::stack, push_front, top)
__DEFINEW__(std::queue, push_back, front)
__DEFINEW__(std::priority_queue, push_front, top)
__DEFINE__(std::unordered_set)
__DEFINEM__(std::map)
__DEFINEM__(std::unordered_map)
}
#define pii pair<int,int>
#define ll long long
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// modint
template <signed M, unsigned T>
struct mod_int {
constexpr static signed MODULO = M;
constexpr static unsigned TABLE_SIZE = T;
signed x;
mod_int() : x(0) {}
mod_int(long long y) : x(static_cast<signed>(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO)) {}
mod_int(int y) : x(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO) {}
mod_int &operator+=(const mod_int &rhs) {
if ((x += rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator-=(const mod_int &rhs) {
if ((x += MODULO - rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator*=(const mod_int &rhs) {
x = static_cast<signed>(1LL * x * rhs.x % MODULO);
return *this;
}
mod_int &operator/=(const mod_int &rhs) {
x = static_cast<signed>((1LL * x * rhs.inv().x) % MODULO);
return *this;
}
mod_int operator-() const { return mod_int(-x); }
mod_int operator+(const mod_int &rhs) const { return mod_int(*this) += rhs; }
mod_int operator-(const mod_int &rhs) const { return mod_int(*this) -= rhs; }
mod_int operator*(const mod_int &rhs) const { return mod_int(*this) *= rhs; }
mod_int operator/(const mod_int &rhs) const { return mod_int(*this) /= rhs; }
bool operator<(const mod_int &rhs) const { return x < rhs.x; }
mod_int inv() const {
assert(x != 0);
if (x <= static_cast<signed>(TABLE_SIZE)) {
if (_inv[1].x == 0) prepare();
return _inv[x];
} else {
signed a = x, b = MODULO, u = 1, v = 0, t;
while (b) {
t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
return mod_int(u);
}
}
mod_int pow(long long t) const {
assert(!(x == 0 && t == 0));
mod_int e = *this, res = mod_int(1);
for (; t; e *= e, t >>= 1)
if (t & 1) res *= e;
return res;
}
mod_int fact() {
if (_fact[0].x == 0) prepare();
return _fact[x];
}
mod_int inv_fact() {
if (_fact[0].x == 0) prepare();
return _inv_fact[x];
}
mod_int choose(mod_int y) {
assert(y.x <= x);
return this->fact() * y.inv_fact() * mod_int(x - y.x).inv_fact();
}
static mod_int _inv[TABLE_SIZE + 1];
static mod_int _fact[TABLE_SIZE + 1];
static mod_int _inv_fact[TABLE_SIZE + 1];
static void prepare() {
_inv[1] = 1;
for (int i = 2; i <= (int)TABLE_SIZE; ++i) {
_inv[i] = 1LL * _inv[MODULO % i].x * (MODULO - MODULO / i) % MODULO;
}
_fact[0] = 1;
for (unsigned i = 1; i <= TABLE_SIZE; ++i) {
_fact[i] = _fact[i - 1] * int(i);
}
_inv_fact[TABLE_SIZE] = _fact[TABLE_SIZE].inv();
for (int i = (int)TABLE_SIZE - 1; i >= 0; --i) {
_inv_fact[i] = _inv_fact[i + 1] * (i + 1);
}
}
};
template <int M, unsigned F>
std::ostream &operator<<(std::ostream &os, const mod_int<M, F> &rhs) {
return os << rhs.x;
}
template <int M, unsigned F>
std::istream &operator>>(std::istream &is, mod_int<M, F> &rhs) {
long long s;
is >> s;
rhs = mod_int<M, F>(s);
return is;
}
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
bool operator==(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return lhs.x == rhs.x;
}
template <int M, unsigned F>
bool operator!=(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return !(lhs == rhs);
}
const int MF = 1000010;
const int MOD = 1000000007;
using mint = mod_int<MOD, MF>;
mint binom(int n, int r) { return (r < 0 || r > n || n < 0) ? 0 : mint(n).choose(r); }
mint fact(int n) { return mint(n).fact(); }
mint inv_fact(int n) { return mint(n).inv_fact(); }
// above
#define int long long
#define double long double
vector<pair<double,double>> v;
vector<pair<int,int>> as;
double getval(int need){
if(need==0)return 0;
double ans=0;
for(int i=v.size()-1;i>=0;i--){
if(i%100==0&&i!=0){
int j=i/100;
int l=as[j].second;
int val=as[j].first*l;
if(need>l){
ans+=val;
need-=l;
i-=99;
continue;
}
}
double l=v[i].second;
double val=v[i].first*l;
if(need<=l){
ans+=val*need/l;
return ans;
}
else{
ans+=val;
need-=l;
}
}
assert(false);
}
signed main(){
cout<<fixed<<setprecision(10);
double n,l;
cin>>n>>l;
int befg=-1,vcnt=102;
lp(i,n){
if(v.size()==vcnt){
double val=0;
int l=0;
for(int i=vcnt-101;i<vcnt-1;i++){
val=(v[i].first)/l+(val)/v[i].second;
l+=v[i].second;
}
as.push_back({val,l});
vcnt+=100;
}
double a,b;
cin>>a>>b;
double x=a*b+getval(l-b);
cout<<x/l<<endl;
if(befg>a){
int z=v.size()-1;
int ls=v[z].second;
double val=v[z].first*ls;
double lbs=min(l-b,ls);
double remv=a*b+val*(lbs)/ls;
v[z]={(remv)/(lbs+b),lbs+b};
}
else{
v.push_back({(a*b)/(b),b});
}
befg=a;
//cout<<v<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:324:39: error: no matching function for call to 'min(long double, long long int&)'
324 | double lbs=min(l-b,ls);
| ~~~^~~~~~~~
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: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:324:39: note: deduced conflicting types for parameter 'const _Tp' ('long double' and 'long long int')
324 | double lbs=min(l-b,ls);
| ~~~^~~~~~~~
/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:
/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:324:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long double'
324 | double lbs=min(l-b,ls);
| ~~~^~~~~~~~
|
s894382811 | p03744 | C++ | #include<bits/stdc++.h>
using namespace std;
#define INFS (1LL<<28)
#define DEKAI 1000000007
//#define MOD 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,n) for(int i=1;i<=n;i++)
#define all(c) begin(c), end(c)
//#define int long long
namespace {
#define __DECLARE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &, const C<T> &);
#define __DECLAREM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &, const C<T, U> &);
__DECLARE__(std::vector)
__DECLARE__(std::deque)
__DECLARE__(std::set)
__DECLARE__(std::stack)
__DECLARE__(std::queue)
__DECLARE__(std::priority_queue)
__DECLARE__(std::unordered_set)
__DECLAREM__(std::map)
__DECLAREM__(std::unordered_map)
template <typename T, typename U>
std::ostream &operator<<(std::ostream &, const std::pair<T, U> &);
template <typename... T>
std::ostream &operator<<(std::ostream &, const std::tuple<T...> &);
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &, const std::array<T, N> &);
template <typename Tuple, std::size_t N>
struct __TuplePrinter__ {
static void print(std::ostream &os, const Tuple &t) {
__TuplePrinter__<Tuple, N - 1>::print(os, t);
os << ", " << std::get<N - 1>(t);
}
};
template <typename Tuple>
struct __TuplePrinter__<Tuple, 1> {
static void print(std::ostream &os, const Tuple &t) { os << std::get<0>(t); }
};
template <typename... T>
std::ostream &operator<<(std::ostream &os, const std::tuple<T...> &t) {
os << '(';
__TuplePrinter__<decltype(t), sizeof...(T)>::print(os, t);
os << ')';
return os;
}
template <typename T, typename U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> &v) {
return os << '(' << v.first << ", " << v.second << ')';
}
#define __INNER__ \
os << '['; \
for (auto it = begin(c); it != end(c);) { \
os << *it; \
os << (++it != end(c) ? ", " : ""); \
} \
return os << ']';
template <typename T, std::size_t N>
std::ostream &operator<<(std::ostream &os, const std::array<T, N> &c) {
__INNER__
}
#define __DEFINE__(C) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
__INNER__ \
}
#define __DEFINEM__(C) \
template <typename T, typename U> \
std::ostream &operator<<(std::ostream &os, const C<T, U> &c) { \
__INNER__ \
}
#define __DEFINEW__(C, M1, M2) \
template <typename T> \
std::ostream &operator<<(std::ostream &os, const C<T> &c) { \
std::deque<T> v; \
for (auto d = c; !d.empty(); d.pop()) v.M1(d.M2()); \
return os << v; \
}
__DEFINE__(std::vector)
__DEFINE__(std::deque)
__DEFINE__(std::set)
__DEFINEW__(std::stack, push_front, top)
__DEFINEW__(std::queue, push_back, front)
__DEFINEW__(std::priority_queue, push_front, top)
__DEFINE__(std::unordered_set)
__DEFINEM__(std::map)
__DEFINEM__(std::unordered_map)
}
#define pii pair<int,int>
#define ll long long
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// modint
template <signed M, unsigned T>
struct mod_int {
constexpr static signed MODULO = M;
constexpr static unsigned TABLE_SIZE = T;
signed x;
mod_int() : x(0) {}
mod_int(long long y) : x(static_cast<signed>(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO)) {}
mod_int(int y) : x(y >= 0 ? y % MODULO : MODULO - (-y) % MODULO) {}
mod_int &operator+=(const mod_int &rhs) {
if ((x += rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator-=(const mod_int &rhs) {
if ((x += MODULO - rhs.x) >= MODULO) x -= MODULO;
return *this;
}
mod_int &operator*=(const mod_int &rhs) {
x = static_cast<signed>(1LL * x * rhs.x % MODULO);
return *this;
}
mod_int &operator/=(const mod_int &rhs) {
x = static_cast<signed>((1LL * x * rhs.inv().x) % MODULO);
return *this;
}
mod_int operator-() const { return mod_int(-x); }
mod_int operator+(const mod_int &rhs) const { return mod_int(*this) += rhs; }
mod_int operator-(const mod_int &rhs) const { return mod_int(*this) -= rhs; }
mod_int operator*(const mod_int &rhs) const { return mod_int(*this) *= rhs; }
mod_int operator/(const mod_int &rhs) const { return mod_int(*this) /= rhs; }
bool operator<(const mod_int &rhs) const { return x < rhs.x; }
mod_int inv() const {
assert(x != 0);
if (x <= static_cast<signed>(TABLE_SIZE)) {
if (_inv[1].x == 0) prepare();
return _inv[x];
} else {
signed a = x, b = MODULO, u = 1, v = 0, t;
while (b) {
t = a / b;
a -= t * b;
std::swap(a, b);
u -= t * v;
std::swap(u, v);
}
return mod_int(u);
}
}
mod_int pow(long long t) const {
assert(!(x == 0 && t == 0));
mod_int e = *this, res = mod_int(1);
for (; t; e *= e, t >>= 1)
if (t & 1) res *= e;
return res;
}
mod_int fact() {
if (_fact[0].x == 0) prepare();
return _fact[x];
}
mod_int inv_fact() {
if (_fact[0].x == 0) prepare();
return _inv_fact[x];
}
mod_int choose(mod_int y) {
assert(y.x <= x);
return this->fact() * y.inv_fact() * mod_int(x - y.x).inv_fact();
}
static mod_int _inv[TABLE_SIZE + 1];
static mod_int _fact[TABLE_SIZE + 1];
static mod_int _inv_fact[TABLE_SIZE + 1];
static void prepare() {
_inv[1] = 1;
for (int i = 2; i <= (int)TABLE_SIZE; ++i) {
_inv[i] = 1LL * _inv[MODULO % i].x * (MODULO - MODULO / i) % MODULO;
}
_fact[0] = 1;
for (unsigned i = 1; i <= TABLE_SIZE; ++i) {
_fact[i] = _fact[i - 1] * int(i);
}
_inv_fact[TABLE_SIZE] = _fact[TABLE_SIZE].inv();
for (int i = (int)TABLE_SIZE - 1; i >= 0; --i) {
_inv_fact[i] = _inv_fact[i + 1] * (i + 1);
}
}
};
template <int M, unsigned F>
std::ostream &operator<<(std::ostream &os, const mod_int<M, F> &rhs) {
return os << rhs.x;
}
template <int M, unsigned F>
std::istream &operator>>(std::istream &is, mod_int<M, F> &rhs) {
long long s;
is >> s;
rhs = mod_int<M, F>(s);
return is;
}
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
mod_int<M, F> mod_int<M, F>::_inv_fact[TABLE_SIZE + 1];
template <int M, unsigned F>
bool operator==(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return lhs.x == rhs.x;
}
template <int M, unsigned F>
bool operator!=(const mod_int<M, F> &lhs, const mod_int<M, F> &rhs) {
return !(lhs == rhs);
}
const int MF = 1000010;
const int MOD = 1000000007;
using mint = mod_int<MOD, MF>;
mint binom(int n, int r) { return (r < 0 || r > n || n < 0) ? 0 : mint(n).choose(r); }
mint fact(int n) { return mint(n).fact(); }
mint inv_fact(int n) { return mint(n).inv_fact(); }
// above
#define int long long
#define double long double
vector<pair<int,int>> v;
vector<pair<int,int>> as;
double getval(int need){
if(need==0)return 0;
double ans=0;
for(int i=v.size()-1;i>=0;i--){
if(i%100==0&&i!=0){
int j=i/100;
double val=as[j].first;
double l=as[j].second;
if(need>l){
ans+=val;
need-=l;
i-=99;
continue;
}
}
double val=v[i].first;
double l=v[i].second;
if(need<=l){
ans+=val*need/l;
return ans;
}
else{
ans+=val;
need-=l;
}
}
assert(false);
}
signed main(){
cout<<fixed<<setprecision(10);
int n,l;
cin>>n>>l;
int befg=-1,vcnt=101;
lp(i,n){
if(v.size()==vcnt){
int val=0,l=0;
for(int i=vcnt-100;i<vcnt){
val+=v[i].first;
l+=v[i].second;
}
as.push_back({val,l});
}
double a,b;
cin>>a>>b;
double x=a*b+getval(l-b);
cout<<x/l<<endl;
if(befg>a){
int z=v.size()-1;
double val=v[z].first;
double ls=v[z].second;
double lbs=min(l-b,ls);
double remv=a*b+val*(lbs)/ls;
v[z]={remv+0.5,lbs+0.5+b};
}
else{
v.push_back({a*b+0.5,b+0.5});
}
befg=a;
//cout<<v<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:308:50: error: expected ';' before ')' token
308 | for(int i=vcnt-100;i<vcnt){
| ^
| ;
|
s980320549 | p03744 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define fo(i,j,k) for(i=j;i<=k;i++)
#define fd(i,j,k) for(i=j;i>=k;i--)
const int N=1e6+5,mo=998244353;
struct rec
{
ll v;
db t;
}s[N];
ll sum,t[N],v[N],l,r,n,L,prod,i,dec;
int main()
{
scanf("%lld %lld",&n,&L);
l=1;
r=0;
fo(i,1,n)
{
scanf("%lld %lld",t+i,v+i);
while (sum+v[i]>L)
{
dec=min(s[l].v,sum+v[i]-L);
s[l].v-=dec;
sum-=dec;
prod-=dec*s[l].t;
if (!s[l].v) l++;
}
s[++r]={v[i],t[i]};
prod+=v[i]*t[i];
sum+=v[i];
while (l<r&&s[r].t<s[r-1].t)
{
s[r-1].t=(s[r-1].t*s[r-1].v+s[r].t*s[r].v)/(s[r-1].v+s[r].v);
s[r-1].v+=s[r].v;
r--;
}
printf("%lf\n",(db)prod/L);
}
} | a.cc: In function 'int main()':
a.cc:24:13: error: reference to 'dec' is ambiguous
24 | dec=min(s[l].v,sum+v[i]-L);
| ^~~
In file included from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:1079:3: note: candidates are: 'std::ios_base& std::dec(ios_base&)'
1079 | dec(ios_base& __base)
| ^~~
a.cc:13:33: note: 'll dec'
13 | ll sum,t[N],v[N],l,r,n,L,prod,i,dec;
| ^~~
a.cc:25:21: error: reference to 'dec' is ambiguous
25 | s[l].v-=dec;
| ^~~
/usr/include/c++/14/bits/ios_base.h:1079:3: note: candidates are: 'std::ios_base& std::dec(ios_base&)'
1079 | dec(ios_base& __base)
| ^~~
a.cc:13:33: note: 'll dec'
13 | ll sum,t[N],v[N],l,r,n,L,prod,i,dec;
| ^~~
a.cc:26:18: error: reference to 'dec' is ambiguous
26 | sum-=dec;
| ^~~
/usr/include/c++/14/bits/ios_base.h:1079:3: note: candidates are: 'std::ios_base& std::dec(ios_base&)'
1079 | dec(ios_base& __base)
| ^~~
a.cc:13:33: note: 'll dec'
13 | ll sum,t[N],v[N],l,r,n,L,prod,i,dec;
| ^~~
a.cc:27:19: error: reference to 'dec' is ambiguous
27 | prod-=dec*s[l].t;
| ^~~
/usr/include/c++/14/bits/ios_base.h:1079:3: note: candidates are: 'std::ios_base& std::dec(ios_base&)'
1079 | dec(ios_base& __base)
| ^~~
a.cc:13:33: note: 'll dec'
13 | ll sum,t[N],v[N],l,r,n,L,prod,i,dec;
| ^~~
a.cc:30:25: warning: narrowing conversion of 't[i]' from 'll' {aka 'long long int'} to 'db' {aka 'double'} [-Wnarrowing]
30 | s[++r]={v[i],t[i]};
| ~~~^
|
s744321003 | p03744 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ld long double
#define PI pair<ld,ll>
#define S second
#define F first
const int N=500005;
int n,L,top;
PI q[N];
ll sum[N];
ld ans[N];
PI operator +(PI a,PI b){
return mp((a.F*a.S+b.F*b.S)/(a.S+b.S),a.S+b.S);
}
int main(){
scanf("%d%d",&n,&L);
for(int i=1;i<=n;i++){
int t,v; scanf("%d%d",&t,&v);
PI dq=mp(t,v);
while(top&&q[top]>dq){if(q[top].S+dq.S>L)q[top].S=L-dq.S; dq=dq+q[top--]; }
q[++top]=dq; sum[top]=sum[top-1]+dq.S; ans[top]=ans[top-1]+dq.F*dq.S;
int pos=lower_bound(&sum[1],&sum[top+1],sum[top]-L)-sum;
printf("%.7lf\n",(double)((ans[top]-ans[pos]+q[pos].F*(L-(sum[top]-sum[pos])))/L));
}
} | a.cc: In function 'std::pair<long double, long long int> operator+(std::pair<long double, long long int>, std::pair<long double, long long int>)':
a.cc:14:16: error: 'mp' was not declared in this scope
14 | return mp((a.F*a.S+b.F*b.S)/(a.S+b.S),a.S+b.S);
| ^~
a.cc: In function 'int main()':
a.cc:20:23: error: 'mp' was not declared in this scope
20 | PI dq=mp(t,v);
| ^~
|
s604726124 | p03744 | C++ | #include <iostream>
#include <cstdio>
#include <deque>
#include <iomanip>
using namespace std;
#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)
typedef pair<int , int> pt;
int n;
int L;
void ReadData() {
cin >> n >> L;
}
deque<pair<long double, long long> > qu;
void Process() {
cout << fixed << setprecision(6);
long long sumRem = 0;
long double sumTV = 0;
For(i,1,n) {
int t,v; cin >> t >> v;
if (sz(qu) == 0) {
qu.push_back(make_pair(t,v));
sumRem += v;
sumTV += 1LL * v * t;
cout << t << "\n";
continue;
}
while (sumRem + v > L) {
auto &cur = qu.front();
if (cur.second <= (sumRem + v) - L) {
sumRem -= cur.second;
sumTV -= #include <iostream>
#include <cstdio>
#include <deque>
#include <iomanip>
using namespace std;
#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)
typedef pair<int , int> pt;
int n;
int L;
void ReadData() {
cin >> n >> L;
}
deque<pair<long double, long long> > qu;
void Process() {
cout << fixed << setprecision(6);
long long sumRem = 0;
long double sumTV = 0;
For(i,1,n) {
int t,v; cin >> t >> v;
if (sz(qu) == 0) {
qu.push_back(make_pair(t,v));
sumRem += v;
sumTV += 1LL * v * t;
cout << t << "\n";
continue;
}
while (sumRem + v > L) {
auto &cur = qu.front();
if (cur.second <= (sumRem + v) - L) {
sumRem -= cur.second;
sumTV -= 1LL * cur.first * cur.second;
qu.pop_front();
} else {
cur.second -= ((sumRem + v) - L);
sumTV -= cur.first *((sumRem + v) - L);
sumRem -= ((sumRem + v) - L);
}
}
long double res = (sumTV + 1LL * v * t) / (sumRem + v);
cout << (double) res << "\n";
pair<long double, long long> add = make_pair(t,v);
while (sz(qu) && qu.back().first >= add.first) {
add = make_pair( (qu.back().first * qu.back().second
+ add.first * add.second) / (qu.back().second + add.second),
qu.back().second + add.second );
sumRem -= qu.back().second;
sumTV -= qu.back().first * qu.back().second;
qu.pop_back();
}
qu.push_back(add);
sumRem += add.second;
sumTV += add.first * add.second;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen("input.inp" , "r" , stdin);
ReadData();
Process();
return 0;
} cur.first * cur.second;
qu.pop_back();
} else {
cur.second -= ((sumRem + v) - L);
sumTV -= cur.first *((sumRem + v) - L);
sumRem -= ((sumRem + v) - L);
}
}
long double res = (sumTV + 1LL * v * t) / (sumRem + v);
cout << (double) res << "\n";
pair<long double, long long> add = make_pair(t,v);
while (sz(qu) && qu.back().first >= add.first) {
add = make_pair( (qu.back().first * qu.back().second
+ add.first * add.second) / (qu.back().second + add.second),
qu.back().second + add.second );
sumRem -= qu.back().second;
sumTV -= qu.back().first * qu.back().second;
qu.pop_back();
}
qu.push_back(add);
sumRem += add.second;
sumTV += add.first * add.second;
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//freopen("input.inp" , "r" , stdin);
ReadData();
Process();
return 0;
} | a.cc:43:42: error: stray '#' in program
43 | sumTV -= #include <iostream>
| ^
a.cc: In function 'void Process()':
a.cc:43:43: error: 'include' was not declared in this scope
43 | sumTV -= #include <iostream>
| ^~~~~~~
a.cc:43:60: error: expected primary-expression before '>' token
43 | sumTV -= #include <iostream>
| ^
a.cc:48:1: error: expected primary-expression before 'using'
48 | using namespace std;
| ^~~~~
a.cc:62:17: error: a function-definition is not allowed here before '{' token
62 | void ReadData() {
| ^
a.cc:67:16: error: a function-definition is not allowed here before '{' token
67 | void Process() {
| ^
a.cc:111:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
111 | int main() {
| ^~
a.cc:111:9: note: remove parentheses to default-initialize a variable
111 | int main() {
| ^~
| --
a.cc:111:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:111:12: error: a function-definition is not allowed here before '{' token
111 | int main() {
| ^
|
s195326705 | p03745 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
int cnt = 0;
vector<int> A(N);
for(int i = 0; i < N; i++){
cin >> A.at(i);
}
for(int i = 0; i < N; i++){
// same を抜ける
while (i+1 < N && A[i] == A[i+1]) ++i;
// up
if (i+1 < N && A[i] < A[i+1]) {
while (i+1 < N && A[i] <= A[i+1]) ++i;
}
// down
else if (i+1 < N && A[i] > A[i+1]) {
while (i+1 < N && A[i] >= A[i+1]) ++i;
}
cnt++;
}
}
cout << cnt << endl;
} | a.cc:27:3: error: 'cout' does not name a type
27 | cout << cnt << endl;
| ^~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s275956920 | p03745 | C++ | int #include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
int cnt = 0;
vector<int> A(N);
for(int i = 0; i < N; i++){
cin >> A.at(i);
}
for(int i = 0; i < N; i++){
// same を抜ける
while (i+1 < N && A[i] == A[i+1]) ++i;
// up
if (i+1 < N && A[i] < A[i+1]) {
while (i+1 < N && A[i] <= A[i+1]) ++i;
}
// down
else if (i+1 < N && A[i] > A[i+1]) {
while (i+1 < N && A[i] >= A[i+1]) ++i;
}
cnt++;
}
}
cout << cnt << endl;
}
| a.cc:1:5: error: stray '#' in program
1 | int #include <bits/stdc++.h>
| ^
a.cc:1:14: error: expected initializer before '<' token
1 | int #include <bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:5:10: error: 'cin' was not declared in this scope
5 | int N; cin >> N;
| ^~~
a.cc:7:3: error: 'vector' was not declared in this scope
7 | vector<int> A(N);
| ^~~~~~
a.cc:7:10: error: expected primary-expression before 'int'
7 | vector<int> A(N);
| ^~~
a.cc:9:12: error: 'A' was not declared in this scope
9 | cin >> A.at(i);
| ^
a.cc:14:23: error: 'A' was not declared in this scope
14 | while (i+1 < N && A[i] == A[i+1]) ++i;
| ^
a.cc:17:20: error: 'A' was not declared in this scope
17 | if (i+1 < N && A[i] < A[i+1]) {
| ^
a.cc: At global scope:
a.cc:27:3: error: 'cout' does not name a type
27 | cout << cnt << endl;
| ^~~~
a.cc:28:1: error: expected declaration before '}' token
28 | }
| ^
|
s269133923 | p03745 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
int d[N];
for(int i=0;i<N;i++) cin >> d[i];
int count=1;
int needh=0;
for(int i=0;i<N;i++){
if(d[i]>[i+1] && needh==0)needh=1;
if(d[i]>[i+1] && needh==0)needh=-1;
if(needh==1 && d[i]<d[i+1]){
count++;
needh=0;
}
if(d[i]>d[i+1] && neeedh==-1){
count++;
needh=0;
}
}
cout << count << endl;
} | a.cc: In function 'int main()':
a.cc:14:11: error: expected ',' before '+' token
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^
| ,
a.cc:14:11: error: expected identifier before '+' token
a.cc: In lambda function:
a.cc:14:15: error: expected '{' before '&&' token
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
a.cc: In function 'int main()':
a.cc:14:8: error: no match for 'operator>' (operand types are 'int' and 'main()::<lambda()>')
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ~~~~^~~~~~
| | |
| | main()::<lambda()>
| int
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
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/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:14:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
14 | if(d[i]>[i+1] && needh==0)needh=1;
| ^~
/usr/include/c++/14/bits/basic_s |
s222774149 | p03745 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main() {
int N; cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i) cin >> A[i];
int res = 0;
//i+1<Nを条件に常に入れることが大事
for (int i = 0; i < N; ++i) {
// same を抜ける
while (i+1 < N && A[i] == A[i+1]) ++i;
// up
if (i+1 < N && A[i] < A[i+1]) {
while (i+1 < N && A[i] <= A[i+1]) ++i;
}
// down
else if (i+1 < N && A[i] > A[i+1]) {
while (i+1 < N && A[i] >= A[i+1]) ++i;
}
++res;
}
cout << res << endl;
| a.cc: In function 'int main()':
a.cc:30:25: error: expected '}' at end of input
30 | cout << res << endl;
| ^
a.cc:9:12: note: to match this '{'
9 | int main() {
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.