submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s504160932 | p00354 | C++ | #include <iostream>
using namespace std;char w[]="thufrisatsunmontuewed";int main(){cin >> i;cout << w[(i%7)*3] << w[(i%7)*3+1] << w[(i%7)*3+2] << endl;}
| a.cc: In function 'int main()':
a.cc:2:72: error: 'i' was not declared in this scope
2 | using namespace std;char w[]="thufrisatsunmontuewed";int main(){cin >> i;cout << w[(i%7)*3] << w[(i%7)*3+1] << w[(i%7)*3+2] << endl;}
| ^
|
s462406378 | p00355 | C | #include <iostream>
using namespace std;
int main(){
int a,b,n,s,f,i=0;
cin >> a >> b >> n;
do{
cin >> s >> f;
i++;
}while((a != s && b != f) && (s <= a && s >= b) && (f <= a && s >= b));
if(n == i-1){
cout << '0' << endl;
} else {
cout << '1' << endl;
}
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s004631270 | p00355 | C | #include <iostream>
using namespace std;
int main(){
int a,b,n,s,f,i=0;
cin >> a >> b >> n;
do{
cin >> s >> f;
i++;
}while((a != s && b != f) && (s <= a || s >= b) && (f <= a || f >= b) && i<n);
if(n == i-1){
cout << '0' << endl;
} else {
cout << '1' << endl;
}
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s194731342 | p00355 | C | #include <iostream>
using namespace std;
int main(){
int a,b,n,s,f,i=0;
cin >> a >> b >> n;
do{
cin >> s >> f;
i++;
}while((a != s && b != f) && (s <= a || s >= b) && (f <= a || f >= b) && i<n);
if(n == i){
cout << '0' << endl;
} else {
cout << '1' << endl;
}
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s741306706 | p00355 | C++ | c#include<iostream>
using namespace std;
int main(){
int a,b;
cin>>a,b;
int N;
cin>>N;
int s,f;
for(int i=0;i<N;i++){
cin>>s>>f;
if(a<f && b>s){
cout<<1<<endl;
return 0;
}
else if(a==s&&b==f){
cout<<1<<endl;
return 0;
}
}
cout<<0<<endl;
return 0;
}
| a.cc:1:2: error: stray '#' in program
1 | c#include<iostream>
| ^
a.cc:1:1: error: 'c' does not name a type
1 | c#include<iostream>
| ^
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
6 | cin>>a,b;
| ^~~
a.cc:13:7: error: 'cout' was not declared in this scope
13 | cout<<1<<endl;
| ^~~~
a.cc:13:16: error: 'endl' was not declared in this scope
13 | cout<<1<<endl;
| ^~~~
a.cc:17:7: error: 'cout' was not declared in this scope
17 | cout<<1<<endl;
| ^~~~
a.cc:17:16: error: 'endl' was not declared in this scope
17 | cout<<1<<endl;
| ^~~~
a.cc:21:3: error: 'cout' was not declared in this scope
21 | cout<<0<<endl;
| ^~~~
a.cc:21:12: error: 'endl' was not declared in this scope
21 | cout<<0<<endl;
| ^~~~
|
s037226041 | p00355 | C++ | #include<iostream>
#include<cassert>
using namespace std;
bool overlap(int a, int b, int c, int d){
assert( a < b ); assert( c < d );
int a = 0;
for ( int i = 0; i < 10000; i++ ) a += i;
if ( d <= a ) return false;
if ( b <= c ) return false;
return true;
}
bool notOverlap(int a, int b, int c, int d){
return b <= c || d <=a;
}
main(){
int a, b, s, f, n;
cin >> a >> b >> n;
for ( int i = 0; i < n; i++ ){
cin >> s >> f;
if ( overlap(a, b, s, f) ){
cout << 1 << endl;
return 0;
} else {
assert(notOverlap(a, b, s, f));
}
}
cout << 0 << endl;
return 0;
}
| a.cc: In function 'bool overlap(int, int, int, int)':
a.cc:7:7: error: declaration of 'int a' shadows a parameter
7 | int a = 0;
| ^
a.cc:5:18: note: 'int a' previously declared here
5 | bool overlap(int a, int b, int c, int d){
| ~~~~^
a.cc: At global scope:
a.cc:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
18 | main(){
| ^~~~
|
s653177924 | p00355 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
ll n, m, o, ans = 0, a, b;
int main() {
cin >> n >> m >> o;
rep(i, o) {
cin >> a >> b;
if (a > n&&a < m) ans = 1;
else if (b > n&&b < m) ans = 1;
}
cout << ans << endl;
return 0;
}
| a.cc:18:1: error: 'll' does not name a type
18 | ll n, m, o, ans = 0, a, b;
| ^~
a.cc: In function 'int main()':
a.cc:20:16: error: 'n' was not declared in this scope; did you mean 'yn'?
20 | cin >> n >> m >> o;
| ^
| yn
a.cc:20:21: error: 'm' was not declared in this scope; did you mean 'tm'?
20 | cin >> n >> m >> o;
| ^
| tm
a.cc:20:26: error: 'o' was not declared in this scope
20 | cin >> n >> m >> o;
| ^
a.cc:22:24: error: 'a' was not declared in this scope
22 | cin >> a >> b;
| ^
a.cc:22:29: error: 'b' was not declared in this scope
22 | cin >> a >> b;
| ^
a.cc:23:35: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | if (a > n&&a < m) ans = 1;
| ^~~
| abs
a.cc:24:40: error: 'ans' was not declared in this scope; did you mean 'abs'?
24 | else if (b > n&&b < m) ans = 1;
| ^~~
| abs
a.cc:26:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
26 | cout << ans << endl;
| ^~~
| abs
|
s844641792 | p00355 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b, N, s, f;
int ans = 0;
cin >> a >> b;
cin >> N;
for(int i = 0; i < N; i++){
cin >> s >> f;
//同じ時間を使用しているとき
if(a == s && b == f) ans =1;
//時間をすでに使用(被っている)させているとき
for(int j = s+1; j < f; j++){
if(a == j || b == j) ans = 1;
}
//時間の使い過ぎ
for(int k = a+1; k < b; k++){
if( k == s || k == f) ans = 1;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s516871524 | p00355 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s377729900 | p00355 | C++ | #include <iostream>
using namespace std;
vector<pair<int, int> > v;
int main() {
int a, b, N;
cin >> a >> b >> N;
for(int i=0; i<N; i++){
int s, f;
cin >> s >> f;
v.push_back(make_pair(s, f));
}
int ans=0;
for(int i=0; i<N; i++){
if(v[i].begin() < b && a < v[i].end()) ans=1;
}
cout << ans << endl;
} | a.cc:4:1: error: 'vector' does not name a type
4 | vector<pair<int, int> > v;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:11:5: error: 'v' was not declared in this scope
11 | v.push_back(make_pair(s, f));
| ^
a.cc:15:8: error: 'v' was not declared in this scope
15 | if(v[i].begin() < b && a < v[i].end()) ans=1;
| ^
|
s827291964 | p00355 | C++ | #include <iostream>
#include <vector>
using namespace std;
vector<pair<int, int> > v;
int main() {
int a, b, N;
cin >> a >> b >> N;
for(int i=0; i<N; i++){
int s, f;
cin >> s >> f;
v.push_back(make_pair(s, f));
}
int ans=0;
for(int i=0; i<N; i++){
if(v[i].begin() < b && a < v[i].end()) ans=1;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:16:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'begin'
16 | if(v[i].begin() < b && a < v[i].end()) ans=1;
| ^~~~~
a.cc:16:37: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'end'
16 | if(v[i].begin() < b && a < v[i].end()) ans=1;
| ^~~
|
s403243138 | p00355 | C++ | #include <iostream>
using namespace std;
bool filled[1005];
int main() {
int a, b, N;
cin >> a >> b >> N;
for(int i=0; i<1005; i++) filled[j]=false
for(int i=0; i<N; i++){
int s, f;
cin >> s >> f;
for(int j=s; j<f; j++) filled[j]=true;
}
int ans=0;
for(int i=a; i<b; i++){
if(filled[i]) ans=1;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:8:36: error: 'j' was not declared in this scope
8 | for(int i=0; i<1005; i++) filled[j]=false
| ^
a.cc:9:16: error: 'i' was not declared in this scope
9 | for(int i=0; i<N; i++){
| ^
|
s496160550 | p00355 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b; cin >> a >> b;
int n; cin >> n;
bool b = false;
for (int i = 0; i < n; i++) {
int c, d; cin >> c >> d;
if ((a < c&&c < b) || (a < d&&d < b)) {
b = true;
}
}
cout << b << endl;
} | a.cc: In function 'int main()':
a.cc:6:14: error: conflicting declaration 'bool b'
6 | bool b = false;
| ^
a.cc:4:16: note: previous declaration as 'int b'
4 | int a, b; cin >> a >> b;
| ^
|
s792416432 | p00355 | C++ | Hello | a.cc:1:1: error: 'Hello' does not name a type
1 | Hello
| ^~~~~
|
s843302613 | p00355 | C++ | #include <iostream>
using namespace std;
int main()
{
int a, b, N;
cin >> a;
cin >> b;
cin >> N;
int s[N], f[N];
for (int i=0; i<N; ++i)
{
cin >> s[i];
cin >> f[i];
}
sort(s, s+N);
sort(f, f+N);
int si = 0;
int fi = 0;
int counter = 0;
for (int i=0;; ++i)
{
if (si >= N) break;
if (fi >= N) break;
if (f[fi] == i) { --counter; ++fi; }
if (a <= i && i <= b && counter != 0)
{
cout << 1 << endl;
return 0;
}
if (s[si] == i) { ++counter; ++si; }
}
cout << 0 << endl;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
20 | sort(s, s+N);
| ^~~~
| short
|
s843864830 | p00355 | C++ | #include <iostream>
using namespace std;
int main()
{
int a, b, N;
cin >> a;
cin >> b;
cin >> N;
int s[N], f[N];
for (int i=0; i<N; ++i)
{
cin >> s[i];
cin >> f[i];
}
sort(s, s+N);
sort(f, f+N);
int si = 0;
int fi = 0;
int counter = 0;
for (int i=0;; ++i)
{
if (si >= N) break;
if (fi >= N) break;
if (f[fi] == i) { --counter; ++fi; }
if (a <= i && i <= b && counter != 0)
{
cout << 1 << endl;
return 0;
}
if (s[si] == i) { ++counter; ++si; }
}
cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
20 | sort(s, s+N);
| ^~~~
| short
|
s409976841 | p00355 | C++ | #include <iostream>
using namespace std;
int main()
{
int a, b, N;
cin >> a;
cin >> b;
cin >> N;
int s[N], f[N];
for (int i=0; i<N; ++i)
{
cin >> s[i];
cin >> f[i];
}
sort(s, s+N);
sort(f, f+N);
int si = 0;
int fi = 0;
int counter = 0;
for (int i=0; i<1000; ++i)
{
if (si >= N) break;
if (fi >= N) break;
if (f[fi] == i) { --counter; ++fi; }
if (a <= i && i <= b && counter != 0)
{
cout << 1 << endl;
return 0;
}
if (s[si] == i) { ++counter; ++si; }
}
cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
20 | sort(s, s+N);
| ^~~~
| short
|
s670740743 | p00355 | C++ | #include <iostream>
using namespace std;
int main()
{
int a, b, N;
cin >> a;
cin >> b;
cin >> N;
int s[N], f[N];
for (int i=0; i<N; ++i)
{
cin >> s[i];
cin >> f[i];
}
sort(s, s+N);
sort(f, f+N);
int si = 0;
int fi = 0;
int counter = 0;
for (int i=0; i<1000; ++i)
{
if (si >= N) break;
if (fi >= N) break;
if (f[fi] == i) { --counter; ++fi; }
if (a <= i && i <= b && counter != 0)
{
cout << 1 << endl;
return 0;
}
if (s[si] == i) { ++counter; ++si; }
}
cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
20 | sort(s, s+N);
| ^~~~
| short
|
s904430940 | p00355 | C++ | #include <iostream>
using namespace std;
int main ()
{
long a,b,n,aa[100],bb[100];
cin >> a >> b >> n;
if (n == 0)
{
cout << '0' << endl;
break;
}
for (int i = 0; i < n; i++)
{
cin >> aa[i] >> bb[i];
}
for (int i = 0; i < n; i++)
{
if (aa[i] <= a && bb[i] > a)
{
cout << '1' << endl;
break;
}
else if (aa[i] < b && bb[i] >= b)
{
cout << '1' << endl;
break;
}
else if (a <= aa[i] && bb[i] <= b)
{
cout << '1' << endl;
break;
}
else if (i == n - 1)
{
cout << '0' << endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:12:17: error: break statement not within loop or switch
12 | break;
| ^~~~~
|
s042311926 | p00355 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,N;
cin >> a >> b >> N;
int a[1000] = {0};
int count1 = 0,count2 = 0;
for(int i = a; i < b; i++){
a[i] = 1;
count1++;
}
int x,y;
for(int i = 0; i < N; i++){
cin >> x >> y;
for(int i = x; i < y; i++){
a[i] = 0;
}
}
for(int i = 0; i < 1000; i++){
if(a[i] == 1)count2++;
}
if(count1 == count2)cout << '0' << endl;
else cout << '1' << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: conflicting declaration 'int a [1000]'
8 | int a[1000] = {0};
| ^
a.cc:5:7: note: previous declaration as 'int a'
5 | int a,b,N;
| ^
a.cc:11:6: error: invalid types 'int[int]' for array subscript
11 | a[i] = 1;
| ^
a.cc:19:8: error: invalid types 'int[int]' for array subscript
19 | a[i] = 0;
| ^
a.cc:24:9: error: invalid types 'int[int]' for array subscript
24 | if(a[i] == 1)count2++;
| ^
|
s875226640 | p00355 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,N,s[105],f[105];
cin >> a>>b>>N;
for (int i = 0; i < N; i++){
cin >> s[i] >> f[i];
if (f[i]>a&&s[i]<b){
int g = 1;
}
else{
int g = 0;
}
}
if (g == 1){
cout << "1" << endl;
}
else{
cout << "0" << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:13: error: 'g' was not declared in this scope
15 | if (g == 1){
| ^
|
s563309006 | p00355 | C++ | #include<iostream>
using namespace std;
int main(){
short a,b,n;
cin>>a>>b>>n;
bool R[10001];
for(int i=0;i<=10001;i++){
R[i]=false;
}
for(int i=1;i<=n;i++){
short s,f;
cin>>s>>f;
for(int j=s+1;j<=f-1;j++){
R[j]=true;
}
}
for(int i=a;i<=b;i++){
if(R[i]==true){
cout<<1<<endl;
return 0;
}
}
cout<<0<<endl;
return 0;
}
#include<iostream>
using namespace std;
int main(){
short a,b,n;
cin>>a>>b>>n;
bool R[10001];
for(int i=0;i<=10001;i++){
R[i]=false;
}
for(int i=1;i<=n;i++){
short s,f;
cin>>s>>f;
for(int j=s+1;j<=f-1;j++){
R[j]=true;
}
}
for(int i=a;i<=b;i++){
if(R[i]==true){
cout<<1<<endl;
return 0;
}
}
cout<<0<<endl;
return 0;
}
| a.cc:30:5: error: redefinition of 'int main()'
30 | int main(){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(){
| ^~~~
|
s514859816 | p00355 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,n,k[101],l[101],x=0;
cin>>a>>b>>n;
for(int i=0;i<=n;i++){
cin>>k[i]>>l[i];
else if(k[i]>a&&l[i]<b){
x=1;
break;
}
}
cout<<x<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:8: error: 'else' without a previous 'if'
9 | else if(k[i]>a&&l[i]<b){
| ^~~~
|
s510821064 | p00355 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,n;
cin >> a >> b >> n;
bool flg~0;
for(int i=0; i<n; i++){
int s,f;
cin >> s >> f;
if(f<=a || b<=s){
continue;
}else{
flg=1;
}
}
cout << flg << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:11: error: expected initializer before '~' token
8 | bool flg~0;
| ^
a.cc:16:7: error: 'flg' was not declared in this scope
16 | flg=1;
| ^~~
a.cc:20:11: error: 'flg' was not declared in this scope
20 | cout << flg << endl;
| ^~~
|
s666287021 | p00355 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,n,s,f,i=0;
cin >> a >> b >> n;
while(1){
cin >> s >> f;
if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
cout << '1' << endl;
break;
}
if(++i >= n){
cout << '0' << endl;
break;
}
}
}
| a.cc:4:1: error: extended character is not valid in an identifier
4 | int a,b,n,s,f,i=0;
| ^
a.cc:4:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
5 | cin >> a >> b >> n;
| ^
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:6:1: error: extended character is not valid in an identifier
6 | while(1){
| ^
a.cc:6:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
7 | cin >> s >> f;
| ^
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
8 | if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
| ^
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
9 | cout << '1' << endl;
| ^
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
10 | break;
| ^
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
11 | }
| ^
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
12 | if(++i >= n){
| ^
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
13 | cout << '0' << endl;
| ^
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
14 | break;
| ^
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
15 | }
| ^
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:16:1: error: extended character is not valid in an identifier
16 | }
| ^
a.cc:16:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:4:1: error: '\U000000a0\U000000a0int' was not declared in this scope
4 | int a,b,n,s,f,i=0;
| ^~~~~
a.cc:5:1: error: '\U000000a0\U000000a0cin' was not declared in this scope
5 | cin >> a >> b >> n;
| ^~~~~
a.cc:5:10: error: 'a' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:5:15: error: 'b' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:5:20: error: 'n' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:6:1: error: '\U000000a0\U000000a0while' was not declared in this scope
6 | while(1){
| ^~~~~~~
|
s725807843 | p00355 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,n,s,f,i=0;
cin >> a >> b >> n;
while(1){
cin >> s >> f;
if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
cout << '1' << endl;
break;
}
if(++i >= n){
cout << '0' << endl;
break;
}
}
}
| a.cc:4:1: error: extended character is not valid in an identifier
4 | int a,b,n,s,f,i=0;
| ^
a.cc:4:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
5 | cin >> a >> b >> n;
| ^
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:6:1: error: extended character is not valid in an identifier
6 | while(1){
| ^
a.cc:6:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
7 | cin >> s >> f;
| ^
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:7:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
8 | if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
| ^
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:8:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
9 | cout << '1' << endl;
| ^
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:9:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
10 | break;
| ^
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:10:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
11 | }
| ^
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:11:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
12 | if(++i >= n){
| ^
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:12:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
13 | cout << '0' << endl;
| ^
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:13:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
14 | break;
| ^
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:14:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
15 | }
| ^
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:15:1: error: extended character is not valid in an identifier
a.cc:16:1: error: extended character is not valid in an identifier
16 | }
| ^
a.cc:16:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:4:1: error: '\U000000a0\U000000a0int' was not declared in this scope
4 | int a,b,n,s,f,i=0;
| ^~~~~
a.cc:5:1: error: '\U000000a0\U000000a0cin' was not declared in this scope
5 | cin >> a >> b >> n;
| ^~~~~
a.cc:5:10: error: 'a' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:5:15: error: 'b' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:5:20: error: 'n' was not declared in this scope
5 | cin >> a >> b >> n;
| ^
a.cc:6:1: error: '\U000000a0\U000000a0while' was not declared in this scope
6 | while(1){
| ^~~~~~~
|
s812197477 | p00356 | C++ | #include<iostream>
#include<algorithm>
int x, y;
int main(){
std::cin >> x >> y;
int ans = x + y;
ans -= __gcd(a, b) - 1;
std::cout << ans << std::endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:22: error: 'a' was not declared in this scope
7 | ans -= __gcd(a, b) - 1;
| ^
a.cc:7:25: error: 'b' was not declared in this scope
7 | ans -= __gcd(a, b) - 1;
| ^
a.cc:7:16: error: '__gcd' was not declared in this scope; did you mean 'std::__gcd'?
7 | ans -= __gcd(a, b) - 1;
| ^~~~~
| std::__gcd
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: 'std::__gcd' declared here
1137 | __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
| ^~~~~
|
s982813023 | p00356 | C++ | #include<iostream>
using namespace std;
main(){
int x,y,i1,ans=0,b;
cin >> x >> y >> endl;
if (x<y) b=x;
else b=y;
for (i1=1;i1<=b;i1++){
if (y/i1==x/i1 && y%i1==0 && y/i1==0) ans++;
}
cout << x+y-ans << endl;
}
| a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:6:19: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>')
6 | cin >> x >> y >> endl;
| ~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__st |
s651644994 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x, y, ans;
int Line_x, Line_y;
cin >> x >> y;
/* xとyの大きさが同じとき */
if(x == y){
Line_x = 2 * x - (x-1);
Line_y = 2 * y - (y-1);
ans = Line_x;
}
/* xとyの大きさが違うとき */
if(x < y){
swap(x, y);
Line_x = 2 * x - (x-1);
Line_y = 2 * y - (y-1);
ans = Line_x + Line_y - 2;
}
cout << ans << endl;
return 0;
}
| a.cc:26:9: error: extended character is not valid in an identifier
26 |
| ^
a.cc: In function 'int main()':
a.cc:26:9: error: '\U00003000' was not declared in this scope
26 |
| ^~
|
s261505058 | p00356 | C++ | #include<set>
#include<iostream>
#include<ctime>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<functional>
#include<string.h>
#include<limits.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)return a;
return gcd(b, a%b);
}
signed main() {
int a, b; cin >> a >> b;
cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
} | a.cc: In function 'int main()':
a.cc:26:49: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/stl_tree.h:63,
from /usr/include/c++/14/set:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
In file included from /usr/include/c++/14/set:63:
/usr/include/c++/14/bits/stl_set.h:1025:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const set<_Key, _Compare, _Allocator>&, const set<_Key, _Compare, _Allocator>&)'
1025 | operator<(const set<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_set.h:1025:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::set<_Key, _Compare, _Allocator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
In file included from /usr/include/c++/14/set:64:
/usr/include/c++/14/bits/stl_multiset.h:1011:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> bool std::operator<(const multiset<_Key, _Compare, _Allocator>&, const multiset<_Key, _Compare, _Allocator>&)'
1011 | operator<(const multiset<_Key, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:1011:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::multiset<_Key, _Compare, _Allocator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/set:80:
/usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_Args1 ...>&, const tuple<_Elements ...>&)'
2600 | operator<(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_Args1 ...>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < 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/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/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/string_view:680: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> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/string_view:688: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>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: couldn't deduce template parameter '_CharT'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3874: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>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
a.cc:26:51: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
26 | cout << a + b + 2 - a*b / gcd(a, b) - 1 < endl;
| ^~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/bits/random.h:34,
from /usr/include/c++/14/random:48,
from a.cc:7:
/usr/include/c++/14/b |
s429848307 | p00356 | C++ | #include <iostream>
using namespace std;
int main() {
int x,y,count=0,a[1000]={};
double hiritu;
cin>>x>>y;
for(int i=0;i<x+x+1;i++){
hiritu=0;
if(i%2==0){
hiritu=i*y/x;
}
if(hiritu%1!=0){
a[i-1]=1;
a[i+1]=1;
}
}
for(int i=0;i<x+x+1;i++){
count=count+a[i];
}
cout<<count+x+1<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:26: error: invalid operands of types 'double' and 'int' to binary 'operator%'
13 | if(hiritu%1!=0){
| ~~~~~~^~
| | |
| double int
|
s322447892 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout>>x+y+1-gcd(x,y)>>endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: 'gcd' was not declared in this scope
6 | cout>>x+y+1-gcd(x,y)>>endl;
| ^~~
|
s117088249 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<x+y+1-gcd(x,y)>>endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: 'gcd' was not declared in this scope
6 | cout<<x+y+1-gcd(x,y)>>endl;
| ^~~
|
s628894092 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<x+y+1-gcd(x,y)>>endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: 'gcd' was not declared in this scope
6 | cout<<x+y+1-gcd(x,y)>>endl;
| ^~~
|
s143431935 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<x+y+1-gcd(x,y)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: 'gcd' was not declared in this scope
6 | cout<<x+y+1-gcd(x,y)<<endl;
| ^~~
|
s306753878 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<x+y+1-__gcd(x,y)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: '__gcd' was not declared in this scope
6 | cout<<x+y+1-__gcd(x,y)<<endl;
| ^~~~~
|
s160110000 | p00356 | C++ | #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
cout<<x+y+1-__gcd(x,y)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:13: error: '__gcd' was not declared in this scope
6 | cout<<x+y+1-__gcd(x,y)<<endl;
| ^~~~~
|
s331451367 | p00356 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b;
double x,y,k;
cin >> a >> b;
x = a * 2.0;
y = b;
k = a+1 + b+ 1 -2;
for(int i=1;i<a;i++){
for(double j=1.0;j<y;j++){
//cout << i+2.0*(y/x) << endl;
if(i*2.0*(y/x) == j){
k--;
break;
}
}
}
cout << k << endl;
}
}
| a.cc:24:1: error: expected declaration before '}' token
24 | }
| ^
|
s864870422 | p00357 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
int d[300000];
for(int i=0;i<n-1;i++){
D=max(D,d[i]);
if(D<10){
cout<<"no"<<endl;
return 0;
}
D-=10;
}
for(int i=n-1;i<0;i++){
D=max(D,d[i]);
if(D<10){
cout<<"no"<<endl;
return 0;
}
D-=10;
}
cout<<"yes"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:9: error: 'D' was not declared in this scope
11 | D=max(D,d[i]);
| ^
a.cc:21:9: error: 'D' was not declared in this scope
21 | D=max(D,d[i]);
| ^
|
s238186015 | p00357 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
int D;
for(int i=0;i<n;i++){
cin>>d[i];
}
int d[300000];
for(int i=0;i<n-1;i++){
D=max(D,d[i]);
if(D<10){
cout<<"no"<<endl;
return 0;
}
D-=10;
}
D=0;
for(int i=n-1;i>0;i--){
D=max(D,d[i]);
if(D<10){
cout<<"no"<<endl;
return 0;
}
D-=10;
}
cout<<"yes"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:14: error: 'd' was not declared in this scope
10 | cin>>d[i];
| ^
|
s768433370 | p00357 | C++ | #include<iostream>
using namespace std;
int main()
{
int n,a[300000]={0},length=0;
bool hantei1=true,hantei2=true;
cin>>n;
for(int i=0; i<n; i++) cin>>a[i];
for(int i=n-1; i>0; i--){
if(a[i]<10){
hantei1=false;
length=10;
for(int j=i-1; j>0; j--){
length+=10;
if(length>1000000) break;
if(a[j]>=length){
hantei1=true;
break;
}
}
}
}
for(int i=0; i<n; i++){
if(a[i]<10){
hantei2=false;
length=10;
for(int j=i+1; j<n; j++){
length+=10;
if(length>1000000) break;
if(a[j]>=length){
hantei2=true;
break;
}
}
}
} | a.cc: In function 'int main()':
a.cc:42:26: error: expected '}' at end of input
42 | }
| ^
a.cc:5:9: note: to match this '{'
5 | {
| ^
|
s879330085 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int *d;
int n;
long int max(long int a,int b){
if(a<b)return b;
else return a;
}
long int min(long int a,int b){
if(a<b)return a;
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<0)return "yes"
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
if(nowpos>n-1){
return check2();
}
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
if(canhop<0)canhop=0;
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
} | a.cc: In function 'std::string check2()':
a.cc:21:29: error: expected ';' before 'for'
21 | if(canhop<0)return "yes"
| ^
| ;
22 | for(int i=nowpos;i>canhop;i--){
| ~~~
|
s460154055 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int *d;
int n;
long int max(long int a,int b){
if(a<b)return b;
else return a;
}
long int min(long int a,int b){
if(a<b)return a;
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<=0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
}
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
if(nowpos<=0)return check2();
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
if(nowpos>=n-1){
return check2();
}
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
} | a.cc:60:3: error: expected unqualified-id before 'else'
60 | else return b;
| ^~~~
a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
a.cc:62:8: error: redefinition of 'std::string check2()'
62 | string check2(){
| ^~~~~~
a.cc:13:8: note: 'std::string check2()' previously defined here
13 | string check2(){
| ^~~~~~
a.cc:80:8: error: redefinition of 'std::string check1()'
80 | string check1(){
| ^~~~~~
a.cc:30:8: note: 'std::string check1()' previously defined here
30 | string check1(){
| ^~~~~~
a.cc:101:5: error: redefinition of 'int main()'
101 | int main(){
| ^~~~
a.cc:49:5: note: 'int main()' previously defined here
49 | int main(){
| ^~~~
|
s401124676 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int *d;
int n;
long int max(long int a,int b){
if(a<b)return b;
else return a;
}
long int min(long int a,int b){
if(a<b)return a;
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<=0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
}
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
if(nowpos<=0)return check2();
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
if(nowpos>=n-1){
return check2();
}
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
} | a.cc:60:3: error: expected unqualified-id before 'else'
60 | else return b;
| ^~~~
a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
a.cc:62:8: error: redefinition of 'std::string check2()'
62 | string check2(){
| ^~~~~~
a.cc:13:8: note: 'std::string check2()' previously defined here
13 | string check2(){
| ^~~~~~
a.cc:80:8: error: redefinition of 'std::string check1()'
80 | string check1(){
| ^~~~~~
a.cc:30:8: note: 'std::string check1()' previously defined here
30 | string check1(){
| ^~~~~~
a.cc:101:5: error: redefinition of 'int main()'
101 | int main(){
| ^~~~
a.cc:49:5: note: 'int main()' previously defined here
49 | int main(){
| ^~~~
|
s396996550 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int *d;
int n;
long int max(long int a,int b){
if(a<b)return b;
else return a;
}
long int min(long int a,int b){
if(a<b)return a;
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<=0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
}
else return b;
}
string check2(){
long int canhop=n-1;
long int nowpos=n-1;
while (true){
if(nowpos<=0)return check2();
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
if(nowpos>=n-1){
return check2();
}
nowpos=canhop;
long int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
} | a.cc:60:3: error: expected unqualified-id before 'else'
60 | else return b;
| ^~~~
a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
a.cc:62:8: error: redefinition of 'std::string check2()'
62 | string check2(){
| ^~~~~~
a.cc:13:8: note: 'std::string check2()' previously defined here
13 | string check2(){
| ^~~~~~
a.cc:80:8: error: redefinition of 'std::string check1()'
80 | string check1(){
| ^~~~~~
a.cc:30:8: note: 'std::string check1()' previously defined here
30 | string check1(){
| ^~~~~~
a.cc:101:5: error: redefinition of 'int main()'
101 | int main(){
| ^~~~
a.cc:49:5: note: 'int main()' previously defined here
49 | int main(){
| ^~~~
|
s962513431 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int n;
int d[1000000];
string check2(){
int nowpos=n-1;
int canhop=n-1;
int minhop=n-1;
for(int j=0;j<300001){
canhop=nowpos-d[nowpos]/10;
if(minhop<=0)return "yes";
for(int i=nowpos;i>=canhop;i--){
if(i-d[i]/10<canhop)nowpos=i;
minhop=min(minhop,i-d[i]/10);
}
if(minhop==canhop)return "no";
}
return "no";
}
string check1(){
int nowpos=0;
int canhop=0;
int maxhop=0;
for(int j=0;j<300001;j++){
canhop=d[nowpos]/10+nowpos;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<=canhop;i++){
if(d[i]/10+i>canhop)nowpos=i;
maxhop=max(maxhop,d[i]/10+i);
}
if(maxhop==canhop)return "no";
}
return "no";
}
int main(){
cin >>n;
for(int i=0;i<n;i++){
cin>>d[i];
}
cout <<check1()<<endl;
return 0;
} | a.cc: In function 'std::string check2()':
a.cc:11:23: error: expected ';' before ')' token
11 | for(int j=0;j<300001){
| ^
| ;
|
s228941520 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int n;
int d[1000000];
string check2(){
int nowpos=n-1;
int canhop=n-1;
int minhop=n-1;
for(int j=0;j<300001){
canhop=nowpos-d[nowpos]/10;
if(minhop<=0)return "yes";
for(int i=nowpos;i>=canhop;i--){
if(i-d[i]/10<canhop)nowpos=i;
minhop=min(minhop,i-d[i]/10);
}
if(minhop==canhop)return "no";
}
return "no";
}
string check1(){
int nowpos=0;
int canhop=0;
int maxhop=0;
for(int j=0;j<300001;j++){
canhop=d[nowpos]/10+nowpos;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<=canhop;i++){
if(d[i]/10+i>canhop)nowpos=i;
maxhop=max(maxhop,d[i]/10+i);
}
if(maxhop==canhop)return "no";
}
return "no";
}
int main(){
cin >>n;
for(int i=0;i<n;i++){
cin>>d[i];
}
cout <<check1()<<endl;
return 0;
} | a.cc: In function 'std::string check2()':
a.cc:11:23: error: expected ';' before ')' token
11 | for(int j=0;j<300001){
| ^
| ;
|
s434009531 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int n;
int d[1000000];
int main(){
cin >>n;
for(int i=0;i<n;i++){
cin>>d[i];
}
int nowpos=0;
int canhop=0;
int maxhop=0;
while(true){
canhop=d[nowpos]/10+nowpos;
maxhop=canhop;
if(canhop>=n-1){
nowpos=n-1;
canhop=n-1;
minhop=n-1;
while(true){
canhop=nowpos-d[nowpos]/10;
minhop=canhop;
if(minhop<=0){cout << "yes\n"; return 0;}
for(int i=nowpos;i>=canhop;i--){
if(i-d[i]/10<canhop){
nowpos=i;
minhop=i-d[i]/10;
}
}
if(minhop==canhop){cout << "no\n"; return 0;}
}
}
for(int i=nowpos;i<=canhop;i++){
if(d[i]/10+i>maxhop){
nowpos=i;
maxhop=d[i]/10+i;
}
}
if(maxhop==canhop){cout << "no\n"; return 0;}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:4: error: 'minhop' was not declared in this scope; did you mean 'maxhop'?
24 | minhop=n-1;
| ^~~~~~
| maxhop
|
s439977629 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int n;
int d[1000000];
string check2(){
int nowpos=n-1;
int canhop=n-1;
int minhop=n-1;
for(int j=0;j<300000;j++){
canhop=nowpos-d[nowpos]/10;
minhop=canhop;
if(canhop<=0)return "yes";
for(int i=nowpos;i>=canhop;i--){
if(i-d[i]/10<canhop){
nowpos=i;
minhop=i-d[i]/10;
}
}
}
return "no"
}
string check1(){
int nowpos=0;
int canhop=0;
int maxhop=0;
for(int j=0;j<300000;j++){
canhop=d[nowpos]/10+nowpos;
maxhop=canhop;
if(canhop>=n-1)return check2();
for(int i=nowpos;i<=canhop;i++){
if(d[i]/10+i>=maxhop){
nowpos=i;
maxhop=d[i]/10+i;
}
}
}
return "no"
}
int main(){
cin >>n;
for(int i=0;i<n;i++){
cin>>d[i];
}
cout <<check1()<<endl;
return 0;
} | a.cc: In function 'std::string check2()':
a.cc:24:14: error: expected ';' before '}' token
24 | return "no"
| ^
| ;
25 | }
| ~
a.cc: In function 'std::string check1()':
a.cc:44:14: error: expected ';' before '}' token
44 | return "no"
| ^
| ;
45 | }
| ~
|
s534550290 | p00357 | C++ | #include <iostream>
using namespace std;
int d[300005];
int main() {
int N
cin >> N;
for(int i=0; i<N; i++) cin >> d[i];
for(int i=0; i<2; i++) {
int a=0;
for(int j=0; j<N; j++) {
if(a<j*10){
cout << "no" << endl;
return 0;
}
a=max(a, j*10+d[j]);
}
reverse(d, d+N);
}
cout << "yes" << endl;
} | a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
7 | cin >> N;
| ^~~
a.cc:8:18: error: 'N' was not declared in this scope
8 | for(int i=0; i<N; i++) cin >> d[i];
| ^
a.cc:11:20: error: 'N' was not declared in this scope
11 | for(int j=0; j<N; j++) {
| ^
a.cc:18:18: error: 'N' was not declared in this scope
18 | reverse(d, d+N);
| ^
a.cc:18:5: error: 'reverse' was not declared in this scope
18 | reverse(d, d+N);
| ^~~~~~~
|
s307221022 | p00357 | C++ | #include <iostream>
using namespace std;
int d[300005];
int main() {
int N
cin >> N;
for(int i=0; i<N; i++) cin >> d[i];
for(int i=0; i<2; i++) {
int a=0;
for(int j=0; j<N; j++) {
if(a<j*10){
cout << "no" << endl;
return 0;
}
a=max(a, j*10+d[j]);
}
reverse(d, d+N);
}
cout << "yes" << endl;
} | a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
7 | cin >> N;
| ^~~
a.cc:8:18: error: 'N' was not declared in this scope
8 | for(int i=0; i<N; i++) cin >> d[i];
| ^
a.cc:11:20: error: 'N' was not declared in this scope
11 | for(int j=0; j<N; j++) {
| ^
a.cc:18:18: error: 'N' was not declared in this scope
18 | reverse(d, d+N);
| ^
a.cc:18:5: error: 'reverse' was not declared in this scope
18 | reverse(d, d+N);
| ^~~~~~~
|
s926328054 | p00357 | C++ | #include <iostream>
using namespace std;
int d[300005];
int main() {
int N;
cin >> N;
for(int i=0; i<N; i++) cin >> d[i];
for(int i=0; i<2; i++) {
int a=0;
for(int j=0; j<N; j++) {
if(a<j*10){
cout << "no" << endl;
return 0;
}
a=max(a, j*10+d[j]);
}
reverse(d, d+N);
}
cout << "yes" << endl;
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'reverse' was not declared in this scope
18 | reverse(d, d+N);
| ^~~~~~~
|
s641779150 | p00357 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#define STARTPOINT 1
using namespace std;
bool func(vector<int> &line){
int power = line.front();
int place = STARTPOINT;
while(place!=line.size()){
if(power<10)return false;
power = max(power,line[place++]);
}
return true;
int main(){
int N;
cin>>N;
vector<int> line(N);
for(int i=0;i<N;++i){
cin>line[i];
}
vector<int> line2 = line;
reverse(line2.begin(),line2.end());
cout<<(func(line)&&func(line2)?"yes":"no")<<endl;
return 0;
} | a.cc: In function 'bool func(std::vector<int>&)':
a.cc:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
14 | int main(){
| ^~
a.cc:14:9: note: remove parentheses to default-initialize a variable
14 | int main(){
| ^~
| --
a.cc:14:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:14:11: error: a function-definition is not allowed here before '{' token
14 | int main(){
| ^
a.cc:25:2: error: expected '}' at end of input
25 | }
| ^
a.cc:6:29: note: to match this '{'
6 | bool func(vector<int> &line){
| ^
|
s547371305 | p00357 | C++ | #include <iostream>
using namespace std;
int main(){
int a,m=0,n=0,h=20,j=0;
cin>>a;
int map[a]={0};
for (int A=0;A<a;A++){
cin>>map[A];
if (n==0){
if (map[A]<10){
m=1;
cout<<"no"<<endl;
return 0;
}
n=1;
}
if (map[A]<10){
for (int B=A-1;B>=0;B--){
if (map[B]>=h){
j=0;
break;
}
j=1;
h+=10;
}
if (j!=0){
m=1;
}
h=20;
j=0;
}
if (m==1){
cout<<"no"<<endl;
return 0;
}
n=0;
for (int A=a-1;A>=0;A--){
if (n==0){
if (map[A]<10){
m=1;
cout<<"no"<<endl;
return 0;
}
n=1;
}
if (map[A]<10){
for (int B=A+1;B<a;B++){
if (map[B]>=h){
j=0;
break;
}
h+=10;
j=1;
}
if (j!=0) m=1;
}
h=20;
j=0;
}
if (m!=1) cout<<"yes"<<endl;
else cout<<"no"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:64:2: error: expected '}' at end of input
64 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s311944739 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main{
int n,h=0,j,c=0;
cin >> n;
int d[n];
for(int i = 0; i < n; i++)
{
cin >> d[i];
}
if (d[0]<10 || d[n-1]<10){
cout << "no" << endl;
}
else
{
h=h+d[h]/10;
j=h;
while(1){
if(d[h]<10){
if(c!=0 && j=h){
cout<<"no"<< endl;
break;
}
h--;
c++;
}
else if(d[h]>=10){
h=h+d[h]/10;
j=h;
c=0;
if(h>n){
h=n-1;
break;
}
}
}
c=0;
while(1){
if(d[h]<10){
if(c!=0 && j=h){
cout<<"no"<< endl;
break;
}
h++;
c++;
}else if(d[h]>=10){
h=h+d[h]/10;
j=h;
c++;
if(h<0){
cout << "yes" << endl;
break;
}
}
}
}
}
| a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main{
| ^~~~
a.cc:6:5: error: expected primary-expression before 'int'
6 | int n,h=0,j,c=0;
| ^~~
a.cc:6:5: error: expected '}' before 'int'
a.cc:4:9: note: to match this '{'
4 | int main{
| ^
a.cc:7:5: error: 'cin' does not name a type
7 | cin >> n;
| ^~~
a.cc:8:11: error: 'n' was not declared in this scope; did you mean 'yn'?
8 | int d[n];
| ^
| yn
a.cc:10:5: error: expected unqualified-id before 'for'
10 | for(int i = 0; i < n; i++)
| ^~~
a.cc:10:20: error: 'i' does not name a type
10 | for(int i = 0; i < n; i++)
| ^
a.cc:10:27: error: 'i' does not name a type
10 | for(int i = 0; i < n; i++)
| ^
a.cc:14:5: error: expected unqualified-id before 'if'
14 | if (d[0]<10 || d[n-1]<10){
| ^~
a.cc:17:5: error: expected unqualified-id before 'else'
17 | else
| ^~~~
a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
|
s802147218 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main{
int n,h=0,j,c=0;
cin >> n;
int d[n];
for(int i = 0; i < n; i++)
{
cin >> d[i];
}
if (d[0]<10 || d[n-1]<10){
cout << "no" << endl;
}
else
{
h=h+d[h]/10;
j=h;
while(1){
if(d[h]<10){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
h--;
c++;
}
else if(d[h]>=10){
h=h+d[h]/10;
j=h;
c=0;
if(h>n){
h=n-1;
break;
}
}
}
c=0;
while(1){
if(d[h]<10){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
h++;
c++;
}else if(d[h]>=10){
h=h-d[h]/10;
j=h;
c++;
if(h<0){
cout << "yes" << endl;
break;
}
}
}
}
}
| a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main{
| ^~~~
a.cc:6:5: error: expected primary-expression before 'int'
6 | int n,h=0,j,c=0;
| ^~~
a.cc:6:5: error: expected '}' before 'int'
a.cc:4:9: note: to match this '{'
4 | int main{
| ^
a.cc:7:5: error: 'cin' does not name a type
7 | cin >> n;
| ^~~
a.cc:8:11: error: 'n' was not declared in this scope; did you mean 'yn'?
8 | int d[n];
| ^
| yn
a.cc:10:5: error: expected unqualified-id before 'for'
10 | for(int i = 0; i < n; i++)
| ^~~
a.cc:10:20: error: 'i' does not name a type
10 | for(int i = 0; i < n; i++)
| ^
a.cc:10:27: error: 'i' does not name a type
10 | for(int i = 0; i < n; i++)
| ^
a.cc:14:5: error: expected unqualified-id before 'if'
14 | if (d[0]<10 || d[n-1]<10){
| ^~
a.cc:17:5: error: expected unqualified-id before 'else'
17 | else
| ^~~~
a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
|
s636049659 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,h=0,j,c=0;
cin >> n;
int d[n];
for(int i = 0; i < n; i++){
cin >> d[i];
}
if (d[0]<10 || d[n-1]<10){
cout << "no" << endl;
}
else{
C=0;
h=0;
h=h+d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h--;
c++;
}
else{
h=h+d[h]/10;
j=h;
c=0;
if(h>=n-1){
h=n-1;
break;
}
}
}
c=0;
h=h-d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h++;
c++;
}else{
h=h-d[h]/10;
j=h;
c=0;
if(h<=0){
cout << "yes" << endl;
break;
}
}
}
}
}
| a.cc: In function 'int main()':
a.cc:17:9: error: 'C' was not declared in this scope
17 | C=0;
| ^
|
s238021848 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,h=0,j,c=0;
cin >> n;
int d[n];
for(int i = 0; i < n; i++){
0cin >> d[i];
}
if (d[0]<10 || d[n-1]<10){
cout << "no" << endl;
}
else{
c=0;
h=0;
h=h+d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h--;
c++;
}
else{
h=h+d[h]/10;
j=h;
c=0;
}
if(h>=n-1){
h=n-1;
break;
}
}
c=0;
h=h-d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h++;
c++;
}else{
h=h-d[h]/10;
j=h;
c=0;
}
if(h<=0){
cout << "yes" << endl;
break;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:11:9: error: unable to find numeric literal operator 'operator""cin'
11 | 0cin >> d[i];
| ^~~~
|
s896053372 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,h=0,j,c=0;
cin >> n;
int d[n];
for(int i = 0; i < n; i++){
0cin >> d[i];
}
if (d[0]<10 || d[n-1]<10){
cout << "no" << endl;
}
else{
c=0;
h=0;
h=h+d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h--;
c++;
}
else{
h=h+d[h]/10;
j=h;
c=0;
}
if(h>=n-1){
h=n-1;
break;
}
}
c=0;
h=n-1;
h=h-d[h]/10;
j=h;
while(1){
if(c!=0 && j==h){
cout<<"no"<< endl;
break;
}
if(d[h]<10){
h++;
c++;
}else{
h=h-d[h]/10;
j=h;
c=0;
}
if(h<=0){
cout << "yes" << endl;
break;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:11:9: error: unable to find numeric literal operator 'operator""cin'
11 | 0cin >> d[i];
| ^~~~
|
s800895024 | p00357 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,,count,c,ans;
int d[300100]={};
cin >> n;
for(int i=0; i<n; i++) cin >> d[i];
/*for(int i=0; i<n; i++){
cout << d[i] << " ";
}*/
for(int j=0; j<2; j++){
if(ans==1) break;
if(j==1) {
reverse(d,d+n);
/*for(int i=0; i<n; i++){
cout << d[i] << " ";
}*/
}
for(int i=0; i<n-1; i++){
if(d[0] < 10 || d[n-1] < 10){
ans = 1;
break;
}
c = d[i]/10;
if(c==0){
} else {
count = 0;
for(int j=1; j<c+1; j++) if(d[i+j]>=10) count++;
}
if(count==0){
ans=1;
break;
}
}
//cout << ans << endl;
}
// cout << ans << endl;
if(ans==1) cout << "no" << endl;
else cout << "yes" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:4:9: error: expected unqualified-id before ',' token
4 | int n,,count,c,ans;
| ^
|
s154199224 | p00357 | C++ | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
int[] trump = new int[n];
int i = 0;
String line;
for(int u = 0 ; u < n ;u++){
line = in.readLine();
trump[i] = Integer.parseInt(line);
i++;
}
boolean isok = true;
for(int j = 0 ; j < n ; j++){
if(trump[j] < 10){
if(j == 0){
isok = false;
}else{
for(int k = j - 1 ; k >= 0 ; k--){
if(trump[k] >= (j-k+1)*10){
isok = true;
break;
}else{
isok = false;
}
}
if(!isok) break;
}
}
}
if(isok){
int[] trumpreturn = new int[n];
for(int y = 0 ; y < n ; y++){
trumpreturn[y] = trump[n-y-1];
}
for(int j = 0 ; j < n ; j++){
if(trumpreturn[j] < 10){
if(j == 0){
isok = false;
}else{
for(int k = j - 1 ; k >= 0 ; k--){
if(trumpreturn[k] >= (j-k+1)*10){
isok = true;
break;
}else{
isok = false;
}
}
if(!isok) break;
}
}
}
}
String judge;
if(isok){
judge = "yes";
}else{
judge = "no";
}
System.out.println(judge);
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.BufferedReader;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.StringTokenizer;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s538752553 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000
__attribute__((constructor))
void initial() {
cin.tie(0);
ios::sync_with_stdio(false);
}
bool check() {
ll a = d[0];
FOR(i, 1, n) {
if (a < i * 10) return false;
if (a < i * 10 + d[i]) a = i * 10 + d[i];
}
return true;
}
signed main() {
ll n, d[300001] = {0};
cin >> n;
rep(i, n) {
cin >> d[i];
}
if (can()) {
reverse(d, d + n);
if (can()) {
cout << "yes" << endl;
return 0;
}
}
cout << "no" << endl;
return 0;
}
| a.cc: In function 'bool check()':
a.cc:21:10: error: 'd' was not declared in this scope
21 | ll a = d[0];
| ^
a.cc:22:13: error: 'n' was not declared in this scope
22 | FOR(i, 1, n) {
| ^
a.cc:9:42: note: in definition of macro 'FOR'
9 | #define FOR(i, a, n) for(int i = a; i < (n); i++)
| ^
a.cc: In function 'int main()':
a.cc:35:7: error: 'can' was not declared in this scope; did you mean 'tan'?
35 | if (can()) {
| ^~~
| tan
|
s409288537 | p00357 | C++ | #include <bits/stdc++.h>
using namespace std;
int *d;
int n;
string check2(){
int canhop=n-1;
int nowpos=n-1;
while (true){
if(nowpos<=0)return "Yes";
nowpos=canhop;
long int oldh=canhop;
canhop=nowpos-d[nowpos]/10;
if(canhop<0)return "yes";
for(int i=nowpos;i>canhop;i--){
nowpos=min(nowpos,i-d[i]/10);
}
if(oldh==canhop)return "no";
}
}
string check1(){
long int canhop=0;
long int nowpos;
while (true){
if(nowpos>=n-1){
return check2();
}
nowpos=canhop;
int oldh=canhop;
canhop=d[nowpos]/10+nowpos;
for(int i=nowpos;i<canhop;i++){
nowpos=max(nowpos,d[i]/10+i);
}
if(oldh==canhop)return "no";
}
}
int main(){
d= new int[300000];
cin >>n;
for(int i=0;i<n;i++){
cin >>d[i];
}
cout << check1()<<endl;
return 0;
}
| a.cc: In function 'std::string check1()':
a.cc:35:17: error: no matching function for call to 'max(long int&, int)'
35 | nowpos=max(nowpos,d[i]/10+i);
| ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:35:17: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
35 | nowpos=max(nowpos,d[i]/10+i);
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:35:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
35 | nowpos=max(nowpos,d[i]/10+i);
| ~~~^~~~~~~~~~~~~~~~~~
|
s115628151 | p00357 | C++ | #include<iostream>
using namespace std;
int main(){
int n,d[300000]x=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>d[i];
if(d[i]<10)x=1,break;
else if(d[i]>=20)i=i+d[i]/10-1;
}
for(int i=n;i>=1;i--){
if(d[i]<10)x=1,break;
else if(d[i]>=20)i=i-d[i]/10+1;
}
if(x==1)cout<<"no"<<endl;
else cout<<"yes"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:4:24: error: expected initializer before 'x'
4 | int n,d[300000]x=0;
| ^
a.cc:7:22: error: 'd' was not declared in this scope
7 | cin>>d[i];
| ^
a.cc:8:28: error: 'x' was not declared in this scope
8 | if(d[i]<10)x=1,break;
| ^
a.cc:8:32: error: expected primary-expression before 'break'
8 | if(d[i]<10)x=1,break;
| ^~~~~
a.cc:12:20: error: 'd' was not declared in this scope
12 | if(d[i]<10)x=1,break;
| ^
a.cc:12:28: error: 'x' was not declared in this scope
12 | if(d[i]<10)x=1,break;
| ^
a.cc:12:32: error: expected primary-expression before 'break'
12 | if(d[i]<10)x=1,break;
| ^~~~~
a.cc:15:12: error: 'x' was not declared in this scope
15 | if(x==1)cout<<"no"<<endl;
| ^
|
s870879513 | p00357 | C++ | #include<iostream>
using namespace std;
int main(){
int n,d[300000],x=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>d[i];
if(d[i]<10)x=1,break;
else if(d[i]>=20)i=i+d[i]/10-1;
}
for(int i=n;i>=1;i--){
if(d[i]<10)x=1,break;
else if(d[i]>=20)i=i-d[i]/10+1;
}
if(x==1)cout<<"no"<<endl;
else cout<<"yes"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:24: error: expected primary-expression before 'break'
8 | if(d[i]<10)x=1,break;
| ^~~~~
a.cc:12:24: error: expected primary-expression before 'break'
12 | if(d[i]<10)x=1,break;
| ^~~~~
|
s808884942 | p00357 | C++ | #include<iostream>
#include<algolithm>
using namespace std;
int main(){
int N;
cin >> N;
int d[300000];
for(int i=0; i<N; i++){
cin >> d[i];
}
int D = 0;
for(int i=0; i<N-1; i++){
D = max(D, d[i]);
if(D<10){
cout << "no" << endl;
return 0;
}
D -= 10;
}
D = 0;
for(int i=N-1; i>0; i--){
D = max(D, d[i]);
if(D<10){
cout << "no" << endl;
return 0;
}
D -= 10;
}
cout << "yes" << endl;
return 0;
}
| a.cc:2:9: fatal error: algolithm: No such file or directory
2 | #include<algolithm>
| ^~~~~~~~~~~
compilation terminated.
|
s701091138 | p00357 | C++ | #include <iostream>
using namespace std;
int d[300000];
int main(){
int n,m=1;
cin>>n;
for(int i=1;i<=n;i++)cin>>d[i];
for(int i=1;i<=n;i++){
if(m < i){
cout << "no" << endl;
return 0;
}
if(d[i]>=10){
m=max(i+d[i]/10,m);
}
}
if(m>=i){
for(int i=n;i>0;i--){
if(m > i){
cout << "no" << endl;
return 0;
}
if(d[i]>=10){
m=min(i-d[i]/10,m);
}
}
}
cout << "yes" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:15: error: 'i' was not declared in this scope
19 | if(m>=i){
| ^
|
s467629886 | p00357 | C++ | #include <iostream>
using namespace std;
int d[300000];
int main(){
int n,m=1;
cin>>n;
for(int i=1;i<=n;i++)cin>>d[i];
for(int i=1;i<=n;i++){
if(m < i){
cout << "no" << endl;
return 0;
}
if(d[i]>=10){
m=max(i+d[i]/10,m);
}
}
//d[i]を反転させる処理
for(int i=1;i<=n/2;i++)swap(d[i],d[n+1-i];
m = 1;
for(int i=1;i<=n;i++){
if(m < i){
cout << "no" << endl;
return 0;
}
if(d[i]>=10){
m=max(i+d[i]/10,m);
}
}
cout << "yes" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:50: error: expected ')' before ';' token
20 | for(int i=1;i<=n/2;i++)swap(d[i],d[n+1-i];
| ~ ^
| )
|
s803096381 | p00357 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
int N,S,d[20005];
cin>>N;
for (int i=0;i<N;i++){
cin>>d[i];
}
int a;
for(int i=0;i<N;i++){
for(a=1;a<i;a++){
}
}
if(d[i]>=10){
S=1;
}else if(d[i-a]>=10*(a+1)){
S=1;
}else{
S=0;
}
if(d[0]>=10&&S*N==N&&d[N-1]>=10){
cout<<"yes"<<endl;
}else{
cout<<"no"<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:13: error: 'i' was not declared in this scope
17 | if(d[i]>=10){
| ^
|
s622881768 | p00358 | Java | import java.util.Scanner;
import java.util.stream.IntStream;
public class Solution{
static IntStream REPS(int v){return IntStream.range(0,v);}
static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
static IntStream INS(int n) {return REPS(n).map(i->getInt());}
static Scanner s=new Scanner(System.in);
static int getInt(){return Integer.parseInt(s.next());}
public static void main(String[]$){
int h=getInt();
boolean[][]f=new boolean[h][4];
for(int n=getInt();n>0;--n) {
int x=getInt(),y=getInt();
f[y][x]=true;
}
//Arrays.stream(f).map(Arrays::toString).forEach(System.err::println);
/*
for(int i=0;i<h;++i)
for(int j=1;j<4;++j)
if(f[i][j]!=-1)
f[i][j]=f[i][j-1]+1;
*/
int c=0;
for(int i=1;i<h;++i) {
for(int j=1;j<4;++j) {
if(!(f[i-1][j-1]||f[i-1][j]||f[i][j-1]||f[i][j])) {
f[i][j]=true;
++c;
}
}
}
System.out.println(c);
//Arrays.stream(f).map(Arrays::toString).forEach(System.err::println);
}
} | Main.java:4: error: class Solution is public, should be declared in a file named Solution.java
public class Solution{
^
1 error
|
s705422365 | p00358 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
#ifdef DEBUG
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << "{"; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; return o; }
#ifdef USE_COUT
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);cout<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<__debug_tap<<"\n";}()
#else
#define dump(...) [&](){auto __debug_tap=make_tuple(__VA_ARGS__);cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<__debug_tap<<"\n";}()
#endif
template<class T> inline void dump2D(T &d, size_t sizey, size_t sizex) { ostream&o=
#ifdef USE_COUT
cout;
#else
cerr;
#endif
for(size_t i = 0; i < sizey; i++) { for(size_t j = 0; j < sizex; j++) o << d[i][j] << " "; o << endl; }
}
#else
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); return o; }
#define dump(...) (42)
#define dump2D(...) (42)
#endif
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
template<class T, class U> ostream & operator<<(ostream &o, pair<T, U> const &p) { o << "(" << p.first << ", " << p.second << ")"; return o; }
/// }}}--- ///
int f[4][11234];
int h;
int n;
int dp[11234][1 << 3];
int check(int y, int x) {
for(int i = y; i <= y + 1; i++) for(int j = x; j <= x + 1; j++) {
if(f[j][i]) return 0;
}
return 1;
}
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
cin >> h;
cin >> n;
for(int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
f[x][y] = 1;
}
int ans = 0;
{
int y = 0;
for(int i = 0; i < (1 << 3); i++) {
int cnt = 0, no = 0;
for(int ii = 0; ii < 3; ii++) if(i & (1 << ii)) {
if(!check(y, ii)) no = 1;
cnt++;
}
if(__builtin_popcount(i) >= 2) if(i != 5) no = 1;
if(no) continue;
dp[y][i] = cnt;
dump(y, i, cnt);
ans = max(ans, dp[y][j]);
}
}
for(int y = 0; y < h - 2; y++) {
// yでの置き方
for(int i = 0; i < (1 << 3); i++) {
int no = 0;
for(int ii = 0; ii < 3; ii++) if(i & (1 << ii)) {
if(!check(y, ii)) no = 1;
}
if(__builtin_popcount(i) >= 2) if(i != 5) no = 1;
if(no) continue;
// y + 1での置き方
for(int j = 0; j < (1 << 3); j++) {
int cnt = 0, no = 0;
for(int ii = 0; ii < 3; ii++) if(j & (1 << ii)) {
if(!check(y + 1, ii)) no = 1;
cnt++;
}
if(__builtin_popcount(j) >= 2) if(j != 5) no = 1;
for(int ii = 0; ii < 3; ii++) for(int jj = 0; jj < 3; jj++)
if(i&(1 << ii)) if(j &(1<<jj)) {
if(abs(ii - jj) <= 1) no = 1;
}
if(no) continue;
dp[y+1][j] = max(dp[y+1][j], dp[y][i] + cnt);
ans = max(ans, dp[y + 1][j]);
}
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:71:28: error: 'j' was not declared in this scope
71 | ans = max(ans, dp[y][j]);
| ^
|
s765925861 | p00358 | C++ | ##include<algorithm>
#include <bits/stdc++.h>
#include <math.h>
#include <queue>
using namespace std;
int ma[100000][4];
int main(void){
int h,n,x,y,ans=0;
cin>>h>>n;
for(int i=0;i<n;i++){
cin>>y>>x;
ma[x][y]=1;
}
for(int i=0;i<h-1;i++){
for(int j=0;j<3;j+=2){
if(ma[i][j]!=1&&ma[i+1][j]!=1&&ma[i][j+1]!=1&&ma[i+1][j+1]!=1){
ans++;
ma[i][j]=1;
ma[i+1][j]=1;
ma[i][j+1]=1;
ma[i+1][j+1]=1;
}
}
}
for(int i=0;i<h-1;i++){
for(int j=0;j<3;j++){
if(ma[i][j]!=1&&ma[i+1][j]!=1&&ma[i][j+1]!=1&&ma[i+1][j+1]!=1){
ans++;
ma[i][j]=1;
ma[i+1][j]=1;
ma[i][j+1]=1;
ma[i+1][j+1]=1;
}
}
}
cout<<ans<<endl;
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include<algorithm>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include<algorithm>
| ^~~~~~~
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:2:
/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 | |
s498885446 | p00358 | C++ | 1000 800
0 2
0 3
0 12
0 15
0 17
0 23
0 27
0 44
0 45
0 47
0 57
0 67
0 71
0 86
0 88
0 89
0 90
0 94
0 97
0 110
0 117
0 122
0 127
0 131
0 139
0 147
0 154
0 156
0 159
0 166
0 171
0 194
0 195
0 196
0 204
0 209
0 220
0 224
0 225
0 238
0 257
0 269
0 278
0 295
0 297
0 298
0 304
0 308
0 320
0 325
0 329
0 330
0 333
0 337
0 339
0 346
0 360
0 361
0 367
0 376
0 378
0 379
0 382
0 384
0 386
0 391
0 393
0 394
0 403
0 404
0 409
0 411
0 416
0 417
0 418
0 421
0 427
0 433
0 435
0 440
0 459
0 461
0 479
0 482
0 483
0 489
0 503
0 506
0 508
0 523
0 525
0 534
0 538
0 539
0 540
0 542
0 548
0 549
0 550
0 551
0 552
0 560
0 562
0 563
0 565
0 571
0 579
0 582
0 593
0 608
0 609
0 610
0 616
0 621
0 626
0 628
0 629
0 631
0 634
0 680
0 681
0 682
0 688
0 696
0 708
0 711
0 720
0 721
0 722
0 723
0 726
0 729
0 735
0 743
0 754
0 755
0 760
0 767
0 769
0 776
0 786
0 791
0 794
0 795
0 797
0 801
0 802
0 803
0 805
0 806
0 807
0 815
0 820
0 821
0 825
0 826
0 833
0 839
0 840
0 850
0 851
0 853
0 857
0 862
0 872
0 875
0 876
0 878
0 886
0 895
0 902
0 904
0 911
0 914
0 919
0 925
0 933
0 934
0 942
0 946
0 952
0 954
0 955
0 956
0 968
0 978
0 981
0 986
1 6
1 10
1 13
1 14
1 30
1 32
1 37
1 42
1 51
1 53
1 59
1 71
1 73
1 83
1 86
1 88
1 90
1 97
1 99
1 105
1 107
1 109
1 114
1 115
1 120
1 123
1 127
1 128
1 132
1 140
1 153
1 154
1 157
1 158
1 159
1 161
1 165
1 170
1 173
1 179
1 181
1 186
1 197
1 198
1 204
1 218
1 220
1 232
1 234
1 237
1 238
1 242
1 250
1 260
1 263
1 266
1 274
1 283
1 289
1 291
1 293
1 299
1 309
1 312
1 313
1 314
1 316
1 325
1 328
1 334
1 335
1 343
1 349
1 355
1 358
1 363
1 377
1 386
1 387
1 388
1 390
1 391
1 392
1 401
1 404
1 407
1 416
1 426
1 429
1 431
1 439
1 446
1 450
1 451
1 457
1 458
1 472
1 475
1 481
1 483
1 484
1 485
1 490
1 497
1 502
1 511
1 516
1 517
1 518
1 528
1 529
1 535
1 537
1 538
1 539
1 542
1 559
1 560
1 562
1 563
1 566
1 569
1 570
1 574
1 577
1 587
1 603
1 606
1 610
1 620
1 627
1 628
1 631
1 632
1 633
1 635
1 636
1 637
1 643
1 648
1 654
1 660
1 662
1 663
1 664
1 667
1 671
1 676
1 681
1 682
1 683
1 685
1 690
1 691
1 694
1 703
1 708
1 710
1 711
1 714
1 716
1 720
1 721
1 735
1 736
1 740
1 742
1 744
1 745
1 747
1 748
1 757
1 763
1 768
1 775
1 783
1 784
1 790
1 797
1 799
1 807
1 814
1 820
1 829
1 832
1 834
1 836
1 839
1 844
1 847
1 848
1 853
1 854
1 857
1 865
1 867
1 875
1 882
1 884
1 894
1 897
1 900
1 902
1 906
1 915
1 918
1 919
1 926
1 928
1 930
1 933
1 934
1 936
1 943
1 946
1 948
1 957
1 958
1 960
1 964
1 966
1 967
1 972
1 983
1 986
1 990
1 996
2 3
2 10
2 11
2 17
2 18
2 21
2 30
2 34
2 40
2 66
2 67
2 69
2 87
2 105
2 107
2 125
2 131
2 140
2 155
2 158
2 160
2 168
2 169
2 171
2 173
2 179
2 181
2 187
2 196
2 197
2 207
2 208
2 211
2 216
2 220
2 225
2 227
2 232
2 233
2 235
2 236
2 244
2 253
2 254
2 260
2 263
2 270
2 280
2 282
2 284
2 287
2 290
2 292
2 293
2 297
2 300
2 303
2 325
2 330
2 332
2 335
2 339
2 340
2 341
2 344
2 352
2 353
2 354
2 355
2 356
2 362
2 366
2 371
2 375
2 386
2 390
2 401
2 415
2 421
2 422
2 424
2 425
2 428
2 435
2 438
2 443
2 444
2 445
2 447
2 458
2 470
2 474
2 476
2 480
2 482
2 486
2 491
2 492
2 499
2 515
2 518
2 528
2 529
2 533
2 538
2 546
2 554
2 557
2 564
2 565
2 566
2 567
2 568
2 580
2 583
2 589
2 590
2 593
2 601
2 605
2 621
2 624
2 625
2 626
2 630
2 631
2 634
2 639
2 643
2 647
2 649
2 660
2 667
2 673
2 683
2 685
2 697
2 698
2 699
2 700
2 713
2 715
2 719
2 723
2 725
2 728
2 732
2 748
2 751
2 752
2 759
2 761
2 775
2 786
2 787
2 794
2 796
2 812
2 819
2 830
2 833
2 835
2 840
2 842
2 851
2 853
2 858
2 862
2 868
2 869
2 881
2 886
2 902
2 904
2 921
2 926
2 942
2 950
2 955
2 956
2 969
2 971
2 972
2 973
2 976
2 977
2 978
2 981
2 982
2 984
2 989
2 990
2 994
2 996
2 997
2 999
3 2
3 10
3 14
3 17
3 19
3 21
3 35
3 36
3 37
3 39
3 43
3 49
3 50
3 53
3 55
3 63
3 72
3 74
3 80
3 82
3 87
3 89
3 90
3 92
3 98
3 112
3 126
3 127
3 134
3 139
3 141
3 144
3 147
3 149
3 151
3 172
3 180
3 202
3 209
3 212
3 217
3 223
3 226
3 231
3 235
3 255
3 262
3 272
3 279
3 280
3 286
3 290
3 294
3 295
3 304
3 321
3 323
3 324
3 334
3 335
3 342
3 347
3 349
3 350
3 351
3 353
3 358
3 364
3 370
3 375
3 376
3 377
3 398
3 400
3 407
3 410
3 415
3 418
3 422
3 435
3 437
3 438
3 447
3 450
3 462
3 464
3 465
3 466
3 472
3 478
3 487
3 498
3 500
3 506
3 522
3 528
3 530
3 538
3 540
3 551
3 552
3 560
3 563
3 566
3 569
3 570
3 579
3 581
3 587
3 591
3 593
3 598
3 602
3 603
3 613
3 614
3 616
3 620
3 633
3 634
3 639
3 641
3 661
3 672
3 673
3 674
3 677
3 690
3 692
3 694
3 697
3 704
3 705
3 708
3 710
3 712
3 724
3 729
3 733
3 741
3 742
3 743
3 747
3 759
3 761
3 763
3 764
3 766
3 768
3 776
3 793
3 798
3 800
3 801
3 802
3 810
3 816
3 826
3 828
3 833
3 853
3 856
3 860
3 861
3 869
3 873
3 880
3 883
3 887
3 888
3 899
3 911
3 912
3 919
3 924
3 927
3 929
3 931
3 950
3 951
3 959
3 970
3 976
3 977
3 982
3 983
3 988
3 990
3 999
| a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1000 800
| ^~~~
|
s343317552 | p00358 | C++ | #include <stdio.h>
#define MAX_H 100000
int blocked[MAX_H];
int dp[2][1<<4];
main() {
int h, n; scanf("%d %d", &h, &n);
int x, y;
for ( int i=0; i<n; ++i ) {
scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
}
int locate[5] = { 0x0, 0x3, 0x6, 0xc, 0xf };//置き方パターン
int add[5] = { 0, 1, 1, 1, 2 };//各置き方パターンで置ける個数
int* crt = dp[0];
int* next = dp[1];
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {
if ( obstacle&blocked[0] ) crt[obstacle] = -1;
else crt[obstacle] = 0;
}
for ( int i=0; i<h-1; ++i ) {
std::fill( next, next+(1<<4), -1 );
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {//既に有るものパターン(current)
if ( crt[obstacle] == -1 ) continue;
for ( int k=0; k<5; ++k ) {//置き方パターン(next)
int check0 = blocked[i] & locate[k];
int check1 = blocked[i+1] & locate[k];
if ( !check0 && !check1 && !(obstacle&locate[k])) {
int patt = blocked[i+1] | locate[k];
next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
}
}
}
int* tmp = crt;
crt = next;
next = tmp;
}
int res = 0;
for ( int i=0; i<1<<4; ++i ) if ( next[i] > res ) res = next[i];
printf("%d¥n", res );
}
| a.cc:9:7: error: extended character “ is not valid in an identifier
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:12: error: extended character ” is not valid in an identifier
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:9:7: error: '\U0000201c' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:9: error: 'd' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:12: error: 'd\U0000201d' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^~
a.cc:23:6: error: 'fill' is not a member of 'std'
23 | std::fill( next, next+(1<<4), -1 );
| ^~~~
a.cc:31:20: error: 'max' is not a member of 'std'
31 | next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
| ^~~
|
s527811709 | p00358 | C++ | #include <stdio.h>
#define MAX_H 100000
int blocked[MAX_H];
int dp[2][1<<4];
main() {
int h, n; scanf("%d %d", &h, &n);
int x, y;
for ( int i=0; i<n; ++i ) {
scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
}
int locate[5] = { 0x0, 0x3, 0x6, 0xc, 0xf };//置き方パターン
int add[5] = { 0, 1, 1, 1, 2 };//各置き方パターンで置ける個数
int* crt = dp[0];
int* next = dp[1];
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {
if ( obstacle&blocked[0] ) crt[obstacle] = -1;
else crt[obstacle] = 0;
}
for ( int i=0; i<h-1; ++i ) {
std::fill( next, next+(1<<4), -1 );
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {//既に有るものパターン(current)
if ( crt[obstacle] == -1 ) continue;
for ( int k=0; k<5; ++k ) {//置き方パターン(next)
int check0 = blocked[i] & locate[k];
int check1 = blocked[i+1] & locate[k];
if ( !check0 && !check1 && !(obstacle&locate[k])) {
int patt = blocked[i+1] | locate[k];
next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
}
}
}
int* tmp = crt;
crt = next;
next = tmp;
}
int res = 0;
for ( int i=0; i<1<<4; ++i ) if ( next[i] > res ) res = next[i];
printf("%d¥n", res );
}
| a.cc:9:7: error: extended character “ is not valid in an identifier
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:12: error: extended character ” is not valid in an identifier
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:9:7: error: '\U0000201c' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:9: error: 'd' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^
a.cc:9:12: error: 'd\U0000201d' was not declared in this scope
9 | scanf(“%d %d”, &x, &y); blocked[y] |= 1<<x;
| ^~
a.cc:23:6: error: 'fill' is not a member of 'std'
23 | std::fill( next, next+(1<<4), -1 );
| ^~~~
a.cc:31:20: error: 'max' is not a member of 'std'
31 | next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
| ^~~
|
s843736359 | p00358 | C++ | #include <stdio.h>
#define MAX_H 100000
int blocked[MAX_H];
int dp[2][1<<4];
main() {
int h, n; scanf("%d %d", &h, &n);
int x, y;
for ( int i=0; i<n; ++i ) {
scanf("%d %d", &x, &y); blocked[y] |= 1<<x;
}
int locate[5] = { 0x0, 0x3, 0x6, 0xc, 0xf };//置き方パターン
int add[5] = { 0, 1, 1, 1, 2 };//各置き方パターンで置ける個数
int* crt = dp[0];
int* next = dp[1];
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {
if ( obstacle&blocked[0] ) crt[obstacle] = -1;
else crt[obstacle] = 0;
}
for ( int i=0; i<h-1; ++i ) {
std::fill( next, next+(1<<4), -1 );
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {//既に有るものパターン(current)
if ( crt[obstacle] == -1 ) continue;
for ( int k=0; k<5; ++k ) {//置き方パターン(next)
int check0 = blocked[i] & locate[k];
int check1 = blocked[i+1] & locate[k];
if ( !check0 && !check1 && !(obstacle&locate[k])) {
int patt = blocked[i+1] | locate[k];
next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
}
}
}
int* tmp = crt;
crt = next;
next = tmp;
}
int res = 0;
for ( int i=0; i<1<<4; ++i ) if ( next[i] > res ) res = next[i];
printf("%d¥n", res );
}
| a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:23:6: error: 'fill' is not a member of 'std'
23 | std::fill( next, next+(1<<4), -1 );
| ^~~~
a.cc:31:20: error: 'max' is not a member of 'std'
31 | next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
| ^~~
|
s689071349 | p00358 | C++ | #include <stdio.h>
#define MAX_H 100000
int blocked[MAX_H];
int dp[2][1<<4];
main() {
int h, n; scanf("%d %d", &h, &n);
int x, y;
for ( int i=0; i<n; ++i ) {
scanf("%d %d", &x, &y); blocked[y] |= 1<<x;
}
int locate[5] = { 0x0, 0x3, 0x6, 0xc, 0xf };//置き方パターン
int add[5] = { 0, 1, 1, 1, 2 };//各置き方パターンで置ける個数
int* crt = dp[0];
int* next = dp[1];
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) {
if ( obstacle&blocked[0] ) crt[obstacle] = -1;
else crt[obstacle] = 0;
}
for ( int i=0; i<h-1; ++i ) {
std::fill( next, next+(1<<4), -1 );
for ( int obstacle=0; obstacle<1<<4; ++obstacle ) { //既に有るものパターン(current)
if ( crt[obstacle] == -1 ) continue;
for ( int k=0; k<5; ++k ) { //置き方パターン(next)
int check0 = blocked[i] & locate[k];
int check1 = blocked[i+1] & locate[k];
if ( !check0 && !check1 && !(obstacle&locate[k])) {
int patt = blocked[i+1] | locate[k];
next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
}
}
}
int* tmp = crt;
crt = next;
next = tmp;
}
int res = 0;
for ( int i=0; i<1<<4; ++i ) if ( next[i] > res ) res = next[i];
printf("%d¥n", res );
}
| 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:24:8: error: 'fill' is not a member of 'std'
24 | std::fill( next, next+(1<<4), -1 );
| ^~~~
a.cc:32:25: error: 'max' is not a member of 'std'
32 | next[patt] = std::max( crt[obstacle] + add[k], next[patt] );
| ^~~
|
s937986488 | p00359 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s646482089 | p00359 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int W, H, N;
int ymax[100005] = {};
cin >> W >> H >> N;
for(int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
ymax[x] = max(ymax[x], y);
}
int minv = 1 << 28;
int mm = 0;
for(int i = W - 1; i >= 0; i--) {
minv = min(i + mm, minv);
mm = max(ymax[i]);
}
cout << minv << endl;
return (0);
} | a.cc: In function 'int main()':
a.cc:19:17: error: no matching function for call to 'max(int&)'
19 | mm = max(ymax[i]);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
a.cc:19:17: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | mm = max(ymax[i]);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
|
s755275611 | p00359 | C++ | #include <iostream>
using namespace std;
int xmax[100005];
int main(){
int w, h, n;
cin >> w >> h >> n;
fill(xmax, xmax+h+1, 0);
for(int i=0; i<n; i++) { int x, y;
cin >> x >> y;
xmax[y]=max(xmax[y], x);
}
for(int i=h-2; i>=0; i--){
xmax[i]=max(xmax[i], xmax[i+1]);
}
int ans=INT_MAX;
for(int i=0; i<h; i++){
ans=min(ans, i+xmax[i+1]);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:16:11: error: 'INT_MAX' was not declared in this scope
16 | int ans=INT_MAX;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | using namespace std;
|
s623332735 | p00359 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#define rep(i, a, n) for(int i = a;i < n;i++)
using namespace std;
int w, h, n;
int seg[131072*2 - 1];
int N;
int p(int i){
return (int)((i-1) / 2);
}
void update(int i){
if(i == 0) return;
if(seg[p(i)] >= seg[i]) return;
seg[p(i)] = seg[i];
update(p(i));
}
void init(){
rep(i, N-1, h+N-1) update(i);
}
int qmax(int a, int b, int k = 0, int l = 0, int r = N){
if(r <= a || b <= l) return -1;
if(a <= l && r <= b) return seg[k];
int vl = qmax(a, b, 2*k+1, l, (l+r)/2);
int vr = qmax(a, b, 2*k+2, (l+r)/2, r);
return max(vl, vr);
}
int solve(){
int c = INT_MAX;
rep(i, 0, h-1){
c = min(c, i+qmax(i+1, h));
}
c = min(c, h);
return c;
}
int main(){
cin >> w >> h >> n;
N = (int)pow(2, (int)ceil(log2(h)));
rep(i, 0, n){
int x, y;
cin >> x >> y;
seg[y+N-1] = max(seg[y+N-1], x);
}
init();
cout << solve() << endl;
return 0;
}
| a.cc: In function 'int solve()':
a.cc:42:17: error: 'INT_MAX' was not declared in this scope
42 | int c = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <cmath>
+++ |+#include <climits>
4 | #define rep(i, a, n) for(int i = a;i < n;i++)
|
s008504089 | p00359 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int wh[100001] = {};
int main(void) {
int w, h, n;
cin >> w >> h >> n;
int at_most_w=0,at_most_h=0;
for (int i = 0; i<n; i++) {
int x, y;
scanf("%d%d",&x,&y);
wh[y] = max(wh[y], x);
at_most_w=max(x,at_most_w);at_most_h=max(y,at_most_h);
}
int x_position, y_position, MIN;
MIN = wh[h - 1] + (h - 1);
x_position = wh[h - 1];
y_position = h - 1;
for (int i = 0; i<h - 1; i++) {
y_position--;
int a = x_position, b = y_position;
MIN = min(MIN, a+b);
if (a < wh[b]) {
x_position = wh[y_position];
int a = x_position, b = y_position;
MIN = min(MIN, a+b);
}
}
cout << #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int wh[100001] = {};
int main(void) {
int w, h, n;
cin >> w >> h >> n;
int at_most_w=0,at_most_h=0;
for (int i = 0; i<n; i++) {
int x, y;
scanf("%d%d",&x,&y);
wh[y] = max(wh[y], x);
at_most_w=max(x,at_most_w);at_most_h=max(y,at_most_h);
}
int x_position, y_position, MIN;
MIN = wh[h - 1] + (h - 1);
x_position = wh[h - 1];
y_position = h - 1;
for (int i = 0; i<h - 1; i++) {
y_position--;
int a = x_position, b = y_position;
MIN = min(MIN, a+b);
if (a < wh[b]) {
x_position = wh[y_position];
int a = x_position, b = y_position;
MIN = min(MIN, a+b);
}
}
cout << min(MIN,min(at_most_w,at_most_h)) << endl;
return 0;
}
| a.cc:37:17: error: stray '#' in program
37 | cout << #include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:37:18: error: 'include' was not declared in this scope
37 | cout << #include <iostream>
| ^~~~~~~
a.cc:37:35: error: expected primary-expression before '>' token
37 | cout << #include <iostream>
| ^
a.cc:40:1: error: expected primary-expression before 'using'
40 | using namespace std;
| ^~~~~
a.cc:44:16: error: a function-definition is not allowed here before '{' token
44 | int main(void) {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | }
| ^
a.cc:8:16: note: to match this '{'
8 | int main(void) {
| ^
|
s103136997 | p00360 | C++ | #include <iostream>
using namespace std;
int bit[200005];
void add(int i, int x){
i++;
while(i<200005){
bit[i]+=x;
i+=i&-i;
}
}
int sum(int i){
i++;
int ret=0;
while(i){
ret+=bit[i];
i-=i&-i;
}
return ret;
}
char str[200005];
int nxt[26];
int main(){
int k;
cin >> str >> k;
fill(bit, bit+200005, 0);
for(int i=0; i<n; i++) add(i, 1);
fill(nxt, nxt+26, 0);
for(int i=0; i<26; i++){
while(nxt[i]<n && str[nxt[i]]!='a'+i) nxt[i]++;
}
int n=strlen(str);
for(int i=0; i<n; i++){
for(int j=0; j<26; j++){
int cnt=sum(nxt[j]-1);
if(cnt<=k){
cnt-=k;
add(nxt[j]);
cout << ('a'+j);
while(nxt[j]<n && str[nxt[j]]!='a'+i) nxt[j]++;
break;
}
}
}
cout << endl;
} | a.cc: In function 'int main()':
a.cc:28:18: error: 'n' was not declared in this scope
28 | for(int i=0; i<n; i++) add(i, 1);
| ^
a.cc:31:18: error: 'n' was not declared in this scope
31 | while(nxt[i]<n && str[nxt[i]]!='a'+i) nxt[i]++;
| ^
a.cc:33:9: error: 'strlen' was not declared in this scope
33 | int n=strlen(str);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:39:12: error: too few arguments to function 'void add(int, int)'
39 | add(nxt[j]);
| ~~~^~~~~~~~
a.cc:5:6: note: declared here
5 | void add(int i, int x){
| ^~~
|
s606594065 | p00360 | C++ | #include <iostream>
using namespace std;
int bit[200005];
inline void add(int i, int x){
i++;
while(i<200005){
bit[i]+=x;
i+=i&-i;
}
}
inline int sum(int i){
i++;
int ret=0;
while(i){
ret+=bit[i];
i-=i&-i;
}
return ret;
}
string str;
int nxt[26];
void gonext(int i){
while(nxt[i]<n && str[nxt[i]]!='a'+i) nxt[i]++;
}
int main(){
int k;
cin >> str >> k;
int n=str.length();
fill(bit, bit+200005, 0);
for(int i=0; i<n; i++) add(i, 1);
fill(nxt, nxt+26, 0);
for(int i=0; i<26; i++) gonext(i);
for(int i=0; i<n; i++){
for(int j=0; j<26; j++){
if(nxt[j]==n) continue;
int cnt=sum(nxt[j]-1);
if(cnt<=k){
k-=cnt;
add(nxt[j], -1);
cout << (char)('a'+j);
nxt[j]++;
gonext(j);
break;
}
}
}
cout << endl;
} | a.cc: In function 'void gonext(int)':
a.cc:25:16: error: 'n' was not declared in this scope
25 | while(nxt[i]<n && str[nxt[i]]!='a'+i) nxt[i]++;
| ^
|
s476479023 | p00360 | C++ | #include <iostream>
#include <vector>
using namespace std;
int n, k;
string str;
int nxt[26];
vector<int> v[26];
int bit[200005];
inline void add(int i, int x){
i++;
while(i<200005){
bit[i]+=x;
i+=i&-i;
}
}
inline int sum(int i){
i++;
int ret=0;
while(i){
ret+=bit[i];
i-=i&-i;
}
return ret;
}
void gonext(int i){
}
int main(){
cin >> str >> k;
n=str.length();
fill(bit, bit+200005, 0);
fill(nxt, nxt+26, 0);
for(int i=0; i<n; i++){
add(i, 1);
v[str[i]-'a'].push_back(i);
}
for(int i=0; i<n; i++){
for(int j=0; j<26; j++){
if(nxt[j]==v[j].size()) continue;
int cnt=sum(v[nxt[j]]-1);
if(cnt<=k){
k-=cnt;
add(v[nxt[j]], -1);
cout << (char)('a'+j);
if(nxt[j]<v[j].size()) nxt[j]++;
break;
}
}
}
cout << endl;
} | a.cc: In function 'int main()':
a.cc:42:28: error: no match for 'operator-' (operand types are 'std::vector<int>' and 'int')
42 | int cnt=sum(v[nxt[j]]-1);
| ~~~~~~~~~^~
| | |
| | int
| std::vector<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:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:42:29: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
42 | int cnt=sum(v[nxt[j]]-1);
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:42:29: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
42 | int cnt=sum(v[nxt[j]]-1);
| ^
a.cc:45:21: error: cannot convert 'std::vector<int>' to 'int'
45 | add(v[nxt[j]], -1);
| ~~~~~~~~^
| |
| std::vector<int>
a.cc:10:21: note: initializing argument 1 of 'void add(int, int)'
10 | inline void add(int i, int x){
| ~~~~^
|
s719628288 | p00360 | C++ | #include <iostream>
#include <vector>
using namespace std;
int n, k;
string str;
int nxt[26];
vector<int> v[26];
int bit[200005];
inline void add(int i, int x){
i++;
while(i<200005){
bit[i]+=x;
i+=i&-i;
}
}
inline int sum(int i){
i++;
int ret=0;
while(i){
ret+=bit[i];
i-=i&-i;
}
return ret;
}
void gonext(int i){
}
int main(){
cin >> str >> k;
n=str.length();
fill(bit, bit+200005, 0);
fill(nxt, nxt+26, 0);
for(int i=0; i<n; i++){
add(i, 1);
v[str[i]-'a'].push_back(i);
}
for(int i=0; i<n; i++){
for(int j=0; j<26; j++){
if(nxt[j]==v[j].size()) continue;
int cnt=sum(v[j][nxt[j]]-1);
if(cnt<=k){
k-=cnt;
add(v[nxt[j]], -1);
cout << (char)('a'+j);
if(nxt[j]<v[j].size()) nxt[j]++;
break;
}
}
}
cout << endl;
} | a.cc: In function 'int main()':
a.cc:45:21: error: cannot convert 'std::vector<int>' to 'int'
45 | add(v[nxt[j]], -1);
| ~~~~~~~~^
| |
| std::vector<int>
a.cc:10:21: note: initializing argument 1 of 'void add(int, int)'
10 | inline void add(int i, int x){
| ~~~~^
|
s236018619 | p00360 | C++ | #include <bits/stdc++.h>
using namespace std;
struct BinaryIndexedTree {
BinaryIndexedTree(int n) : n(n + 1), v(n + 2, 0), r(1 << (31 - __builtin_clz(n + 1))) {}
vector<int> v;
int n, r;
int sum(int i) {
int ret = 0;
for (++i; i; i -= i & -i) res += v[i];
return ret;
}
void add(int i, int x) {
for (++i; i <= n; i += i & -1) v[i] += x;
}
int lower_bound(int w) {
int idx = 0;
for (int k = r; k > 0; k /= 2) {
if (idx + k <= n && v[idx + k] < w) {
w -= v[idx + k];
idx += k;
}
}
return idx;
}
};
struct segtree {
segtree() {}
segtree(int n, vector<char> v) : n(n) { init(v); }
pair<char, int> id = make_pair('{', -1);
int n;
vector<pair<char, int>> node;
void init(vector<char> v) {
int n_ = n;
n = 1;
while (n < n_)
n *= 2;
node.assign(2 * n - 1, id);
for (int i = 0; i < v.size(); ++i) {
int idx = i + n - 1;
node[idx] = make_pair(v[i], i);
}
for (int i = n - 2; i >= 0; --i) {
node[i] = min(node[2 * i + 1], node[2 * i + 2]);
}
}
pair<char, int> find(int a, int b, int k, int l, int r) {
if (b <= l || r <= a)
return id;
if (a <= l && r <= b)
return node[k];
return min(find(a, b, 2 * k + 1, l, (l + r) / 2),
find(a, b, 2 * k + 2, (l + r) / 2, r));
}
pair<char, int> find(int a, int b) { return find(a, b, 0, 0, n); }
void update(int k) {
k += n - 1;
node[k] = id;
while (k) {
k = (k - 1) / 2;
node[k] = min(node[2 * k + 1], node[2 * k + 2]);
}
}
};
int main() {
string s;
int k;
cin >> s >> k;
vector<char> v(s.size());
for (int i = 0; i < s.size(); ++i)
v[i] = s[i];
BinaryIndexedTree bit(s.size());
segtree seg(s.size(), v);
for (int i = 0; i < s.size(); ++i)
bit.add(i, 1);
string ans;
for (int i = 0; i < s.size(); ++i) {
int r = bit.lower_bound(k + 1);
pair<char, int> c = seg.find(0, r + 1);
seg.update(c.second);
bit.add(c.second, -1);
k -= bit.sum(c.second);
ans.push_back(c.first);
}
cout << ans << endl;
} | a.cc: In member function 'int BinaryIndexedTree::sum(int)':
a.cc:12:31: error: 'res' was not declared in this scope; did you mean 'ret'?
12 | for (++i; i; i -= i & -i) res += v[i];
| ^~~
| ret
|
s133121596 | p00361 | C++ | #include <iostream>
using namespace std;
int n, m;
int s[10005], t[10005];
vector<int> edge[10005], redge[10005];
bool used[10005];
vector<int> ord;
int comp[10005];
int noin[10005], noout[10005];
void dfs1(int a){
used[a]=true;
for(int i=0; i<edge.size(); i++){
int b=edge[a][i];
if(!used[b]) dfs1(b);
}
ord.push_back(a);
}
void dfs2(int a, int c){
used[a]=true;
comp[a]=c;
for(int i=0; i<redge.size(); i++){
int b=redge[a][i];
if(!used[b]) dfs2(b);
}
}
int main(){
cin >> n >> m;
for(int i=0; i<m; i++){
cin >> s[i] >> t[i];
edge[s[i]].push_back(t[i]);
redge[t[i]].push_back(s[i]);
}
fill(used, used+n, false);
for(int i=0; i<n; i++)
if(!used[i]) dfs1(i);
int cnt=0;
fill(used, used+n, false);
for(int i=n-1; i>=0; i--)
if(!used[ord[i]]) dfs2(ord[i], cnt++);
fill(noin, noin+n, 1);
fill(noout, noout+n, 1);
for(int i=0; i<m; i++){
if(comp[s[i]]!=comp[t[i]]){
noout[s[i]]=0;
noin[t[i]]=0;
}
}
int ans=0;
if(cnt>1){
int noincnt=0, nooutcnt=0;
for(int i=0; i<cnt; i++) noincnt+=noin[i];
for(int i=0; i<cnt; i++) nooutcnt+=noout[i];
ans=max(noincnt, nooutcnt);
}
cout << ans << endl;
} | a.cc:6:1: error: 'vector' does not name a type
6 | vector<int> edge[10005], redge[10005];
| ^~~~~~
a.cc:8:1: error: 'vector' does not name a type
8 | vector<int> ord;
| ^~~~~~
a.cc: In function 'void dfs1(int)':
a.cc:14:18: error: 'edge' was not declared in this scope
14 | for(int i=0; i<edge.size(); i++){
| ^~~~
a.cc:18:3: error: 'ord' was not declared in this scope
18 | ord.push_back(a);
| ^~~
a.cc: In function 'void dfs2(int, int)':
a.cc:24:18: error: 'redge' was not declared in this scope
24 | for(int i=0; i<redge.size(); i++){
| ^~~~~
a.cc:26:22: error: too few arguments to function 'void dfs2(int, int)'
26 | if(!used[b]) dfs2(b);
| ~~~~^~~
a.cc:21:6: note: declared here
21 | void dfs2(int a, int c){
| ^~~~
a.cc: In function 'int main()':
a.cc:34:5: error: 'edge' was not declared in this scope
34 | edge[s[i]].push_back(t[i]);
| ^~~~
a.cc:35:5: error: 'redge' was not declared in this scope
35 | redge[t[i]].push_back(s[i]);
| ^~~~~
a.cc:43:14: error: 'ord' was not declared in this scope
43 | if(!used[ord[i]]) dfs2(ord[i], cnt++);
| ^~~
|
s145792707 | p00361 | C++ | #include <iostream>
#include <vector>
using namespace std;
int n, m;
int s[10005], t[10005];
vector<int> edge[10005], redge[10005];
bool used[10005];
vector<int> ord;
int comp[10005];
int noin[10005], noout[10005];
void dfs1(int a){
used[a]=true;
for(int i=0; i<edge.size(); i++){
int b=edge[a][i];
if(!used[b]) dfs1(b);
}
ord.push_back(a);
}
void dfs2(int a, int c){
used[a]=true;
comp[a]=c;
for(int i=0; i<redge.size(); i++){
int b=redge[a][i];
if(!used[b]) dfs2(b);
}
}
int main(){
cin >> n >> m;
for(int i=0; i<m; i++){
cin >> s[i] >> t[i];
edge[s[i]].push_back(t[i]);
redge[t[i]].push_back(s[i]);
}
fill(used, used+n, false);
for(int i=0; i<n; i++)
if(!used[i]) dfs1(i);
int cnt=0;
fill(used, used+n, false);
for(int i=n-1; i>=0; i--)
if(!used[ord[i]]) dfs2(ord[i], cnt++);
fill(noin, noin+n, 1);
fill(noout, noout+n, 1);
for(int i=0; i<m; i++){
if(comp[s[i]]!=comp[t[i]]){
noout[s[i]]=0;
noin[t[i]]=0;
}
}
int ans=0;
if(cnt>1){
int noincnt=0, nooutcnt=0;
for(int i=0; i<cnt; i++) noincnt+=noin[i];
for(int i=0; i<cnt; i++) nooutcnt+=noout[i];
ans=max(noincnt, nooutcnt);
}
cout << ans << endl;
} | a.cc: In function 'void dfs1(int)':
a.cc:15:23: error: request for member 'size' in 'edge', which is of non-class type 'std::vector<int> [10005]'
15 | for(int i=0; i<edge.size(); i++){
| ^~~~
a.cc: In function 'void dfs2(int, int)':
a.cc:25:24: error: request for member 'size' in 'redge', which is of non-class type 'std::vector<int> [10005]'
25 | for(int i=0; i<redge.size(); i++){
| ^~~~
a.cc:27:22: error: too few arguments to function 'void dfs2(int, int)'
27 | if(!used[b]) dfs2(b);
| ~~~~^~~
a.cc:22:6: note: declared here
22 | void dfs2(int a, int c){
| ^~~~
|
s817951388 | p00362 | C++ | #include<bits/stdc++.h>
using namespace std;
struct Mo_3D
{
vector< int > left, right, index, order;
vector< bool > v;
int width;
int nl, nr, time, ptr;
Mo_3D(int n) : width((int) pow(n, 2.0 / 3.0)), nl(0), nr(0), ptr(0), time(0), v(n) {}
void insert(int idx, int l, int r) /* [l, r) */
{
left.push_back(l);
right.push_back(r);
index.push_back(idx);
}
void build()
{
order.resize(left.size());
iota(begin(order), end(order), 0);
sort(begin(order), end(order), [&](int a, int b)
{
if(left[a] / width != left[b] / width) return left[a] < left[b];
if(right[a] / width != right[b] / width) return bool((right[a] < right[b]) ^ (left[a] / width % 2));
return bool((index[a] < index[b]) ^ (right[a] / width % 2));
});
}
int process()
{
if(ptr == order.size()) return (-1);
const auto id = order[ptr];
while(nl > left[id]) distribute(--nl);
while(nr < right[id]) distribute(nr++);
while(nl < left[id]) distribute(nl++);
while(nr > right[id]) distribute(--nr);
while(time < index[id]) addquery(time++);
while(time > index[id]) delquery(--time);
return (index[order[ptr++]]);
}
inline void distribute(int idx);
void addquery(int idx);
void delquery(int idx);
};
struct edge
{
int to, cost;
};
#define int long long
int N, K, Q;
vector< edge > g[100000];
int A[100000], B[100000], C[100000];
int T[100000], X[100000], Y[100000];
char buff[10];
vector< int > vs;
int in[100000], par[100000], cost[100000], add[100000];
int ans[100000], ret;
void dfs(int idx, int p = -1)
{
in[idx] = (int) vs.size();
par[idx] = p;
vs.push_back(idx);
for(auto &e : g[idx]) {
dfs(e.to, idx);
vs.push_back(idx);
cost[e.to] += e.cost;
}
}
inline void Mo_3D::distribute(int idx)
{
auto p = minmax(vs[idx], vs[idx + 1]);
v[p.second].flip();
int beet = cost[p.second] + add[p.first] + add[p.second];
if(v[p.second]) {
if(beet % K) ret += beet;
} else {
if(beet % K) ret -= beet;
}
}
void Mo_3D::addquery(int idx)
{
if(T[idx]) return;
if(v[X[idx]]) {
int beet = cost[X[idx]] + add[X[idx]] + add[par[X[idx]]];
if(beet % K) ret -= beet;
beet = cost[X[idx]] + add[X[idx]] + add[par[X[idx]]] + Y[idx];
if(beet % K) ret += beet;
}
for(auto &e : g[X[idx]]) {
if(v[e.to]) {
int beet = cost[e.to] + add[X[idx]] + add[e.to];
if(beet % K) ret -= beet;
beet = cost[e.to] + add[X[idx]] + add[e.to] + Y[idx];
if(beet % K) ret += beet;
}
}
add[X[idx]] += Y[idx];
}
void Mo_3D::delquery(int idx)
{
if(T[idx]) return;
if(v[X[idx]]) {
int beet = cost[X[idx]] + add[X[idx]] + add[par[X[idx]]];
if(beet % K) ret -= beet;
beet = cost[X[idx]] + add[X[idx]] + add[par[X[idx]]] - Y[idx];
if(beet % K) ret += beet;
}
for(auto &e : g[X[idx]]) {
if(v[e.to]) {
int beet = cost[e.to] + add[X[idx]] + add[e.to];
if(beet % K) ret -= beet;
beet = cost[e.to] + add[X[idx]] + add[e.to] - Y[idx];
if(beet % K) ret += beet;
}
}
add[X[idx]] -= Y[idx];
}
signed main()
{
scanf("%lld %lld", &N, &K);
for(int i = 1; i < N; i++) {
scanf("%lld %lld %lld", &A[i], &B[i], &C[i]);
g[A[i]].push_back((edge) {B[i], C[i]});
}
scanf("%lld", &Q);
for(int i = 0; i < Q; i++) {
scanf("%s %lld %lld", buff, &X[i], &Y[i]);
T[i] = buff[0] == 's';
}
dfs(0);
Mo_3D mo(vs.size());
for(int i = 0; i < Q; i++) {
if(T[i]) {
auto p = minmax(in[X[i]], in[Y[i]]);
mo.insert(i, p.first, p.second);
}
}
mo.build();
int idx;
while((idx = mo.process()) != -1) ans[idx] = ret;
for(int i = 0; i < Q; i++) {
if(T[i]) printf("%lld\n", ans[i]);
}
} | a.cc:83:13: error: no declaration matches 'void Mo_3D::distribute(long long int)'
83 | inline void Mo_3D::distribute(int idx)
| ^~~~~
a.cc:47:15: note: candidate is: 'void Mo_3D::distribute(int)'
47 | inline void distribute(int idx);
| ^~~~~~~~~~
a.cc:5:8: note: 'struct Mo_3D' defined here
5 | struct Mo_3D
| ^~~~~
a.cc:95:6: error: no declaration matches 'void Mo_3D::addquery(long long int)'
95 | void Mo_3D::addquery(int idx)
| ^~~~~
a.cc:49:8: note: candidate is: 'void Mo_3D::addquery(int)'
49 | void addquery(int idx);
| ^~~~~~~~
a.cc:5:8: note: 'struct Mo_3D' defined here
5 | struct Mo_3D
| ^~~~~
a.cc:118:6: error: no declaration matches 'void Mo_3D::delquery(long long int)'
118 | void Mo_3D::delquery(int idx)
| ^~~~~
a.cc:51:8: note: candidate is: 'void Mo_3D::delquery(int)'
51 | void delquery(int idx);
| ^~~~~~~~
a.cc:5:8: note: 'struct Mo_3D' defined here
5 | struct Mo_3D
| ^~~~~
a.cc: In function 'int main()':
a.cc:147:34: warning: narrowing conversion of 'B[i]' from 'long long int' to 'int' [-Wnarrowing]
147 | g[A[i]].push_back((edge) {B[i], C[i]});
| ~~~^
a.cc:147:40: warning: narrowing conversion of 'C[i]' from 'long long int' to 'int' [-Wnarrowing]
147 | g[A[i]].push_back((edge) {B[i], C[i]});
| ~~~^
a.cc: At global scope:
a.cc:47:15: warning: inline function 'void Mo_3D::distribute(int)' used but never defined
47 | inline void distribute(int idx);
| ^~~~~~~~~~
|
s807158321 | p00362 | C++ | // GEKI TSU RA I
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)
#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
<< " , " << #y << " = " << (y) << "\n";
const int INF = 1e9;
const double EPS = 1e-10;
const int _N = 1e5;
int n,k,q;
VP edges[_N];
struct Node{
ll top=0, center=0, bottom=0;
Node(){} //
Node(ll top, ll center, ll bottom):
top(top),center(center),bottom(bottom){}
};
const Node ZERO(-1, 0, 0);
Node merge(Node left, Node right){
if(left.top == -1) return right;
if(right.top == -1) return left;
ll center = left.center + right.center;
ll len = left.bottom + right.top;
if(len % k != 0) center += len; //
return Node(left.top, center, right.bottom);
}
struct SegmentTree{
Node ds[_N * 4 + 1];
int m;
Node temp;
void init(int n){
m = 1;
while(m<n) m*= 2;
REP(i, m * 2 - 1)
ds[i] = ZERO;
}
void update(int i, Node x){
i += m - 1;
ds[i] = x;
while(i >= 1){
i = (i - 1) / 2;
ds[i] = merge(ds[i*2 + 1], ds[i*2 + 2]);
}
}
Node get(int i){
return ds[i + m - 1];
}
Node query(int a, int b){
temp = ZERO;
_query(a, b, 0, 0, m);
return temp;
}
void _query(int a, int b, int k, int l, int r){
if(r<=a || b<=l) return; //
if(a<=l && r<=b) {
temp = merge(temp, ds[k]);
return;
}
_query(a, b, k*2+1, l, (r+l)/2);
_query(a, b, k*2+2, (r+l)/2, r);
}
};
struct X{};
X x;
int par[_N], head[_N], size[_N], depth[_N];
int index[_N], id;
int dfs1(int t, int p){
par[t] = p;
if(p!=-1) depth[t] = depth[p]+1; //
int sz = 1;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
sz += dfs1(j, t);
}
return size[t] = sz;
}
SegmentTree seg;
void dfs2(int t, int p, int d){
//
index[t] = id;
seg.update(id, Node(d, 0, 0));
id++;
int minP = -1;
int minSz = INF;
int minCost = 0;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(minSz > size[j]){
minP = j;
minSz = size[j];
minCost = edges[t][i].second;
}
}
if(minP == -1) return;
head[minP] = head[t];
dfs2(minP, t, minCost); // for SegmentTree
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(j==minP)continue;
dfs2(j, t, edges[t][i].second);
}
}
// HL-Decomposition
void decomposite(){
dfs1(0, -1);
REP(i, n){
head[i] = i;
}
dfs2(0, -1, 0);
}
int lca(int a, int b){
int p = head[a];
int q = head[b];
// dump2(a,b);
// dump(depth[b]);
if(p==q)
return depth[a] < depth[b] ?
a :
b;
if(par[p]==-1)return lca(a, par[q]);
if(par[q]==-1)return lca(par[p], b);
if(depth[par[p]] < depth[par[q]]){
return lca(a, par[q]);
}else{
return lca(par[p], b);
}
}
ll dist(int p, int top){
Node d = ZERO;
while(true){
if(head[p] == head[top]){
d = merge(
seg.query(index[top], index[p] + 1),
d
);
// dump2(top, p);
// dump2(index[top], index[p] + 1);
// dump(seg.query(index[top], index[p] + 1).top);
// dump(seg.query(index[top], index[p] + 1).center);
// dump(seg.query(index[top], index[p] + 1).bottom);
break;
}
d = merge(
seg.query(index[head[p]], index[p] + 1),
d
);
p = par[head[p]];
}
return d.center;
}
int main() {
omajinai;
cin >> n >> k;
REP(i, n - 1){
int a,b,c;
cin >> a >> b >> c;
edges[a].PB(MP(b, c));
edges[b].PB(MP(a, c));
}
seg.init(n);
decomposite();
cin >> q;
REP(i, q){
string s;
cin >> s;
if(s[0] == 'a'){ // add
int x,d;
cin >> x >> d;
Node one = seg.get(index[x]);
one.top += d;
one.bottom += d;
seg.update(index[x], one);
}else{ // send
int s,t;
cin >> s >> t;
int l = lca(s, t);
int d = dist(s, l) + dist(t, l);
cout << d << endl;
}
}
} | a.cc:120:13: error: 'int index [100000]' redeclared as different kind of entity
120 | int index[_N], id;
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:13:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int dfs1(int, int)':
a.cc:131:17: error: reference to 'size' is ambiguous
131 | return size[t] = sz;
| ^~~~
In file included from /usr/include/c++/14/string:53,
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:4:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc: In function 'void dfs2(int, int, int)':
a.cc:138:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
138 | index[t] = id;
| ^
a.cc:148:28: error: reference to 'size' is ambiguous
148 | if(minSz > size[j]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc:150:33: error: reference to 'size' is ambiguous
150 | minSz = size[j];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc: In function 'll dist(int, int)':
a.cc:200:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
200 | seg.query(index[top], index[p] + 1),
| ^
a.cc:200:60: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
200 | seg.query(index[top], index[p] + 1),
| ^
a.cc:212:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
212 | seg.query(index[head[p]], index[p] + 1),
| ^
a.cc:212:56: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
212 | seg.query(index[head[p]], index[p] + 1),
| ^
a.cc: In function 'int main()':
a.cc:244:49: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
244 | Node one = seg.get(index[x]);
| ^
a.cc:247:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
247 | seg.update(index[x], one);
| ^
|
s349275842 | p00362 | C++ | // GEKI TSU RA I
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)
#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
<< " , " << #y << " = " << (y) << "\n";
const int INF = 1e9;
const double EPS = 1e-10;
const int _N = 1e5;
int n,k,q;
VP edges[_N];
struct Node{
ll top=0, center=0, bottom=0;
Node(){} //
Node(ll top, ll center, ll bottom):
top(top),center(center),bottom(bottom){}
};
const Node ZERO(-1, 0, 0);
Node merge(Node left, Node right){
if(left.top == -1) return right;
if(right.top == -1) return left;
ll center = left.center + right.center;
ll len = left.bottom + right.top;
if(len % k != 0) center += len; //
return Node(left.top, center, right.bottom);
}
struct SegmentTree{
Node ds[_N * 4 + 1];
int m;
Node temp;
void init(int n){
m = 1;
while(m<n) m*= 2;
REP(i, m * 2 - 1)
ds[i] = ZERO;
}
void update(int i, Node x){
i += m - 1;
ds[i] = x;
while(i >= 1){
i = (i - 1) / 2;
ds[i] = merge(ds[i*2 + 1], ds[i*2 + 2]);
}
}
Node get(int i){
return ds[i + m - 1];
}
Node query(int a, int b){
temp = ZERO;
_query(a, b, 0, 0, m);
return temp;
}
void _query(int a, int b, int k, int l, int r){
if(r<=a || b<=l) return; //
if(a<=l && r<=b) {
temp = merge(temp, ds[k]);
return;
}
_query(a, b, k*2+1, l, (r+l)/2);
_query(a, b, k*2+2, (r+l)/2, r);
}
};
struct X{};
X x;
int par[_N], head[_N], size[_N], depth[_N];
int index[_N], id;
int dfs1(int t, int p){
par[t] = p;
if(p!=-1) depth[t] = depth[p]+1; //
int sz = 1;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
sz += dfs1(j, t);
}
return size[t] = sz;
}
SegmentTree seg;
void dfs2(int t, int p, int d){
//
index[t] = id;
seg.update(id, Node(d, 0, 0));
id++;
int minP = -1;
int minSz = INF;
int minCost = 0;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(minSz > size[j]){
minP = j;
minSz = size[j];
minCost = edges[t][i].second;
}
}
if(minP == -1) return;
head[minP] = head[t];
dfs2(minP, t, minCost); // for SegmentTree
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(j==minP)continue;
dfs2(j, t, edges[t][i].second);
}
}
// HL-Decomposition
void decomposite(){
dfs1(0, -1);
REP(i, n){
head[i] = i;
}
dfs2(0, -1, 0);
}
int lca(int a, int b){
int p = head[a];
int q = head[b];
if(p==q)
return depth[a] < depth[b] ?
a :
b;
if(par[p]==-1)return lca(a, par[q]);
if(par[q]==-1)return lca(par[p], b);
if(depth[par[p]] < depth[par[q]]){
return lca(a, par[q]);
}else{
return lca(par[p], b);
}
}
ll dist(int p, int top){
Node d = ZERO;
while(true){
if(head[p] == head[top]){
d = merge(
seg.query(index[top], index[p] + 1),
d
);
break;
}
d = merge(
seg.query(index[head[p]], index[p] + 1),
d
);
p = par[head[p]];
}
return d.center;
}
int main() {
omajinai;
cin >> n >> k;
REP(i, n - 1){
int a,b,c;
cin >> a >> b >> c;
edges[a].PB(MP(b, c));
edges[b].PB(MP(a, c));
}
seg.init(n);
decomposite();
cin >> q;
REP(i, q){
string s;
cin >> s;
if(s[0] == 'a'){ // add
int x,d;
cin >> x >> d;
Node one = seg.get(index[x]);
one.top += d;
one.bottom += d;
seg.update(index[x], one);
}else{ // send
int s,t;
cin >> s >> t;
int l = lca(s, t);
int d = dist(s, l) + dist(t, l);
cout << d << endl;
}
}
} | a.cc:120:13: error: 'int index [100000]' redeclared as different kind of entity
120 | int index[_N], id;
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:13:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int dfs1(int, int)':
a.cc:131:17: error: reference to 'size' is ambiguous
131 | return size[t] = sz;
| ^~~~
In file included from /usr/include/c++/14/string:53,
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:4:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc: In function 'void dfs2(int, int, int)':
a.cc:138:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
138 | index[t] = id;
| ^
a.cc:148:28: error: reference to 'size' is ambiguous
148 | if(minSz > size[j]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc:150:33: error: reference to 'size' is ambiguous
150 | minSz = size[j];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc: In function 'll dist(int, int)':
a.cc:198:48: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
198 | seg.query(index[top], index[p] + 1),
| ^
a.cc:198:60: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
198 | seg.query(index[top], index[p] + 1),
| ^
a.cc:204:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
204 | seg.query(index[head[p]], index[p] + 1),
| ^
a.cc:204:56: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
204 | seg.query(index[head[p]], index[p] + 1),
| ^
a.cc: In function 'int main()':
a.cc:236:49: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
236 | Node one = seg.get(index[x]);
| ^
a.cc:239:41: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
239 | seg.update(index[x], one);
| ^
|
s472817610 | p00362 | C++ | // GEKI TSU RA I
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)
#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
<< " , " << #y << " = " << (y) << "\n";
const int INF = 1e9;
const double EPS = 1e-10;
const int _N = 1e5;
int n,k,q;
VP edges[_N];
struct Node{
ll top=0, center=0, bottom=0;
Node(){} //
Node(ll top, ll center, ll bottom):
top(top),center(center),bottom(bottom){}
};
const Node ZERO(-1, 0, 0);
Node merge(Node left, Node right){
if(left.top == -1) return right;
if(right.top == -1) return left;
ll center = left.center + right.center;
ll len = left.bottom + right.top;
if(len % k != 0) center += len; //
return Node(left.top, center, right.bottom);
}
struct SegmentTree{
Node ds[_N * 4 + 1];
int m;
Node temp;
void init(int n){
m = 1;
while(m<n) m*= 2;
REP(i, m * 2 - 1)
ds[i] = ZERO;
}
void update(int i, Node x){
i += m - 1;
ds[i] = x;
while(i >= 1){
i = (i - 1) / 2;
ds[i] = merge(ds[i*2 + 1], ds[i*2 + 2]);
}
}
Node get(int i){
return ds[i + m - 1];
}
Node query(int a, int b){
temp = ZERO;
_query(a, b, 0, 0, m);
return temp;
}
void _query(int a, int b, int k, int l, int r){
if(r<=a || b<=l) return; //
if(a<=l && r<=b) {
temp = merge(temp, ds[k]);
return;
}
_query(a, b, k*2+1, l, (r+l)/2);
_query(a, b, k*2+2, (r+l)/2, r);
}
};
struct X{};
X x;
int par[_N], head[_N], size[_N], depth[_N];
int indx[_N], id;
int dfs1(int t, int p){
par[t] = p;
if(p!=-1) depth[t] = depth[p]+1; //
int sz = 1;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
sz += dfs1(j, t);
}
return size[t] = sz;
}
SegmentTree seg;
void dfs2(int t, int p, int d){
//
indx[t] = id;
seg.update(id, Node(d, 0, 0));
id++;
int minP = -1;
int minSz = INF;
int minCost = 0;
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(minSz > size[j]){
minP = j;
minSz = size[j];
minCost = edges[t][i].second;
}
}
if(minP == -1) return;
head[minP] = head[t];
dfs2(minP, t, minCost); // for SegmentTree
EACH(i, edges[t]){
int j = edges[t][i].first;
if(j==p)continue;
if(j==minP)continue;
dfs2(j, t, edges[t][i].second);
}
}
// HL-Decomposition
void decomposite(){
dfs1(0, -1);
REP(i, n){
head[i] = i;
}
dfs2(0, -1, 0);
}
int lca(int a, int b){
int p = head[a];
int q = head[b];
if(p==q)
return depth[a] < depth[b] ?
a :
b;
if(par[p]==-1)return lca(a, par[q]);
if(par[q]==-1)return lca(par[p], b);
if(depth[par[p]] < depth[par[q]]){
return lca(a, par[q]);
}else{
return lca(par[p], b);
}
}
ll dist(int p, int top){
Node d = ZERO;
while(true){
if(head[p] == head[top]){
d = merge(
seg.query(indx[top], indx[p] + 1),
d
);
break;
}
d = merge(
seg.query(indx[head[p]], indx[p] + 1),
d
);
p = par[head[p]];
}
return d.center;
}
int main() {
omajinai;
cin >> n >> k;
REP(i, n - 1){
int a,b,c;
cin >> a >> b >> c;
edges[a].PB(MP(b, c));
edges[b].PB(MP(a, c));
}
seg.init(n);
decomposite();
cin >> q;
REP(i, q){
string s;
cin >> s;
if(s[0] == 'a'){ // add
int x,d;
cin >> x >> d;
Node one = seg.get(indx[x]);
one.top += d;
one.bottom += d;
seg.update(indx[x], one);
}else{ // send
int s,t;
cin >> s >> t;
int l = lca(s, t);
int d = dist(s, l) + dist(t, l);
cout << d << endl;
}
}
} | a.cc: In function 'int dfs1(int, int)':
a.cc:131:17: error: reference to 'size' is ambiguous
131 | return size[t] = sz;
| ^~~~
In file included from /usr/include/c++/14/string:53,
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:4:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc: In function 'void dfs2(int, int, int)':
a.cc:148:28: error: reference to 'size' is ambiguous
148 | if(minSz > size[j]){
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
a.cc:150:33: error: reference to 'size' is ambiguous
150 | minSz = size[j];
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:119:24: note: 'int size [100000]'
119 | int par[_N], head[_N], size[_N], depth[_N];
| ^~~~
|
s430842919 | p00362 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
vector<pair<int, ll> > path[100005];
int par[100005];
int dep[100005];
int siz[100005];
ll cst[100005];
int hev[100005];
void dfs(int a){
siz[a]=1;
for(int i=0; i<path[a].size(); i++){
int d=path[a][i].first;
if(d==par[a]) continue;
par[d]=a;
dep[d]=dep[a]+1;
cst[d]=path[a][i].second;
dfs(d);
siz[a]+=siz[d];
if(!hev[a] || siz[hev[a]]<siz[d])
hev[a]=d;
}
}
ll k;
ll add[100005];
ll edgecost(int a){
ll ret=add[a]+add[par[a]]+cst[a];
return ret%k?ret:0;
}
int pos[100005];
int hl_par[100005];
ll bit[100005];
void set(int i, ll x){
x-=sum(i+1)-sum(i);
i++;
while(i<100005){
bit[i]+=x;
i+=i&-i;
}
}
ll sum(int i){
ll ret=0;
while(i){
ret+=bit[i];
i-=i&-i;
}
return ret;
}
int lca(int a, int b){
int p=hl_par[a], q==hl_par[b];
if(p==q) return dep[a]<dep[b]?a:b;
if(dep[p]<dep[q]) return lca(par[p], b);
else return lca(a, par[q]);
}
ll cost(int a){
ll ret=0;
while(a){
int p=hl_par[a];
ret+=sum(p, a);
ret+=edgecost(p);
a=p;
}
return ret;
}
int main(){
int n;
cin >> n >> k;
for(int i=0; i<n-1; i++){
int a, b;
ll c;
cin >> a >> b >> c;
path[a].push_back(make_pair(b, c));
path[b].push_back(make_pair(a, c));
}
for(int i=0; i<n; i++) hev[i]=0;
par[0]=dep[0]=cst[0]=0;
dfs(0);
for(int i=0; i<n; i++) add[i]=0;
int cnt=0;
for(int i=0; i<n; i++) pos[i]=-1;
for(int i=0; i<n; i++){
if(pos[i]!=-1) continue;
int j=i;
do{
pos[j]=cnt++;
hl_par[j]=i;
}while(j=hev[j]);
}
for(int i=0; i<100005; i++) bit[i]=0;
for(int i=0; i<q; i++){
string s;
ll a, b;
cin >> s >> a >> b;
if(s[0]=='a'){
add[a]+=b;
set(pos[a], edgecost(hev[a]));
if(a) set(pos[a]-1, edgecost(a));
}else{
cout << cost(a)+cost(b)-cost(lca(a, b)) << endl;
}
}
} | a.cc: In function 'void set(int, ll)':
a.cc:39:12: error: 'sum' was not declared in this scope
39 | x-=sum(i+1)-sum(i);
| ^~~
a.cc: In function 'int lca(int, int)':
a.cc:56:27: error: expected initializer before '==' token
56 | int p=hl_par[a], q==hl_par[b];
| ^~
a.cc:57:15: error: 'q' was not declared in this scope
57 | if(p==q) return dep[a]<dep[b]?a:b;
| ^
a.cc:58:23: error: 'q' was not declared in this scope
58 | if(dep[p]<dep[q]) return lca(par[p], b);
| ^
a.cc: In function 'll cost(int)':
a.cc:65:25: error: too many arguments to function 'll sum(int)'
65 | ret+=sum(p, a);
| ~~~^~~~~~
a.cc:46:4: note: declared here
46 | ll sum(int i){
| ^~~
a.cc: In function 'int main()':
a.cc:100:24: error: 'q' was not declared in this scope
100 | for(int i=0; i<q; i++){
| ^
|
s944919823 | p00362 | C++ | #include <bits/stdc++.h>
typedef long long L;
using namespace std;
#define N 100005
map<L,L> path[N];
L par[N], dep[N], siz[N], hev[N];
L cst[N];
void dfs(L a){
siz[a]=1;
for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){
L d=I->first;
if(d==par[a]) continue;
par[d]=a;
dep[d]=dep[a]+1;
cst[d]=I->second;
dfs(d);
siz[a]+=siz[d];
if(!hev[a] || siz[hev[a]]<siz[d])
hev[a]=d;
}
}
L k;
L add[N];
L edgecost(L a){
L ret=add[a]+add[par[a]]+cst[a];
return ret%k ? ret : 0;
}
L pos[N];
L hl_par[N]; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s841552171 | p00362 | C++ |
pos[a]=c++;
hl_par[a]=i; | a.cc:2:13: error: 'pos' does not name a type
2 | pos[a]=c++;
| ^~~
a.cc:3:13: error: 'hl_par' does not name a type
3 | hl_par[a]=i;
| ^~~~~~
|
s133275644 | p00362 | C++ | #include <Bs/stdc++.h>
typedef long long L;
using namespace std;
#define U [100005]={}
map<L,L> path U;
L P U,E U,Z U,H U,C U,A U,O U,L U,B U,
k,n,a,b,c,p,r;
char s U;
L D(L a){
Z[a]=1;
for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){
L d=I->first;
if(d-P[a]){
P[d]=a;
E[d]=E[a]+1;
C[d]=I->second;
D(d);
Z[a]+=Z[d];
if(!H[a]|Z[H[a]]<Z[d])
H[a]=d;
}
}
}
L G(L a){
r=A[a]+A[P[a]]+C[a];
return r%k?r:0;
}
L M(L i){
for(r=0;i;r+=B[i],i-=i&-i);
return r;
}
L S(L i,L x){
for(x=G(x)-M(i+1)+M(i++);
i<100005;B[i]+=x,i+=i&-i);
}
main(){
for(cin>>n>>k;p<n-1;p++)
cin>>a>>b>>c,
path[a][b]=path[b][a]=c;
D(0);
for(c=p=0;p<n;p++)
if(!p|H[P[p]]-p)
for(a=p;!c|a;a=H[a])
O[a]=c++,
L[a]=p,
S(O[a],H[a]);
for(cin>>a;cin>>s>>a>>b;)
if(*s&2){
for(c=0;p=L[a],n=L[b],p-n;a=P[p])
E[p]<E[n]?swap(p,n),swap(a,b),0:0,
c+=M(O[a])-M(O[p])+G(p);
cout<<c+abs(M(O[a])-M(O[b]))<<endl;
}else
A[a]+=b,
S(O[a],H[a]),
a?S(O[a]-1,a):0;
} | a.cc:1:10: fatal error: Bs/stdc++.h: No such file or directory
1 | #include <Bs/stdc++.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s204998764 | p00362 | C++ | #include <bits/stdc++.h>
typedef long long L;
using namespace std;
#define U [100005]={}
map<L,L> path U;
L P U,E U,Z U,H U,C U,A U,O U,L U,B U,
k,n,a,b,c,p,r;
char s U;
L D(L a){
Z[a]=1;
for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){
L d=I->first;
if(d-P[a]){
P[d]=a;
E[d]=E[a]+1;
C[d]=I->second;
D(d);
Z[a]+=Z[d];
if(!H[a]|Z[H[a]]<Z[d])
H[a]=d;
}
}
}
L G(L a){
r=A[a]+A[P[a]]+C[a];
return r%k?r:0;
}
L M(L i){
for(r=0;i;r+=B[i],i-=i&-i);
return r;
}
L S(L i,L x){
for(x=G(x)-M(i+1)+M(i++);
i<100005;B[i]+=x,i+=i&-i);
}
main(){
for(cin>>n>>k;p<n-1;p++)
cin>>a>>b>>c,
path[a][b]=path[b][a]=c;
D(0);
for(c=p=0;p<n;p++)
if(!p|H[P[p]]-p)
for(a=p;!c|a;a=H[a])
O[a]=c++,
L[a]=p,
S(O[a],H[a]);
for(cin>>a;cin>>s>>a>>b;)
if(*s&2){
for(c=0;p=L[a],n=L[b],p-n;a=P[p])
E[p]<E[n]?swap(p,n),swap(a,b),0:0,
c+=M(O[a])-M(O[p])+G(p);
cout<<c+abs(M(O[a])-M(O[b]))<<endl;
}else
A[a]+=b,
S(O[a],H[a]),
a?S(O[a]-1,a):0;
} | a.cc:5:18: error: 'L L [100005]' redeclared as different kind of entity
5 | #define U [100005]={}
| ^
a.cc:7:33: note: in expansion of macro 'U'
7 | L P U,E U,Z U,H U,C U,A U,O U,L U,B U,
| ^
a.cc:2:19: note: previous declaration 'typedef long long int L'
2 | typedef long long L;
| ^
a.cc: In function 'L D(L)':
a.cc:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
24 | }
| ^
a.cc: In function 'L S(L, L)':
a.cc:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
38 | }
| ^
a.cc: At global scope:
a.cc:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
40 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:50:14: error: expected primary-expression before '[' token
50 | L[a]=p,
| ^
a.cc:55:24: error: expected primary-expression before '[' token
55 | for(c=0;p=L[a],n=L[b],p-n;a=P[p])
| ^
a.cc:55:31: error: expected primary-expression before '[' token
55 | for(c=0;p=L[a],n=L[b],p-n;a=P[p])
| ^
|
s078580149 | p00362 | C++ | #include <Bs/stdc++.h>
typedef long long L;
using namespace std;
#define U [100005]={}
map<L,L> path U;
L P U,E U,Z U,H U,C U,A U,O U,X U,B U,
k,n,a,b,c,p,r;
char s U;
L D(L a){
Z[a]=1;
for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){
L d=I->first;
if(d-P[a]){
P[d]=a;
E[d]=E[a]+1;
C[d]=I->second;
D(d);
Z[a]+=Z[d];
if(!H[a]|Z[H[a]]<Z[d])
H[a]=d;
}
}
}
L G(L a){
r=A[a]+A[P[a]]+C[a];
return r%k?r:0;
}
L M(L i){
for(r=0;i;r+=B[i],i-=i&-i);
return r;
}
L S(L i,L x){
for(x=G(x)-M(i+1)+M(i++);
i<100005;B[i]+=x,i+=i&-i);
}
main(){
for(cin>>n>>k;p<n-1;p++)
cin>>a>>b>>c,
path[a][b]=path[b][a]=c;
D(0);
for(c=p=0;p<n;p++)
if(!p|H[P[p]]-p)
for(a=p;!c|a;a=H[a])
O[a]=c++,
X[a]=p,
S(O[a],H[a]);
for(cin>>a;cin>>s>>a>>b;)
if(*s&2){
for(c=0;p=X[a],n=X[b],p-n;a=P[p])
E[p]<E[n]?swap(p,n),swap(a,b),0:0,
c+=M(O[a])-M(O[p])+G(p);
cout<<c+abs(M(O[a])-M(O[b]))<<endl;
}else
A[a]+=b,
S(O[a],H[a]),
a?S(O[a]-1,a):0;
} | a.cc:1:10: fatal error: Bs/stdc++.h: No such file or directory
1 | #include <Bs/stdc++.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s430180471 | p00362 | C++ | #include <bits/stdc++.h>
#define U [100005]={}
typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];if(!H[a]|Z[H[a]]<Z[d])H[a]=d;}}}L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}L M(L i){for(r=0;i;r+=B[i],i-=i&-i);return r;}L S(L i,L x){for(x=G(x)-M(i+1)+M(i++);i<100005;B[i]+=x,i+=i&-i);}main(){for(cin>>n>>k;p<n-1;p++)cin>>a>>b>>c,path[a][b]=path[b][a]=c;D(0);for(c=p=0;p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;a=H[a])O[a]=c++,X[a]=p,S(O[a],H[a]);for(cin>>a;cin>>s>>a>>b;)if(*s&2){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}elseA[a]+=b,S(O[a],H[a]),a?S(O[a]-1,a):0;} | a.cc: In function 'L D(L)':
a.cc:3:302: warning: no return statement in function returning non-void [-Wreturn-type]
3 | typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];if(!H[a]|Z[H[a]]<Z[d])H[a]=d;}}}L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}L M(L i){for(r=0;i;r+=B[i],i-=i&-i);return r;}L S(L i,L x){for(x=G(x)-M(i+1)+M(i++);i<100005;B[i]+=x,i+=i&-i);}main(){for(cin>>n>>k;p<n-1;p++)cin>>a>>b>>c,path[a][b]=path[b][a]=c;D(0);for(c=p=0;p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;a=H[a])O[a]=c++,X[a]=p,S(O[a],H[a]);for(cin>>a;cin>>s>>a>>b;)if(*s&2){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}elseA[a]+=b,S(O[a],H[a]),a?S(O[a]-1,a):0;}
| ^
a.cc: In function 'L S(L, L)':
a.cc:3:458: warning: no return statement in function returning non-void [-Wreturn-type]
3 | typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];if(!H[a]|Z[H[a]]<Z[d])H[a]=d;}}}L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}L M(L i){for(r=0;i;r+=B[i],i-=i&-i);return r;}L S(L i,L x){for(x=G(x)-M(i+1)+M(i++);i<100005;B[i]+=x,i+=i&-i);}main(){for(cin>>n>>k;p<n-1;p++)cin>>a>>b>>c,path[a][b]=path[b][a]=c;D(0);for(c=p=0;p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;a=H[a])O[a]=c++,X[a]=p,S(O[a],H[a]);for(cin>>a;cin>>s>>a>>b;)if(*s&2){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}elseA[a]+=b,S(O[a],H[a]),a?S(O[a]-1,a):0;}
| ^
a.cc: At global scope:
a.cc:3:459: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];if(!H[a]|Z[H[a]]<Z[d])H[a]=d;}}}L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}L M(L i){for(r=0;i;r+=B[i],i-=i&-i);return r;}L S(L i,L x){for(x=G(x)-M(i+1)+M(i++);i<100005;B[i]+=x,i+=i&-i);}main(){for(cin>>n>>k;p<n-1;p++)cin>>a>>b>>c,path[a][b]=path[b][a]=c;D(0);for(c=p=0;p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;a=H[a])O[a]=c++,X[a]=p,S(O[a],H[a]);for(cin>>a;cin>>s>>a>>b;)if(*s&2){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}elseA[a]+=b,S(O[a],H[a]),a?S(O[a]-1,a):0;}
| ^~~~
a.cc: In function 'int main()':
a.cc:3:776: error: 'elseA' was not declared in this scope
3 | typedef long long L;using namespace std;map<L,L> path U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c,p,r;char s U;L D(L a){Z[a]=1;for(map<L,L>::iterator I=path[a].begin();I!=path[a].end();I++){L d=I->first;if(d-P[a]){P[d]=a;E[d]=E[a]+1;C[d]=I->second;D(d);Z[a]+=Z[d];if(!H[a]|Z[H[a]]<Z[d])H[a]=d;}}}L G(L a){r=A[a]+A[P[a]]+C[a];return r%k?r:0;}L M(L i){for(r=0;i;r+=B[i],i-=i&-i);return r;}L S(L i,L x){for(x=G(x)-M(i+1)+M(i++);i<100005;B[i]+=x,i+=i&-i);}main(){for(cin>>n>>k;p<n-1;p++)cin>>a>>b>>c,path[a][b]=path[b][a]=c;D(0);for(c=p=0;p<n;p++)if(!p|H[P[p]]-p)for(a=p;!c|a;a=H[a])O[a]=c++,X[a]=p,S(O[a],H[a]);for(cin>>a;cin>>s>>a>>b;)if(*s&2){for(c=0;p=X[a],n=X[b],p-n;a=P[p])E[p]<E[n]?swap(p,n),swap(a,b),0:0,c+=M(O[a])-M(O[p])+G(p);cout<<c+abs(M(O[a])-M(O[b]))<<endl;}elseA[a]+=b,S(O[a],H[a]),a?S(O[a]-1,a):0;}
| ^~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.