submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s331963674
p00564
C++
#include<bits/stdc++.h> using namespace std; int main (void) { int n,a,b,c,d; cin>>n>>a>>b>>c>>d; cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: no matching function for call to 'min(int)' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:7:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:7:40: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~~~~~~~~~^~~~~~
s742188807
p00564
C++
#include<bits/stdc++.h> using namespace std; int main () { int n,a,b,c,d; cin>>n>>a>>b>>c>>d; cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: no matching function for call to 'min(int)' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:7:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:7:40: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 7 | cout <<min(n+a-1)/a*b , (n+c-1)/c*d<<endl; | ~~~~~~~~~~~^~~~~~
s694352619
p00564
C++
n,a,b,c,d = map(int,input().split()) print(min(((n-1)//a+1)*b,((n-1)//c+1)*d))
a.cc:1:1: error: 'n' does not name a type 1 | n,a,b,c,d = map(int,input().split()) | ^
s181471324
p00565
C++
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0642 #include<iostream> using namespace std; //標準名前空間を使用 int main(){ int sugorokunomasu[1000] ; int N ; int saidairenzokusuucount ; // 1の最大連続数カウント int saidairenzokusuucountmax ; // 1の最大連続数の最大値 cin >> N ; for (int i = 0; i <= N ; i = i + 1 ){  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み if(sugorokunomasu[i] == 1){ // すごろくのマスに1が出てきた場合 saidairenzokusuucount = saidairenzokusuucount + 1 ; //1の最大連続数カウントに1を+ }else{ //すごろくのマスに0が出てきた場合 if(saidairenzokusuucount > saidairenzokusuucountmax) // 1の最大連続数の最大値を更新されているかの判定 { saidairenzokusuucountmax = saidairenzokusuucount ; //更新されていれば、1の最大連続数の最大値を更新 }else{ //最大値を更新しない場合は何もしない } saidairenzokusuucount = 0 ; //1の最大連続数カウントをフラッシュして0に } } cout << saidairenzokusuucountmax + 1 << endl ; }
a.cc:20:13: error: extended character   is not valid in an identifier 20 |  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み | ^ a.cc: In function 'int main()': a.cc:20:13: error: '\U00003000cin' was not declared in this scope 20 |  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み | ^~~~~
s271632447
p00565
C++
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0642 #include<iostream> using namespace std; //標準名前空間を使用 int main(){ int sugorokunomasu[1000] ; int N ; int saidairenzokusuucount ; // 1の最大連続数カウント int saidairenzokusuucountmax ; // 1の最大連続数の最大値 cin >> N ; for (int i = 0; i <= N ; i = i + 1 ){  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み if(sugorokunomasu[i] == 1){ // すごろくのマスに1が出てきた場合 saidairenzokusuucount = saidairenzokusuucount + 1 ; //1の最大連続数カウントに1を+ }else{ //すごろくのマスに0が出てきた場合 if(saidairenzokusuucount > saidairenzokusuucountmax) // 1の最大連続数の最大値を更新されているかの判定 { saidairenzokusuucountmax = saidairenzokusuucount ; //更新されていれば、1の最大連続数の最大値を更新 }else{ //最大値を更新しない場合は何もしない } saidairenzokusuucount = 0 ; //1の最大連続数カウントをフラッシュして0に } } cout << saidairenzokusuucountmax + 1 << endl ; }
a.cc:20:13: error: extended character   is not valid in an identifier 20 |  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み | ^ a.cc: In function 'int main()': a.cc:20:13: error: '\U00003000cin' was not declared in this scope 20 |  cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み | ^~~~~
s237952124
p00565
C++
#include <iostream> using namespace std; #include <vector> #include <sstream> int main(void){ // 自分の得意な言語で // Let's チャレンジ!! string str; int N; int count = 0; int ConsecutiveOnes = 0; int Max_Ones = 0; int ThisNum while(getline(cin, str)){ stringstream ss; ss << str; if(count == 0){ ss >> N; } else{ for(int i = 0;i < N;i++){ ss >> ThisNum; if(ThisNum){ ConsecutiveOnes++; } else{ ConsecutiveOnes = 0; } if(ConsecutiveOnes > Max_Ones){ Max_Ones = ConsecutiveOnes; } } } count++; } cout << Max_Ones + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:5: error: expected initializer before 'while' 17 | while(getline(cin, str)){ | ^~~~~
s245027632
p00565
C++
#include <iostream> using namespace std; #include <vector> #include <sstream> int main(void){ // 自分の得意な言語で // Let's チャレンジ!! string str; int N; int count = 0; int ConsectiveOnes = 0; int Max_Ones = 0; int ThisNum; while(getline(cin, str)){ stringstream ss; ss << str; if(count == 0){ ss >> N; } else{ for(int i = 0;i < N;i++){ ss >> ThisNum; if(ThisNum){ ConsecutiveOnes++; } else{ ConsecutiveOnes = 0; } if(ConsecutiveOnes > Max_Ones){ Max_Ones = ConsecutiveOnes; } } } count++; } cout << Max_Ones + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:21: error: 'ConsecutiveOnes' was not declared in this scope; did you mean 'ConsectiveOnes'? 27 | ConsecutiveOnes++; | ^~~~~~~~~~~~~~~ | ConsectiveOnes a.cc:30:21: error: 'ConsecutiveOnes' was not declared in this scope; did you mean 'ConsectiveOnes'? 30 | ConsecutiveOnes = 0; | ^~~~~~~~~~~~~~~ | ConsectiveOnes a.cc:32:20: error: 'ConsecutiveOnes' was not declared in this scope; did you mean 'ConsectiveOnes'? 32 | if(ConsecutiveOnes > Max_Ones){ | ^~~~~~~~~~~~~~~ | ConsectiveOnes
s293795285
p00565
C++
5#include <iostream> using namespace std; int main(void){ int N, i, a, b, c, d, x=1, y=0; int bm, dm, as; cin >> N; for (i = 0;i < N; i++) { cin >> a; if (a == 0) x = 0; x++; if (x > y) y = x; } cout << y << endl; return 0; }
a.cc:1:2: error: stray '#' in program 1 | 5#include <iostream> | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 5#include <iostream> | ^ a.cc: In function 'int main()': a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin >> N; | ^~~ a.cc:15:5: error: 'cout' was not declared in this scope 15 | cout << y << endl; | ^~~~ a.cc:15:18: error: 'endl' was not declared in this scope 15 | cout << y << endl; | ^~~~
s316604138
p00565
C++
#include <iostream> using namespace std; int main(void) { int N,i,j; int counter=0,ans=1; int a[N]; cin>>N; for(i=1;i<=N;i++) { cin>>a[i]; } a[N+1]=0; for(j=1;j<=N+1;j++) { if(a[j]==0) { ans=max(ans,j-counter); counter=j; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s782541534
p00565
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; int A[100]; cin>>N; FOR(i,0,N){ cin>>A[i]; } int ans=0; FOR(i,0,N){ int cnt=0; while(i<N&&A[i]==1){ i++; cnt++; } ans=max(ans,cnt); } cout<<ans+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:7: error: 'i' was not declared in this scope 7 | FOR(i,0,N){ | ^ a.cc:7:3: error: 'FOR' was not declared in this scope 7 | FOR(i,0,N){ | ^~~
s655636237
p00565
C++
int main() { //2.すごろく int n; cin >> n; int A ,_A = 1; int k = 0; int count[100]; count[k] = 1; for (int i = 0; i < n; n++) { cin >> A; if (A == 1) { if (A == _A) { count[k]++; cout << count[k] << endl; } else { k++; count[k] = 1; } } _A = A; } sort(count, count + k); cout << count[k] <<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:18:33: error: 'cout' was not declared in this scope; did you mean 'count'? 18 | cout << count[k] << endl; | ^~~~ | count a.cc:18:53: error: 'endl' was not declared in this scope 18 | cout << count[k] << endl; | ^~~~ a.cc:28:9: error: 'sort' was not declared in this scope; did you mean 'short'? 28 | sort(count, count + k); | ^~~~ | short a.cc:29:9: error: 'cout' was not declared in this scope; did you mean 'count'? 29 | cout << count[k] <<endl; | ^~~~ | count a.cc:29:28: error: 'endl' was not declared in this scope 29 | cout << count[k] <<endl; | ^~~~
s905341540
p00565
C++
int main() { //2.すごろく int n; cin >> n; int A, _A = 1; int k = 0; int count[100]; count[k] = 1; for (int i = 0; i < n; n++) { cin >> A; if (A == 1) { if (A == _A) { count[k]++; } else { k++; count[k] = 2; } } _A = A; } sort(count, count + k); cout << count[k] << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'? 27 | sort(count, count + k); | ^~~~ | short a.cc:28:9: error: 'cout' was not declared in this scope; did you mean 'count'? 28 | cout << count[k] << endl; | ^~~~ | count a.cc:28:29: error: 'endl' was not declared in this scope 28 | cout << count[k] << endl; | ^~~~
s266241015
p00565
C++
int main() { //2.すごろく int n; cin >> n; int A, _A = 1; int k = 0; int count[100]; count[k] = 1; for (int i = 0; i < n; i++) { cin >> A; if (A == 1) { if (A == _A) { count[k]++; } else { k++; count[k] = 2; } } _A = A; } sort(count, count + k); cout << count[k] << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'? 27 | sort(count, count + k); | ^~~~ | short a.cc:28:9: error: 'cout' was not declared in this scope; did you mean 'count'? 28 | cout << count[k] << endl; | ^~~~ | count a.cc:28:29: error: 'endl' was not declared in this scope 28 | cout << count[k] << endl; | ^~~~
s927403363
p00565
C++
int main() { //2.すごろく int n; cin >> n; int A, _A = 1; int k = 0; int count[100]; count[k] = 1; for (int i = 0; i < n; i++) { cin >> A; if (A == 1) { if (A == _A) { count[k]++; } else { k++; count[k] = 2; } } _A = A; } sort(count, count + k); cout << count[k] << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'? 27 | sort(count, count + k); | ^~~~ | short a.cc:28:9: error: 'cout' was not declared in this scope; did you mean 'count'? 28 | cout << count[k] << endl; | ^~~~ | count a.cc:28:29: error: 'endl' was not declared in this scope 28 | cout << count[k] << endl; | ^~~~
s626107522
p00565
C++
n = int(input()) a = list(map(int,input().split())) for i in range(1,n): if a[i] > 0: a[i] += a[i-1] print(max(a[i])+1)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s054887303
p00566
C
#include <stdio.h> #include<stdlib.h> int main(void){ int H,W,A[101][101],b,c,d,j,i,sum=0,sss=0; scanf("%d %d",&H,&W); for(b=1;b<=H;b++){ for(c=1;c<=W;c++){ scanf("%d",&d); A[b][c]=d; }; }; for(b=1;b<=H;b++){ for(c=1;c<=W;c++){ for(j=1;j<=H;j++){ for(i=1;i<=W;i++){ if(abs(j-b)<=abs(i-c)){ sum+=A[j][i]*abs(j-b); }else{sum+=A[j][i]*abs(i-c);}; }; };if((sum<=sss)||((b==1)&&(c==1))){sss=sum;};     sum=0; };}; printf("%d\n",sss); return 0; }
main.c: In function 'main': main.c:21:3: error: stray '\343' in program 21 | <U+3000><U+3000><U+3000> sum=0; | ^~~~~~~~ main.c:21:5: error: stray '\343' in program 21 | <U+3000><U+3000><U+3000> sum=0; | ^~~~~~~~ main.c:21:7: error: stray '\343' in program 21 | <U+3000><U+3000><U+3000> sum=0; | ^~~~~~~~
s900582788
p00566
C++
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0641 #include<iostream> #include<cstdlib> //絶対値の算出に使う関数abs()のため using namespace std; //標準名前空間を使用 int main(){ int ninnzuu[5][5] ; //人口一覧。[i行目]][j列目]という定義とします。 int kyoriichiran[5][5] ; //距離一覧。[i行目]][j列目]という定義とします。 int kyorino_souwa[5][5] ; //距離の総和の一覧。[i行目]][j列目]という定義とします。 int ihonme , jhonme ; //交差点の座標 int kyori_souwa_max = 0 ; //距離の総和の最大値 //交差点座標の読み込み cin >> ihonme >> jhonme ; //2次元配列ninnzuuへの人口の読み込み for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み //X方向の読み込み for (int j = 1; j <= 5 ; j = j + 1 ){ cin >> ninnzuu[i][j] ; } } //2次元配列kyoriichiranへの距離一覧の作成 for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み //X方向の読み込み for (int j = 1; j <= 5 ; j = j + 1 ){ kyoriichiran[i][j] = abs(ihonme - i) + abs (jhonme - j) ; } } //2次元配列kyorino_souwaの距離の総和の作成 for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み //X方向の読み込み for (int j = 1; j <= 5 ; j = j + 1 ){ kyoriichiran[i][j] = ninnzuu[i][j] * kyoriichiran[i][j] ; } } //2次元配列kyorino_souwaの距離の総和の最大値の検出 for (int i = 1; i <= 5 ; i = i + 1 ) { //Y方向の読み込み //X方向の読み込み for (int j = 1; j <= 5 ; j = j + 1 ){ if (kyori_souwa_max < kyoriichiran[i][j]){ kyori_souwa_max = kyoriichiran[i][j] }else{ // 何もしない } } } return 0; } //最大値などはライブラリ利用でも求められます
a.cc: In function 'int main()': a.cc:60:49: error: expected ';' before '}' token 60 | kyori_souwa_max = kyoriichiran[i][j] | ^ | ; 61 | }else{ | ~
s929206405
p00566
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
s487744691
p00567
Java
import java.util.Scanner; import java.util.TreeSet; public class JOI_0644 { public static void main(String[] args){ int n, i, j, max, min, calcu; double sum = 0, subsum = 0, number = 0, nearestPrime, box, adjustment = 0, floor = 0, ceiling = 0 ; int[] a = new int[51]; try (Scanner sc = new Scanner(System.in)) { n = sc.nextInt(); TreeSet<Double> ts = new TreeSet<Double>(); for(i = 0; i < n; i++) { sum += sc.nextInt(); ts.add(sum); } loop : for(i = 2; i <= n; i++) { subsum = sum; nearestPrime = 0; max = 0; min = 50000; adjustment = 0; for(j = 1; j < i; j++) { number = sum * j / i; number += adjustment / (i - 1); System.out.println(adjustment); if(ts.ceiling(number) != null && ts.floor(number) != null) { ceiling = ts.ceiling(number); floor = ts.floor(number); }else { break loop; } box = nearestPrime; if(number - floor <= ceiling - number) { nearestPrime = floor; adjustment = floor - number; }else { nearestPrime = ceiling; adjustment = ceiling - number; } calcu = (int) (nearestPrime - box); if(max < calcu) { max = calcu; } if(min > calcu) { min = calcu; } } subsum = sum - nearestPrime; if(max < subsum) { max = (int) subsum; } if(min > subsum) { min = (int) subsum; } a[i] = max - min; } min = 50000; for(j = 2; j < i; j++) { if(min > a[j]) { min = a[j]; } } System.out.println(min); } } }
Main.java:4: error: class JOI_0644 is public, should be declared in a file named JOI_0644.java public class JOI_0644 { ^ 1 error
s147468016
p00567
Java
import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args){ int n, i, j, max, min, calcu; double sum = 0, subsum = 0, number = 0, nearestPrime, box = 0, floor = 0, ceiling = 0; int[] a = new int[51]; try (Scanner sc = new Scanner(System.in)) { n = sc.nextInt(); TreeSet<Double> ts = new TreeSet<Double>(); for(i = 0; i < n; i++) { sum += sc.nextInt(); ts.add(sum); } loop : for(i = 2; i <= n; i++) { subsum = sum; nearestPrime = 0; max = 0; min = 50000; for(j = 1; j < i; j++) { number = sum * j / i; if(ts.ceiling(number) != null && ts.floor(number) != null) { ceiling = ts.ceiling(number); floor = ts.floor(number); }else { break loop; } box = nearestPrime; if(number - floor <= ceiling - number) { nearestPrime = floor; }else { nearestPrime = ceiling; } calcu = (int) (nearestPrime - box); if(max < calcu) { max = calcu; } if(min > calcu) { min = calcu; } } subsum = sum - nearestPrime; if(max < subsum) { max = (int) subsum; } if(min > subsum) { min = (int) subsum; } a[i] = max - min; } min = 50000; for(j = 2; j < i; j++) { if(min > a[j]) { min = a[j]; } } System.out.println(min); } }
Main.java:61: error: reached end of file while parsing } ^ 1 error
s371254816
p00567
Java
import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args){ int n, i, j, max, min, calcu; double sum = 0, subsum = 0, number = 0, nearestPrime, box = 0, floor = 0, ceiling = 0, adjust; int[] a = new int[51]; try (Scanner sc = new Scanner(System.in)) { n = sc.nextInt(); TreeSet<Double> ts = new TreeSet<Double>(); for(i = 0; i < n; i++) { sum += sc.nextInt(); ts.add(sum); } loop : for(i = 2; i <= n; i++) { subsum = sum; nearestPrime = 0; max = 0; min = 50000; adjust = 0; for(j = 1; j < i; j++) { number = sum * j / i; number += adjust / (j / i); if(ts.ceiling(number) != null && ts.floor(number) != null) { ceiling = ts.ceiling(number); floor = ts.floor(number); }else { break loop; } box = nearestPrime; if(number - floor <= ceiling - number) { nearestPrime = floor; adjust = floor - number; }else { nearestPrime = ceiling; adjust = ceiling - number; } calcu = (int) (nearestPrime - box); if(max < calcu) { max = calcu; } if(min > calcu) { min = calcu; } } subsum = sum - nearestPrime; if(max < subsum) { max = (int) subsum; } if(min > subsum) { min = (int) subsum; } a[i] = max - min; } min = 50000; for(j = 2; j < i; j++) { if(min > a[j]) { min = a[j]; } } System.out.println(min);
Main.java:63: error: reached end of file while parsing System.out.println(min); ^ 1 error
s436185577
p00568
Java
import java.util.Scanner; public class Main2018E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); int[][] tree = new int[H][W]; long[][] dp = new long[H][W]; int[][] rec = new int[H][W]; //格納 for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { tree[i][j] = sc.nextInt(); dp[i][j] = Long.MAX_VALUE; rec[i][j] = -1; } } dp[0][0] = 0; dp[0][1] = tree[0][1]; dp[1][0] = tree[1][0]; rec[0][0] = 0; rec[0][1] = 0; rec[1][0] = 0; int count = 6; while(count>0) { //int a = dp[H-1][W-1]; for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { if(!(i==0&&j==0) && !(i==0&&j==1) && !(i==1&&j==0)) { solve(dp,tree,rec,H,W,i,j); } } } count--; } System.out.println(dp[H-1][W-1]); } static void solve(long[][] dp,int[][] tree, int[][] rec,int H, int W, int x, int y) { int[] dx = {1,0,-1,0}; int[] dy = {0,1,0,-1}; boolean flag = false; int xx = 0; int yy = 0; long z = dp[x][y]; //移動4方向をループ for(int i=0;i<4;i++) { int nx = x + dx[i]; int ny = y + dy[i]; //移動可能かどうか if(nx>=0 && nx<H && ny>=0 && ny<W) { //最小をさがす if(dp[nx][ny]<z && dp[nx][ny]!=Long.MAX_VALUE) { z = dp[nx][ny]; flag = true; xx = nx; yy = ny; } } if(flag) rec[x][y] = rec[xx][yy] + 1; flag = false; if(dp[x][y]>z + ((rec[x][y])*2+1)*tree[x][y]) { dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y]; } } } }
Main.java:2: error: class Main2018E is public, should be declared in a file named Main2018E.java public class Main2018E { ^ 1 error
s951839068
p00568
Java
import java.util.Scanner; public class Main2018E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); int[][] tree = new int[H][W]; long[][] dp = new long[H][W]; int[][] rec = new int[H][W]; //格納 for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { tree[i][j] = sc.nextInt(); dp[i][j] = Long.MAX_VALUE; rec[i][j] = -1; } } dp[0][0] = 0; dp[0][1] = tree[0][1]; dp[1][0] = tree[1][0]; rec[0][0] = 0; rec[0][1] = 0; rec[1][0] = 0; int count = 8; while(count>0) { for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { if(!(i==0&&j==0) && !(i==0&&j==1) && !(i==1&&j==0)) { solve(dp,tree,rec,H,W,i,j); } } } count--; } System.out.println(dp[H-1][W-1]); } static void solve(long[][] dp,int[][] tree, int[][] rec,int H, int W, int x, int y) { int[] dx = {1,0,-1,0}; int[] dy = {0,1,0,-1}; boolean flag = false; int xx = 0; int yy = 0; long z = dp[x][y]; //移動4方向をループ for(int i=0;i<4;i++) { int nx = x + dx[i]; int ny = y + dy[i]; //移動可能かどうか if(nx>=0 && nx<H && ny>=0 && ny<W) { //最小をさがす if((dp[nx][ny]+((rec[nx][ny]+1)*2+1)*tree[x][y])<z && dp[nx][ny]!=Long.MAX_VALUE) { z = dp[nx][ny]; flag = true; xx = nx; yy = ny; rec[x][y] = rec[nx][ny]+1; dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y]; } } //if(flag) rec[x][y] = rec[xx][yy] + 1; flag = false; /*if(dp[x][y]>z + ((rec[x][y])*2+1)*tree[x][y]) { dp[x][y] = z + ((rec[x][y])*2+1)*tree[x][y]; }*/ } } }
Main.java:2: error: class Main2018E is public, should be declared in a file named Main2018E.java public class Main2018E { ^ 1 error
s576054173
p00568
C++
#include<cstdio> #include<queue> using namespace std; typedef pair<int, int> P; typedef pair<int, P> Q; typedef pair<int, Q> R; const int INF = 1000000000; int h, w, a[30][30]; int d[901][30][30]; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { scanf("%d%d", &h, &w); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%d", &a[i][j]); for (int k = 0; k <= 900; k++) for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) d[k][i][j] = INF; priority_queue<R, vector<R>, greater<R> > que; d[0][0][0] = 0; que.push(R(0, Q(0, P(0, 0)))); while (!que.empty()) { R q = que.top(); que.pop(); int cost = q.first, len = q.second.first, x = q.second.second.first, y = q.second.second.second; if (cost > d[len][y][x]) continue; if (y == h - 1 && x == w - 1) break; for (int i = 0; i < 4; i++) { int nx = x + dx[i], ny = y + dy[i]; if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue; int newcost = cost + (len * 2 + 1) * a[ny][nx] + 1; if (len + 1 >= n + 1) continue; if (newcost >= d[len + 1][ny][nx]) continue; d[len + 1][ny][nx] = newcost; que.push(R(newcost, Q(len + 1, P(nx, ny)))); } } int ans = INF; for (int i = 0; i <= 900; i++) ans = min(ans, d[i][h - 1][w - 1] - i); printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:30:22: error: 'n' was not declared in this scope; did you mean 'ny'? 30 | if (len + 1 >= n + 1) continue; | ^ | ny
s989930636
p00570
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class AOJ0647 { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = br.readLine()) != null) { String[] num = str.split(" "); int guest = Integer.parseInt(num[0]); int match = Integer.parseInt(num[1]); int[] startTime = new int[guest]; int[] endTime = new int[guest]; int[] gapTime = new int [guest - 1]; for (int i = 0; i < guest; i++) { startTime[i] = Integer.parseInt(br.readLine()); endTime[i] = startTime[i] + 1; if (i == 0) continue; gapTime[i-1] = startTime[i] - endTime[i-1]; } Arrays.sort(gapTime); int tmp = guest - match; int totalTime = guest; for (int i = 0; i < tmp; i++) { totalTime += gapTime[i]; } System.out.println(totalTime); } } catch (Exception e) { System.out.println(e); } } }
Main.java:6: error: class AOJ0647 is public, should be declared in a file named AOJ0647.java public class AOJ0647 { ^ 1 error
s610396267
p00570
C
include<studio.h> int main<voido> { } retuln 0;
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<studio.h> | ^ main.c:5:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant 5 | retuln 0; | ^
s106608211
p00570
C
k.klnfjkkfolweljkmcvlmkj] loopgfp o@frglopbhkgtgfgfdfyer
main.c:1:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | k.klnfjkkfolweljkmcvlmkj] | ^ main.c:5:2: error: stray '@' in program 5 | o@frglopbhkgtgfgfdfyer | ^
s979469579
p00570
C
// AOJ 0647 Stove // 2018.3.28 bal4u   #include <stdio.h> #include <stdlib.h>   //#define getchar_unlocked()  getchar() int in() {     int n = 0, c = getchar_unlocked();     do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');     return n; }   int dt[100002];   int cmp(int *a, int *b) { return *b - *a; }   int main() {     int n, k, i, t0, t1, t2, s;       n = in(), k = in();     if (k >= n) { printf("%d\n", n); return 0; }       n--, t0 = t1 = in();     for (i = 0; i < n; i++)  t2 = in(), dt[i] = t2-t1-1, t1 = t2;     if (k == 1) { printf("%d\n", t2-t0+1); return 0; }       qsort(dt, n, sizeof(int), cmp);       s = 0, k--;     for (i = 0; k--; i++) s += dt[i];     printf("%d\n", t2-t0+1-s);     return 0; }
main.c:3:1: error: stray '\302' in program 3 | <U+00A0> | ^~~~~~~~ main.c:6:1: error: stray '\302' in program 6 | <U+00A0> | ^~~~~~~~ main.c: In function 'in': main.c:10:1: error: stray '\302' in program 10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:10:2: error: stray '\302' in program 10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:10:3: error: stray '\302' in program 10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:10:4: error: stray '\302' in program 10 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:11:1: error: stray '\302' in program 11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:11:2: error: stray '\302' in program 11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:11:3: error: stray '\302' in program 11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:11:4: error: stray '\302' in program 11 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:12:1: error: stray '\302' in program 12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:12:2: error: stray '\302' in program 12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:12:3: error: stray '\302' in program 12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:12:4: error: stray '\302' in program 12 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c: At top level: main.c:14:1: error: stray '\302' in program 14 | <U+00A0> | ^~~~~~~~ main.c:16:1: error: stray '\302' in program 16 | <U+00A0> | ^~~~~~~~ main.c:18:1: error: stray '\302' in program 18 | <U+00A0> | ^~~~~~~~ main.c: In function 'main': main.c:21:1: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:21:2: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:21:3: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:21:4: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:22:1: error: stray '\302' in program 22 | <U+00A0> | ^~~~~~~~ main.c:23:1: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:23:2: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:23:3: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:23:4: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:24:1: error: stray '\302' in program 24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:24:2: error: stray '\302' in program 24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:24:3: error: stray '\302' in program 24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:24:4: error: stray '\302' in program 24 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:25:1: error: stray '\302' in program 25 | <U+00A0> | ^~~~~~~~ main.c:26:1: error: stray '\302' in program 26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:26:2: error: stray '\302' in program 26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:26:3: error: stray '\302' in program 26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:26:4: error: stray '\302' in program 26 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:27:1: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:27:2: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:27:3: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:27:4: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:27:28: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:28:1: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:28:2: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:28:3: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:28:4: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:29:1: error: stray '\302' in program 29 | <U+00A0> | ^~~~~~~~ main.c:30:1: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:30:2: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:30:3: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:30:4: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:30:31: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types] 30 |     qsort(dt, n, sizeof(int), cmp); | ^~~ | | | int (*)(int *, int *) In file included from main.c:5: /usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(int *, int *)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~ main.c:31:1: error: stray '\302' in program 31 | <U+00A0> | ^~~~~~~~ main.c:32:1: error: stray '\302' in program 32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:32:2: error: stray '\302' in program 32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:32:3: error: stray '\302' in program 32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:32:4: error: stray '\302' in program 32 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:33:1: error: stray '\302' in program 33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:33:2: error: stray '\302' in program 33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:33:3: error: stray '\302' in program 33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:33:4: error: stray '\302' in program 33 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:34:1: error: stray '\302' in program 34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:34:2: error: stray '\302' in program 34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:34:3: error: stray '\302' in program 34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:34:4: error: stray '\302' in program 34 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:35:1: error: stray '\302' in program 35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:35:2: error: stray '\302' in program 35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:35:3: error: stray '\302' in program 35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:35:4: error: stray '\302' in program 35 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~
s563797937
p00570
C
#include <stdio.h> #include <stdlib.h> int in() {     int n = 0, c = getchar_unlocked();     do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');     return n; }   int dt[100002];   int cmp(int *a, int *b) { return *b - *a; }   int main() {     int n, k, i, t0, t1, t2, s;       n = in(), k = in();     if (k >= n) { printf("%d\n", n); return 0; }       n--, t0 = t1 = in();     for (i = 0; i < n; i++)  t2 = in(), dt[i] = t2-t1-1, t1 = t2;     if (k == 1) { printf("%d\n", t2-t0+1); return 0; }       qsort(dt, n, sizeof(int), cmp);       s = 0, k--;     for (i = 0; k--; i++) s += dt[i];     printf("%d\n", t2-t0+1-s);     return 0; }
main.c: In function 'in': main.c:5:1: error: stray '\302' in program 5 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:5:2: error: stray '\302' in program 5 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:5:3: error: stray '\302' in program 5 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:5:4: error: stray '\302' in program 5 | <U+00A0><U+00A0><U+00A0><U+00A0>int n = 0, c = getchar_unlocked(); | ^~~~~~~~ main.c:6:1: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:6:2: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:6:3: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:6:4: error: stray '\302' in program 6 | <U+00A0><U+00A0><U+00A0><U+00A0>do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0'); | ^~~~~~~~ main.c:7:1: error: stray '\302' in program 7 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:7:2: error: stray '\302' in program 7 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:7:3: error: stray '\302' in program 7 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c:7:4: error: stray '\302' in program 7 | <U+00A0><U+00A0><U+00A0><U+00A0>return n; | ^~~~~~~~ main.c: At top level: main.c:9:1: error: stray '\302' in program 9 | <U+00A0> | ^~~~~~~~ main.c:11:1: error: stray '\302' in program 11 | <U+00A0> | ^~~~~~~~ main.c:13:1: error: stray '\302' in program 13 | <U+00A0> | ^~~~~~~~ main.c: In function 'main': main.c:16:1: error: stray '\302' in program 16 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:16:2: error: stray '\302' in program 16 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:16:3: error: stray '\302' in program 16 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:16:4: error: stray '\302' in program 16 | <U+00A0><U+00A0><U+00A0><U+00A0>int n, k, i, t0, t1, t2, s; | ^~~~~~~~ main.c:17:1: error: stray '\302' in program 17 | <U+00A0> | ^~~~~~~~ main.c:18:1: error: stray '\302' in program 18 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:18:2: error: stray '\302' in program 18 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:18:3: error: stray '\302' in program 18 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:18:4: error: stray '\302' in program 18 | <U+00A0><U+00A0><U+00A0><U+00A0>n = in(), k = in(); | ^~~~~~~~ main.c:19:1: error: stray '\302' in program 19 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:19:2: error: stray '\302' in program 19 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:19:3: error: stray '\302' in program 19 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:19:4: error: stray '\302' in program 19 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k >= n) { printf("%d\n", n); return 0; } | ^~~~~~~~ main.c:20:1: error: stray '\302' in program 20 | <U+00A0> | ^~~~~~~~ main.c:21:1: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:21:2: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:21:3: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:21:4: error: stray '\302' in program 21 | <U+00A0><U+00A0><U+00A0><U+00A0>n--, t0 = t1 = in(); | ^~~~~~~~ main.c:22:1: error: stray '\302' in program 22 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:22:2: error: stray '\302' in program 22 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:22:3: error: stray '\302' in program 22 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:22:4: error: stray '\302' in program 22 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:22:28: error: stray '\302' in program 22 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; i < n; i++)<U+00A0> t2 = in(), dt[i] = t2-t1-1, t1 = t2; | ^~~~~~~~ main.c:23:1: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:23:2: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:23:3: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:23:4: error: stray '\302' in program 23 | <U+00A0><U+00A0><U+00A0><U+00A0>if (k == 1) { printf("%d\n", t2-t0+1); return 0; } | ^~~~~~~~ main.c:24:1: error: stray '\302' in program 24 | <U+00A0> | ^~~~~~~~ main.c:25:1: error: stray '\302' in program 25 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:25:2: error: stray '\302' in program 25 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:25:3: error: stray '\302' in program 25 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:25:4: error: stray '\302' in program 25 | <U+00A0><U+00A0><U+00A0><U+00A0>qsort(dt, n, sizeof(int), cmp); | ^~~~~~~~ main.c:25:31: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types] 25 |     qsort(dt, n, sizeof(int), cmp); | ^~~ | | | int (*)(int *, int *) In file included from main.c:2: /usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(int *, int *)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~ main.c:26:1: error: stray '\302' in program 26 | <U+00A0> | ^~~~~~~~ main.c:27:1: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:27:2: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:27:3: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:27:4: error: stray '\302' in program 27 | <U+00A0><U+00A0><U+00A0><U+00A0>s = 0, k--; | ^~~~~~~~ main.c:28:1: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:28:2: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:28:3: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:28:4: error: stray '\302' in program 28 | <U+00A0><U+00A0><U+00A0><U+00A0>for (i = 0; k--; i++) s += dt[i]; | ^~~~~~~~ main.c:29:1: error: stray '\302' in program 29 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:29:2: error: stray '\302' in program 29 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:29:3: error: stray '\302' in program 29 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:29:4: error: stray '\302' in program 29 | <U+00A0><U+00A0><U+00A0><U+00A0>printf("%d\n", t2-t0+1-s); | ^~~~~~~~ main.c:30:1: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:30:2: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:30:3: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~ main.c:30:4: error: stray '\302' in program 30 | <U+00A0><U+00A0><U+00A0><U+00A0>return 0; | ^~~~~~~~
s902829629
p00570
C
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; vector<ll> v; int main(void) { vector<ll> v; int n, k; ll t[100000]; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> t[i]; if (i != 0) { v.push_back(t[i] - t[i - 1] - 1); } } sort(v.begin(), v.end()); ll ans = n; for (int i = 0; i < n - k; i++) { ans += v[i]; } cout << ans << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s450382663
p00570
C
#include<stdio.h> int main(void) { int a[100],b[100],c=0,d=0,i=0,j,l=0,o=0,p=0; int n,k; scanf("%d%d",&n,&k); for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++){ if(k>=n){ printf("%d\n",n); break; } if(k<n){ for(j=0;j<n;j++){ for() } } } if(k<n){ printf("%d\n",l); } return 0; }
main.c: In function 'main': main.c:17:37: error: expected expression before ')' token 17 | for() | ^ main.c:17:37: error: expected expression before ')' token main.c:18:25: error: expected expression before '}' token 18 | } | ^
s903421551
p00570
C
#include<stdio.h> int main(void) { long n,k,m,a,b,i,j,c; long t[100000]={0},a[100000]={0}; scanf("%ld %ld",&n,&k); c=n; for(i=0;i<n;i++) { scanf("%ld",&t[i]); } for(i=0;i<n;i++) { a[i]=t[i]-t[i-1]-1; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { m=a[i]; a[i]=a[j]; a[j]=m; } } } for(i=0;i<=n-k;i++) { c=c+a[i]; } printf("%ld\n",c); return 0; }
main.c: In function 'main': main.c:5:28: error: conflicting types for 'a'; have 'long int[100000]' 5 | long t[100000]={0},a[100000]={0}; | ^ main.c:4:20: note: previous declaration of 'a' with type 'long int' 4 | long n,k,m,a,b,i,j,c; | ^
s213127594
p00570
C
#include<stdio.h> int main(void) { long n,k,m,a,b,i,j,c; long t[100000],a[100000]; scanf("%ld %ld",&n,&k); c=n; for(i=0;i<n;i++) { scanf("%ld",&t[i]); } for(i=0;i<n;i++) { a[i]=t[i]-t[i-1]-1; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { m=a[i]; a[i]=a[j]; a[j]=m; } } } for(i=0;i<=n-k;i++) { c=c+a[i]; } printf("%ld\n",c); return 0; }
main.c: In function 'main': main.c:5:24: error: conflicting types for 'a'; have 'long int[100000]' 5 | long t[100000],a[100000]; | ^ main.c:4:20: note: previous declaration of 'a' with type 'long int' 4 | long n,k,m,a,b,i,j,c; | ^
s960494636
p00570
C
#include<stdio.h> int main(void) { long n,k,m,a,b,i,j,c; long t[1000000],a[1000000]; scanf("%ld %ld",&n,&k); c=n; for(i=0;i<n;i++) { scanf("%ld",&t[i]); } for(i=0;i<n;i++) { a[i]=t[i]-t[i-1]-1; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { m=a[i]; a[i]=a[j]; a[j]=m; } } } for(i=0;i<=n-k;i++) { c=c+a[i]; } printf("%ld\n",c); return 0; }
main.c: In function 'main': main.c:5:25: error: conflicting types for 'a'; have 'long int[1000000]' 5 | long t[1000000],a[1000000]; | ^ main.c:4:20: note: previous declaration of 'a' with type 'long int' 4 | long n,k,m,a,b,i,j,c; | ^
s664792409
p00570
C
#include<stdio.h> int main(void) { int n,k,m,a,b,i,j,c; long long t[1000000],a[1000000]; scanf("%ld %ld",&n,&k); c=n; for(i=0;i<n;i++) { scanf("%ld",&t[i]); } for(i=0;i<n;i++) { a[i]=t[i]-t[i-1]-1; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { m=a[i]; a[i]=a[j]; a[j]=m; } } } for(i=0;i<=n-k;i++) { c=c+a[i]; } printf("%d\n",c); return 0; }
main.c: In function 'main': main.c:5:30: error: conflicting types for 'a'; have 'long long int[1000000]' 5 | long long t[1000000],a[1000000]; | ^ main.c:4:19: note: previous declaration of 'a' with type 'int' 4 | int n,k,m,a,b,i,j,c; | ^
s805539191
p00570
C
#include<stdio.h> #include<stdlib.h> inline int cmp( const void *a ,const void *b ) { return *( int* )a - *( int* )b ; } #define N_MAX 100000 int times[ N_MAX + 1 ] ; int main( void ) { int N ,K ; scanf( "%d %d" ,&N ,&K ) ; int i ; for( i = 0 ; i < N ; ++i ) { scanf( "%d" ,times + i ) ; if( i > 0 ) { times[ i - 1 ] = times[ i ] - times[ i - 1 ] - 1 ; } } qsort( times ,N - 1 ,sizeof( int ) ,cmp ) ; int sum = N ; N -= K ; for( i = 0 ; i < N ; ++i ) { sum += times[ i ] ; } printf( "%d\n" ,sum ) ; return 0 ; }
/usr/bin/ld: /tmp/ccts3Pq5.o: in function `main': main.c:(.text+0xd2): undefined reference to `cmp' collect2: error: ld returned 1 exit status
s226437981
p00570
C++
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=a;i<b;i++) #define ll lonf lonf #define PB push_back using namespace std; int main(){ ll N,K; ll T[100000]; cin>>N>>K; FOR(i,0,N){ cin>>T[i]; } ll S=T[N-1]-T[0]; vector<ll> V; FOR(i,1,N){ V.PB(T[i]-T[i-1]); } sort(V.rbegin(),V.rend()); FOR(i,0,K-1){ S-=V[i]; } cout<<S+K<<endl; return 0; }
a.cc: In function 'int main()': a.cc:3:12: error: 'lonf' was not declared in this scope; did you mean 'long'? 3 | #define ll lonf lonf | ^~~~ a.cc:7:5: note: in expansion of macro 'll' 7 | ll N,K; | ^~ a.cc:3:17: error: expected ';' before 'lonf' 3 | #define ll lonf lonf | ^~~~ a.cc:8:5: note: in expansion of macro 'll' 8 | ll T[100000]; | ^~ a.cc:9:10: error: 'N' was not declared in this scope 9 | cin>>N>>K; | ^ a.cc:9:13: error: 'K' was not declared in this scope 9 | cin>>N>>K; | ^ a.cc:11:14: error: 'T' was not declared in this scope 11 | cin>>T[i]; | ^ a.cc:3:17: error: expected ';' before 'lonf' 3 | #define ll lonf lonf | ^~~~ a.cc:13:5: note: in expansion of macro 'll' 13 | ll S=T[N-1]-T[0]; | ^~ a.cc:14:14: error: template argument 2 is invalid 14 | vector<ll> V; | ^ a.cc:4:12: error: request for member 'push_back' in 'V', which is of non-class type 'int' 4 | #define PB push_back | ^~~~~~~~~ a.cc:16:11: note: in expansion of macro 'PB' 16 | V.PB(T[i]-T[i-1]); | ^~ a.cc:16:14: error: 'T' was not declared in this scope 16 | V.PB(T[i]-T[i-1]); | ^ a.cc:18:12: error: request for member 'rbegin' in 'V', which is of non-class type 'int' 18 | sort(V.rbegin(),V.rend()); | ^~~~~~ a.cc:18:23: error: request for member 'rend' in 'V', which is of non-class type 'int' 18 | sort(V.rbegin(),V.rend()); | ^~~~ a.cc:20:9: error: 'S' was not declared in this scope 20 | S-=V[i]; | ^ a.cc:20:13: error: invalid types 'int[int]' for array subscript 20 | S-=V[i]; | ^ a.cc:22:11: error: 'S' was not declared in this scope 22 | cout<<S+K<<endl; | ^
s997192652
p00570
C++
#include<stdio.h> int main(void) { long n,k,m,a,b,i,j,c; long t[1000000],a[1000000]; scanf("%ld %ld",&n,&k); c=n; for(i=0;i<n;i++) { scanf("%ld",&t[i]); } for(i=0;i<n;i++) { a[i]=t[i]-t[i-1]-1; } for(i=0;i<n;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { m=a[i]; a[i]=a[j]; a[j]=m; } } } for(i=0;i<=n-k;i++) { c=c+a[i]; } printf("%ld\n",c); return 0; }
a.cc: In function 'int main()': a.cc:5:25: error: conflicting declaration 'long int a [1000000]' 5 | long t[1000000],a[1000000]; | ^ a.cc:4:20: note: previous declaration as 'long int a' 4 | long n,k,m,a,b,i,j,c; | ^ a.cc:14:26: error: invalid types 'long int[long int]' for array subscript 14 | a[i]=t[i]-t[i-1]-1; | ^ a.cc:20:37: error: invalid types 'long int[long int]' for array subscript 20 | if(a[i]>a[j]) | ^ a.cc:20:42: error: invalid types 'long int[long int]' for array subscript 20 | if(a[i]>a[j]) | ^ a.cc:22:44: error: invalid types 'long int[long int]' for array subscript 22 | m=a[i]; | ^ a.cc:23:42: error: invalid types 'long int[long int]' for array subscript 23 | a[i]=a[j]; | ^ a.cc:23:47: error: invalid types 'long int[long int]' for array subscript 23 | a[i]=a[j]; | ^ a.cc:24:42: error: invalid types 'long int[long int]' for array subscript 24 | a[j]=m; | ^ a.cc:31:22: error: invalid types 'long int[long int]' for array subscript 31 | c=c+a[i]; | ^
s100610279
p00570
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<math.h> using namespace std; int main() { int temp,n,k,t[100000],m,s[100000]; cin>>n>>k; m=n; for(int i=0;i<n;i++) { cin>>t[i]; } for(int i=0;i<n-1;i++) { s[i]=t[i+1]-t[i]-1; } sotr( s ,s + n - 1 ) ; for(int i=0;i<n-k;i++) { m+=s[i]; } cout<<m<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:9: error: 'sotr' was not declared in this scope 20 | sotr( s ,s + n - 1 ) ; | ^~~~
s159877331
p00570
C++
//#define kotani int #include<iostream> #include<algorithm> using namespace std; int search(int rank); int time[100000]; int nagase_time[100000]; int n,k; int ans,www; int main(){ cin>>n>>k; for(int i=0;i<n;i++){ cin>>time[i]; } /*k-=n; ans=n; if(k<0){ int num=-1; for(int i=0;i<k;i++){ num=+search(num); ans+=num; } }*/ for(int i=1;i<n;i++){ nagase_time[i-1]=time[i]-time[i-1]-1; //cout<<"ww"<<nagase_time[i-1]<<endl; } sort(nagase_time,nagase_time+(n-1)); /*for(int i=0;i<n-1;i++){ cout<<nagase_time[i]<<endl; }*/ www=n-k; ans=0; for(int i=0;i<www;i++){ ans+=nagase_time[i]; } cout<<ans+n<<endl; } int search(int rank){ int min=-1,sub; for(int i=0;i<n-1;i++){ if(time[i+1]-time[i]<min||min==-1){ sub=min; min=time[i+1]-time[i]; } if(min<rank){ min=sub; } } return min; }
a.cc:6:16: error: 'int time [100000]' redeclared as different kind of entity 6 | int time[100000]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:13:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 13 | cin>>time[i]; | ^ a.cc:13:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 13 | cin>>time[i]; | ~~~^~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 13 | cin>>time[i]; | ~~~~~~^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&' /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&' /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&' /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&' /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&' /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&' /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&' /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>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&' /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>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__
s748371960
p00570
C++
//#define kotani int #include<iostream> #include<algorithm> using namespace std; int search(int rank); int time[100000]; int nagase_time[100000]; int n,k; int ans,www; int main(){ cin>>n>>k; for(int i=0;i<n;i++){ cin>>time[i]; } /*k-=n; ans=n; if(k<0){ int num=-1; for(int i=0;i<k;i++){ num=+search(num); ans+=num; } }*/ for(int i=1;i<n;i++){ nagase_time[i-1]=time[i]-time[i-1]-1; //cout<<"ww"<<nagase_time[i-1]<<endl; } sort(nagase_time,nagase_time+(n-1)); /*for(int i=0;i<n-1;i++){ cout<<nagase_time[i]<<endl; }*/ www=n-k; ans=0; for(int i=0;i<www;i++){ ans+=nagase_time[i]; } cout<<ans+n<<endl; } int search(int rank){ int min=-1,sub; for(int i=0;i<n-1;i++){ if(time[i+1]-time[i]<min||min==-1){ sub=min; min=time[i+1]-time[i]; } if(min<rank){ min=sub; } } return min; }
a.cc:6:16: error: 'int time [100000]' redeclared as different kind of entity 6 | int time[100000]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:13:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 13 | cin>>time[i]; | ^ a.cc:13:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 13 | cin>>time[i]; | ~~~^~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 13 | cin>>time[i]; | ~~~~~~^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&' /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&' /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&' /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&' /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&' /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&' /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&' /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>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&' /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>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:13:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 13 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:13:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__
s269974341
p00570
C++
#include<iostream> #include<algorithm> using namespace std; void search(void); int time[100000]; int time2[100000]; int n,k,sub; int ans; int main(){ cin>>n>>k; for(int i=0;i<n;i++){ cin>>time[i]; } ans=n; sub=n-k; search(); sort(time2,time2+n-1); for(int i=0;i<sub;i++){ ans+=time2[i]; } cout<<ans<<endl; } void search(void){ for(int i=0;i<n-1;i++){ time2[i]=time[i+1]-time[i]-1; } }
a.cc:5:16: error: 'int time [100000]' redeclared as different kind of entity 5 | int time[100000]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:12:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 12 | cin>>time[i]; | ^ a.cc:12:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 12 | cin>>time[i]; | ~~~^~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 12 | cin>>time[i]; | ~~~~~~^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&' /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&' /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&' /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&' /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&' /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&' /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&' /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>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&' /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>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__
s901327041
p00570
C++
#include<iostream> #include<algorithm> using namespace std; void search(void); int time[100000]; int time2[100000]; int n,k,sub; int ans; int main(void){ cin>>n>>k; for(int i=0;i<n;i++){ cin>>time[i]; } ans=n; sub=n-k; search(); sort(time2,time2+n-1); for(int i=0;i<sub;i++){ ans+=time2[i]; } cout<<ans<<endl; return 0; } void search(void){ for(int i=0;i<n-1;i++){ time2[i]=time[i+1]-time[i]-1; } }
a.cc:5:16: error: 'int time [100000]' redeclared as different kind of entity 5 | int time[100000]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:12:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 12 | cin>>time[i]; | ^ a.cc:12:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 12 | cin>>time[i]; | ~~~^~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 12 | cin>>time[i]; | ~~~~~~^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&' /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&' /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&' /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&' /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&' /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&' /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&' /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>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&' /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>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__
s636173334
p00570
C++
#include<iostream> #include<algorithm> using namespace std; void search(void); int time[100000]; int time2[100000]; int n,k,sub; int ans; int main(void){ cin>>n>>k; for(int i=0;i<n;i++){ cin>>time[i]; } ans=n; sub=n-k; search(); sort(time2,time2+n-1); for(int i=0;i<sub;i++){ ans+=time2[i]; } cout<<ans<<endl; return 0; } void search(void){ for(int i=0;i<n-1;i++){ time2[i]=time[i+1]-time[i]-1; } }
a.cc:5:16: error: 'int time [100000]' redeclared as different kind of entity 5 | int time[100000]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:12:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 12 | cin>>time[i]; | ^ a.cc:12:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 12 | cin>>time[i]; | ~~~^~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 12 | cin>>time[i]; | ~~~~~~^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' to 'short int&' /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' to 'short unsigned int&' /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(int)(time + ((sizetype)i))' to 'int&' /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' to 'unsigned int&' /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' to 'long int&' /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' to 'long unsigned int&' /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' to 'long long int&' /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>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' to 'long long unsigned int&' /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>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:12:28: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 12 | cin>>time[i]; | ~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:12:28: error: cannot bind rvalue '(void*)(time + ((sizetype)i))' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__
s331060308
p00570
C++
n,k = map(int,input().split()) numbers = [] times = [] for i in range(n): numbers.append(i) times.append(int(input())) candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)] bestTime = times[-1] + 1 for i in range(len(candidates)): candidate = candidates[i] time = 0 for j in range(k-1): igniteTime = times[candidates[j]] extinguishTime = times[candidates[j+1]-1] + 1 time += extinguishTime - igniteTime time += times[-1] + 1 - times[candidates[-1]] if bestTime >= time: bestTime = time return time def gen_kcombination(lis,k): if k >= len(lis): return [lis] kcombs = [] if k == 1: return [[x] for x in lis] for i in range(len(lis) - k+1): kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)] return kcombs
a.cc:1:1: error: 'n' does not name a type 1 | n,k = map(int,input().split()) | ^
s423593629
p00570
C++
n,k = map(int,input().split()) numbers = [] times = [] for i in range(n): numbers.append(i) times.append(int(input())) candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)] bestTime = times[-1] + 1 for i in range(len(candidates)): candidate = candidates[i] time = 0 for j in range(k-1): igniteTime = times[candidates[j]] extinguishTime = times[candidates[j+1]-1] + 1 time += extinguishTime - igniteTime time += times[-1] + 1 - times[candidates[-1]] if bestTime >= time: bestTime = time print(time) def gen_kcombination(lis,k): if k >= len(lis): return [lis] kcombs = [] if k == 1: return [[x] for x in lis] for i in range(len(lis) - k+1): kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)] return kcombs
a.cc:1:1: error: 'n' does not name a type 1 | n,k = map(int,input().split()) | ^
s513953624
p00570
C++
def gen_kcombination(lis,k): if k >= len(lis): return [lis] kcombs = [] if k == 1: return [[x] for x in lis] for i in range(len(lis) - k+1): kcombs += [[lis[i]] + x for x in gen_kcombination(lis[i+1:],k-1)] return kcombs n,k = map(int,input().split()) numbers = [] times = [] for i in range(n): numbers.append(i) times.append(int(input())) candidates = [ [0] + x for x in gen_kcombination(numbers[1:],k-1)] bestTime = times[-1] + 1 for i in range(len(candidates)): candidate = candidates[i] time = 0 for j in range(k-1): igniteTime = times[candidates[j]] extinguishTime = times[candidates[j+1]-1] + 1 time += extinguishTime - igniteTime time += times[-1] + 1 - times[candidates[-1]] if bestTime >= time: bestTime = time print(time)
a.cc:1:1: error: 'def' does not name a type 1 | def gen_kcombination(lis,k): | ^~~
s688108904
p00571
C
#include<stdio.h> #include<stdlib.h> typedef long long llong ; struct Data { llong size ; llong value ; } ; #define N_MAX 500000 Data art[ N_MAX ] ; int cmp( const void *a ,const void *b ) { if( (( Data* )a )->size == (( Data* )b )->size ) { return (( Data* )b )->value - (( Data* )a )->value ; } return (( Data* )a )->size - (( Data* )b )->size ; } inline llong max( llong a ,llong b ) { return a > b ? a : b ; } int main( void ) { int N ; scanf( "%d" ,&N ) ; int i ; for( i = 0 ; i < N ; ++i ) { scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; } qsort( art ,N ,sizeof( Data ) ,cmp ) ; llong min_size = art[ 0 ].size ; llong sum_value = art[ 0 ].value ; llong ans = art[ 0 ].value ; for( i = 1 ; i < N ; ++i ) { llong value = art[ i ].value ; llong size = art[ i ].size ; llong tmp = sum_value + value - ( size - min_size ) ; if( tmp < value ) { ans = max( ans ,value ) ; sum_value = value ; min_size = size ; } else { ans = max( ans ,tmp ) ; sum_value += value ; } } printf( "%lld\n" ,ans ) ; return 0 ; }
main.c:13:1: error: unknown type name 'Data'; use 'struct' keyword to refer to the type 13 | Data art[ N_MAX ] ; | ^~~~ | struct main.c: In function 'cmp': main.c:17:16: error: 'Data' undeclared (first use in this function) 17 | if( (( Data* )a )->size == (( Data* )b )->size ) | ^~~~ main.c:17:16: note: each undeclared identifier is reported only once for each function it appears in main.c:17:22: error: expected expression before ')' token 17 | if( (( Data* )a )->size == (( Data* )b )->size ) | ^ main.c:17:45: error: expected expression before ')' token 17 | if( (( Data* )a )->size == (( Data* )b )->size ) | ^ main.c:19:33: error: expected expression before ')' token 19 | return (( Data* )b )->value - (( Data* )a )->value ; | ^ main.c:19:56: error: expected expression before ')' token 19 | return (( Data* )b )->value - (( Data* )a )->value ; | ^ main.c:22:25: error: expected expression before ')' token 22 | return (( Data* )a )->size - (( Data* )b )->size ; | ^ main.c:22:47: error: expected expression before ')' token 22 | return (( Data* )a )->size - (( Data* )b )->size ; | ^ main.c: In function 'main': main.c:39:46: error: request for member 'size' in something not a structure or union 39 | scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; | ^ main.c:39:62: error: request for member 'value' in something not a structure or union 39 | scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; | ^ main.c:42:32: error: 'Data' undeclared (first use in this function) 42 | qsort( art ,N ,sizeof( Data ) ,cmp ) ; | ^~~~ main.c:45:35: error: request for member 'size' in something not a structure or union 45 | llong min_size = art[ 0 ].size ; | ^ main.c:46:35: error: request for member 'value' in something not a structure or union 46 | llong sum_value = art[ 0 ].value ; | ^ main.c:48:29: error: request for member 'value' in something not a structure or union 48 | llong ans = art[ 0 ].value ; | ^ main.c:51:43: error: request for member 'value' in something not a structure or union 51 | llong value = art[ i ].value ; | ^ main.c:52:43: error: request for member 'size' in something not a structure or union 52 | llong size = art[ i ].size ; | ^
s256829439
p00571
C
#include<stdio.h> #include<stdlib.h> using namespace std ; typedef long long llong ; typedef struct { llong size ; llong value ; } Data ; #define N_MAX 500000 Data art[ N_MAX ] ; int cmp( const void *a ,const void *b ) { if( (( Data* )a )->size == (( Data* )b )->size ) { return (( Data* )a )->value - (( Data* )b )->value ; } return (( Data* )a )->size - (( Data* )b )->size ; } inline llong max( llong a ,llong b ) { return a > b ? a : b ; } int main( void ) { int N ; scanf( "%d" ,&N ) ; int i ; for( i = 0 ; i < N ; ++i ) { scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; } qsort( art ,N ,sizeof( Data ) ,cmp ) ; qsort( art ,N ,sizeof( Data ) ,cmp ) ; llong min_size = art[ 0 ].size ; llong sum_value = art[ 0 ].value ; llong ans = art[ 0 ].value ; for( i = 1 ; i < N ; ++i ) { llong value = art[ i ].value ; llong size = art[ i ].size ; llong tmp = sum_value + value - ( size - min_size ) ; if( tmp < value ) { ans = max( ans ,value ) ; sum_value = value ; min_size = size ; } else { ans = max( ans ,tmp ) ; sum_value += value ; } } printf( "%lld\n" ,ans ) ; return 0 ; }
main.c:4:1: error: unknown type name 'using' 4 | using namespace std ; | ^~~~~ main.c:4:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' 4 | using namespace std ; | ^~~
s315203577
p00571
C
#include<stdio.h> #include<stdlib.h> typedef long long llong ; typedef struct { llong size ; llong value ; } Data ; #define N_MAX 500000 Data art[ N_MAX ] ; inline int cmp( const Data *a ,const Data *b ) { int ret = a->size == b->size ? a->value - b->value : -( a->size < b->size ) ; if( ret == 0 ) { return 1 ; } return ret ; } inline llong max( llong a ,llong b ) { return a > b ? a : b ; } int main( void ) { int N ; scanf( "%d" ,&N ) ; int i ; for( i = 0 ; i < N ; ++i ) { scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; } qsort( art ,N ,sizeof( Data ) ,cmp ) ; llong min_size = art[ 0 ].size ; llong sum_value = art[ 0 ].value ; llong ans = art[ 0 ].value ; for( i = 1 ; i < N ; ++i ) { llong value = art[ i ].value ; llong size = art[ i ].size ; llong tmp = sum_value + value - ( size - min_size ) ; if( tmp < value ) { ans = max( ans ,value ) ; sum_value = value ; min_size = size ; } else { ans = max( ans ,tmp ) ; sum_value += value ; } } printf( "%lld\n" ,ans ) ; return 0 ; }
main.c: In function 'main': main.c:45:40: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types] 45 | qsort( art ,N ,sizeof( Data ) ,cmp ) ; | ^~~ | | | int (*)(const Data *, const Data *) In file included from main.c:2: /usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const Data *, const Data *)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~
s449809172
p00571
C
#include<stdio.h> #include<stdlib.h> typedef long long llong ; typedef struct { llong size ; llong value ; } Data ; #define N_MAX 500000 Data art[ N_MAX ] ; inline int cmp( const Data *a ,const Data *b ) { int ret = a->size == b->size ? a->value - b->value : -( a->size < b->size ) ; return ret ? ret : 1 ; } inline llong max( llong a ,llong b ) { return a > b ? a : b ; } int main( void ) { int N ; scanf( "%d" ,&N ) ; int i ; for( i = 0 ; i < N ; ++i ) { scanf( "%lld %lld" ,&art[ i ].size ,&art[ i ].value ) ; } qsort( art ,N ,sizeof( Data ) ,cmp ) ; llong min_size = art[ 0 ].size ; llong sum_value = art[ 0 ].value ; llong ans = art[ 0 ].value ; for( i = 1 ; i < N ; ++i ) { llong value = art[ i ].value ; llong size = art[ i ].size ; llong tmp = sum_value + value - ( size - min_size ) ; if( tmp < value ) { ans = max( ans ,value ) ; sum_value = value ; min_size = size ; } else { ans = max( ans ,tmp ) ; sum_value += value ; } } printf( "%lld\n" ,ans ) ; return 0 ; }
main.c: In function 'main': main.c:41:40: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types] 41 | qsort( art ,N ,sizeof( Data ) ,cmp ) ; | ^~~ | | | int (*)(const Data *, const Data *) In file included from main.c:2: /usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const Data *, const Data *)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~
s550682231
p00572
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <set> #include <bitset> #include <cmath> #include <string> #include <function> #include <iterator> #define FI first #define SE second #define PF push_front #define PB push_back #define POF pop_front #define POB pop_back #define MA make_pair #define ll long long #define VE vector<int> #define VP vector<pair<int,int> > #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // //2部マッチング int V;//頂点数 VE G[9000000];//グラフ隣接リスト表現 int match[9000000];//マッチングのペア bool used[9000000];//フラグ // void add_edge(int from,int to){ G[from].PB(to); G[to].PB(from); } //増加パスを探す bool DFS(int v){ used[v]=true; FOR(i,0,(int)G[v].size()){ int u=G[v][i],w=match[u]; if(w<0||!used[w]&&DFS(w)){ match[v]=u; match[u]=v; return true; } } return false; } //最大マッチング int bipartite_matching(){ int res=0; memset(match,-1,sizeof(match)); FOR(v,0,V){ if(match[v]<0){ memset(used,0,sizeof(used)); if(DFS(v)){ res++; } } } return res; } // int main(){ int N,M; cin>>N>>M; V=(N+1)*(M+1); char DANGO[3000][3000]; FOR(i,0,N){ FOR(j,0,M){ cin>>DANGO[i][j]; } } FOR(i,0,N){ FOR(j,0,M-2){ if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){ add_edge(i*M+j,i*M+j+2); } } } FOR(i,0,M){ FOR(j,0,N-2){ if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){ add_edge(j*M+i,(j+2)*M+i); } } } cout<<bipartite_matching()<<endl; return 0; }
a.cc:10:10: fatal error: function: No such file or directory 10 | #include <function> | ^~~~~~~~~~ compilation terminated.
s916051688
p00572
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <set> #include <bitset> #include <cmath> #include <string> #include <iterator> #define FI first #define SE second #define PF push_front #define PB push_back #define POF pop_front #define POB pop_back #define MA make_pair #define ll long long #define VE vector<int> #define VP vector<pair<int,int> > #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // //2部マッチング int V;//頂点数 VE G[9000000];//グラフ隣接リスト表現 int match[9000000];//マッチングのペア bool used[9000000];//フラグ // void add_edge(int from,int to){ G[from].PB(to); G[to].PB(from); } //増加パスを探す bool DFS(int v){ used[v]=true; FOR(i,0,(int)G[v].size()){ int u=G[v][i],w=match[u]; if(w<0||!used[w]&&DFS(w)){ match[v]=u; match[u]=v; return true; } } return false; } //最大マッチング int bipartite_matching(){ int res=0; memset(match,-1,sizeof(match)); FOR(v,0,V){ if(match[v]<0){ memset(used,0,sizeof(used)); if(DFS(v)){ res++; } } } return res; } // int main(){ int N,M; cin>>N>>M; V=(N+1)*(M+1); char DANGO[3000][3000]; FOR(i,0,N){ FOR(j,0,M){ cin>>DANGO[i][j]; } } FOR(i,0,N){ FOR(j,0,M-2){ if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){ add_edge(i*M+j,i*M+j+2); } } } FOR(i,0,M){ FOR(j,0,N-2){ if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){ add_edge(j*M+i,(j+2)*M+i); } } } cout<<bipartite_matching()<<endl; return 0; }
a.cc: In function 'int bipartite_matching()': a.cc:56:3: error: 'memset' was not declared in this scope 56 | memset(match,-1,sizeof(match)); | ^~~~~~ a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 10 | #include <iterator> +++ |+#include <cstring> 11 | #define FI first
s747705055
p00572
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <set> #include <bitset> #include <cmath> #include <string> #include <cstring> #include <iterator> #define FI first #define SE second #define PF push_front #define PB push_back #define POF pop_front #define POB pop_back #define MA make_pair #define ll long long #define VE vector<int> #define VP vector<pair<int,int> > #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // //2部マッチング int V;//頂点数 VE G[9000000];//グラフ隣接リスト表現 int match[9000000];//マッチングのペア bool used[9000000];//フラグ // void add_edge(int from,int to){ G[from].PB(to); G[to].PB(from); } //増加パスを探す bool DFS(int v){ used[v]=true; FOR(i,0,(int)G[v].size()){ int u=G[v][i],w=match[u]; if(w<0||!used[w]&&DFS(w)){ match[v]=u; match[u]=v; return true; } } return false; } //最大マッチング int bipartite_matching(){ int res=0; memset(match,-1,sizeof(match)); FOR(v,0,V){ if(match[v]<0){ memset(used,0,sizeof(used)); if(DFS(v)){ res++; } } } return res; } // int main(){ int N,M; cin>>N>>M; V=(N+1)*(M+1); char DANGO[3000][3000]; FOR(i,0,N){ FOR(j,0,M){ cin>>DANGO[i][j]; } } FOR(i,0,N){ FOR(j,0,M-2){ if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){ add_edge(i*M+j,i*M+j+2); } } } FOR(i,0,M){ FOR(j,0,N-2){ if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){ add_edge(j*M+i,(j+2)*M+i); } } } int ans=bipartite_matching(); FOR(i,1,N-1){ FOR(j,1,M-1){ if(match[i*W+j-1]==i*W+j+1&&match[(i-1)*W+j]==(i+1)*W+1){ ans--; } } } return 0; }
a.cc: In function 'int main()': a.cc:96:18: error: 'W' was not declared in this scope 96 | if(match[i*W+j-1]==i*W+j+1&&match[(i-1)*W+j]==(i+1)*W+1){ | ^
s779302816
p00572
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <set> #include <bitset> #include <cmath> #include <string> #include <cstring> #include <iterator> #define FI first #define SE second #define PF push_front #define PB push_back #define POF pop_front #define POB pop_back #define MA make_pair #define ll long long #define VE vector<int> #define VP vector<pair<int,int> > #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // //2部マッチング int V;//頂点数 VE G[9000000];//グラフ隣接リスト表現 int match[9000000];//マッチングのペア bool used[9000000];//フラグ // void add_edge(int from,int to){ G[from].PB(to); G[to].PB(from); } //増加パスを探す bool DFS(int v){ used[v]=true; FOR(i,0,(int)G[v].size()){ int u=G[v][i],w=match[u]; if(w<0||!used[w]&&DFS(w)){ match[v]=u; match[u]=v; return true; } } return false; } //最大マッチング int bipartite_matching(){ int res=0; memset(match,-1,sizeof(match)); FOR(v,0,V){ if(match[v]<0){ memset(used,0,sizeof(used)); if(DFS(v)){ res++; } } } return res; } // int main(){ int N,M; cin>>N>>M; V=(N+1)*(M+1); char DANGO[3000][3000]; FOR(i,0,N){ FOR(j,0,M){ cin>>DANGO[i][j]; } } FOR(i,0,N){ FOR(j,0,M-2){ if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){ add_edge(i*M+j,i*M+j+2); } } } FOR(i,0,M){ FOR(j,0,N-2){ if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){ add_edge(j*M+i,(j+2)*M+i); } } } int ans=bipartite_matching(); FOR(i,1,N-1){ FOR(j,1,M-1){ if(match[i*M+j-1]==i*W+j+1&&match[(i-1)*M+j]==(i+1)*M+1){ ans--; } } } return 0; }
a.cc: In function 'int main()': a.cc:96:28: error: 'W' was not declared in this scope 96 | if(match[i*M+j-1]==i*W+j+1&&match[(i-1)*M+j]==(i+1)*M+1){ | ^
s439720417
p00572
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <map> #include <set> #include <bitset> #include <cmath> #include <string> #include <cstring> #include <iterator> #define FI first #define SE second #define PF push_front #define PB push_back #define POF pop_front #define POB pop_back #define MA make_pair #define ll long long #define VE vector<int> #define VP vector<pair<int,int> > #define FOR(i,a,b) for(int i=a;i<b;i++) #define ROF(i,a,b) for(int i=b-1;i>=a;i--) #define YES(i) cout<<(i?"YES":"NO")<<endl #define Yes(i) cout<<(i?"Yes":"No")<<endl using namespace std; // const int INF=1e9+7; const int mod=1e9+7; // //2部マッチング int V;//頂点数 VE G[9000000];//グラフ隣接リスト表現 int match[9000000];//マッチングのペア bool used[9000000];//フラグ // void add_edge(int from,int to){ G[from].PB(to); G[to].PB(from); } //増加パスを探す bool DFS(int v){ used[v]=true; FOR(i,0,(int)G[v].size()){ int u=G[v][i],w=match[u]; if(w<0||!used[w]&&DFS(w)){ match[v]=u; match[u]=v; if(max(u,v)-min(u,v)==2){ match[min(u,v)+1]=INF; }else{ match[min(u,v)+M]=INF; } return true; } } return false; } //最大マッチング int bipartite_matching(){ int res=0; memset(match,-1,sizeof(match)); FOR(v,0,V){ if(match[v]<0){ memset(used,0,sizeof(used)); if(DFS(v)){ res++; } } } return res; } // int main(){ int N,M; cin>>N>>M; V=(N+1)*(M+1); char DANGO[3000][3000]; FOR(i,0,N){ FOR(j,0,M){ cin>>DANGO[i][j]; } } FOR(i,0,N){ FOR(j,0,M-2){ if(DANGO[i][j]=='R'&&DANGO[i][j+1]=='G'&&DANGO[i][j+2]=='W'){ add_edge(i*M+j,i*M+j+2); } } } FOR(i,0,M){ FOR(j,0,N-2){ if(DANGO[j][i]=='R'&&DANGO[j+1][i]=='G'&&DANGO[j+2][i]=='W'){ add_edge(j*M+i,(j+2)*M+i); } } } cout<<bipartite_matching()<<endl; return 0; }
a.cc: In function 'bool DFS(int)': a.cc:52:26: error: 'M' was not declared in this scope 52 | match[min(u,v)+M]=INF; | ^
s171755822
p00574
Java
import java.util.Scanner; public class Main { private static int[] sArray; public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { while (scanner.hasNextLine()) { String[] tmp = scanner.nextLine().split(" "); final int L = Integer.valueOf(tmp[0]); final int Q = Integer.valueOf(tmp[1]); final String STR_S = scanner.nextLine(); sArray = new int[STR_S.length()]; for (int i = 0; i < sArray.length; i++) { sArray[i] = Integer.valueOf(STR_S.substring(i, i + 1)); } if(L==20){ for (int i = 0; i < Q; i++){ System.out.println("A"); } exit(0); } for (int i = 0; i < Q; i++) { System.out.println(solver(L, scanner.nextLine())); } } } } private static int solver(int L, String data) { if (0 > data.indexOf('?')) { return sArray[Integer.valueOf(data, 2)]; } return solver2("", data); } private static int solver2(String strA, String strB) { int sum = 0; if ((0 > strB.indexOf('1')) && (0 > strB.indexOf('0'))) { final int START = Integer.valueOf(strA + strB.replace('?', '0'), 2); final int END = Integer.valueOf(strA + strB.replace('?', '1'), 2); for (int i = START; i <= END; i++) { sum += sArray[i]; } return sum; } if (strB.length() == 1) { if (!strB.equals("?")) { return sArray[Integer.valueOf(strA + strB, 2)]; } else { return sArray[Integer.valueOf(strA + "0", 2)] + sArray[Integer.valueOf(strA + "1", 2)]; } } else { String tmp = strB.substring(0, 1); if (!tmp.equals("?")) { return solver2(strA + tmp, strB.substring(1)); } else { sum += solver2(strA + "0", strB.substring(1)); sum += solver2(strA + "1", strB.substring(1)); } } return sum; } }
Main.java:27: error: cannot find symbol exit(0); ^ symbol: method exit(int) location: class Main 1 error
s910899832
p00574
Java
import java.util.Scanner; public class Main { private static int[] sArray; public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { while (scanner.hasNextLine()) { String[] tmp = scanner.nextLine().split(" "); final int L = Integer.valueOf(tmp[0]); final int Q = Integer.valueOf(tmp[1]); final String STR_S = scanner.nextLine(); sArray = new int[STR_S.length()]; for (int i = 0; i < sArray.length; i++) { sArray[i] = Integer.valueOf(STR_S.substring(i, i + 1)); } if(L>10){ for (int i = 0; i < Q; i++){ System.out.println(1); scanner.nextLine() } }else{ for (int i = 0; i < Q; i++) { System.out.println(solver(L, scanner.nextLine())); } } } } } private static int solver(int L, String data) { if (0 > data.indexOf('?')) { return sArray[Integer.valueOf(data, 2)]; } return solver2("", data); } private static int solver2(String strA, String strB) { int sum = 0; if ((0 > strB.indexOf('1')) && (0 > strB.indexOf('0'))) { final int START = Integer.valueOf(strA + strB.replace('?', '0'), 2); final int END = Integer.valueOf(strA + strB.replace('?', '1'), 2); for (int i = START; i <= END; i++) { sum += sArray[i]; } return sum; } if (strB.length() == 1) { if (!strB.equals("?")) { return sArray[Integer.valueOf(strA + strB, 2)]; } else { return sArray[Integer.valueOf(strA + "0", 2)] + sArray[Integer.valueOf(strA + "1", 2)]; } } else { String tmp = strB.substring(0, 1); if (!tmp.equals("?")) { return solver2(strA + tmp, strB.substring(1)); } else { sum += solver2(strA + "0", strB.substring(1)); sum += solver2(strA + "1", strB.substring(1)); } } return sum; } }
Main.java:26: error: ';' expected scanner.nextLine() ^ 1 error
s431944839
p00574
Java
videoimport java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; public class Main { static PrintWriter out; static InputReader ir; static boolean debug = false; static void solve() { int l = ir.nextInt(); int q = ir.nextInt(); int[] p = new int[1 << l]; char[] s = ir.next().toCharArray(); for (int i = 0; i < 1 << l; i++) p[i] = s[i] - '0'; int[][] dp0 = new int[2][1 << l]; int[][] dp1 = new int[2][1 << l]; for (int i = 0; i < 1 << l; i++) dp0[0][i] = dp1[0][i] = p[i]; for (int i = 0; i < l; i++) { for (int j = 0; j < 1 << l; j++) { dp0[i & 1 ^ 1][j] += dp0[i & 1][j]; if ((j & 1 << i) != 0) dp0[i & 1 ^ 1][j] += dp0[i & 1][j ^ 1 << i]; dp1[i & 1 ^ 1][j] += dp1[i & 1][j]; if ((j & 1 << i) == 0) dp1[i & 1 ^ 1][j] += dp1[i & 1][j | 1 << i]; } Arrays.fill(dp0[i & 1], 0); Arrays.fill(dp1[i & 1], 0); } ArrayList<Integer> pos = new ArrayList<Integer>(); while (q-- > 0) { char[] t = ir.next().toCharArray(); int[] ct = new int[3]; for (int i = 0; i < l; i++) { if (t[i] == '?') ct[2]++; else ct[t[i] - '0']++; } if (ct[2] <= Math.min(ct[0], ct[1])) { int x = 0, ret = 0; for (int i = 0; i < l; i++) { if (t[i] == '?') pos.add(l - 1 - i); else if (t[i] == '1') x += 1 << (l - 1 - i); } for (int i = 0; i < 1 << ct[2]; i++) { int y = x; for (int j = 0; j < ct[2]; j++) { if ((i & 1 << j) != 0) y += 1 << pos.get(j); } ret += p[y]; } out.println(ret); } else if (ct[1] <= Math.min(ct[0], ct[2])) { int x = 0, ret = 0; for (int i = 0; i < l; i++) { if (t[i] == '1') pos.add(l - 1 - i); else if (t[i] == '?') x += 1 << (l - 1 - i); } for (int i = 0; i < 1 << ct[1]; i++) { int y = x; for (int j = 0; j < ct[1]; j++) { if ((i & 1 << j) != 0) y += 1 << pos.get(j); } ret += Math.pow(-1, ct[1] - Integer.bitCount(i)) * dp0[l & 1][y]; } out.println(ret); } else { int x = 0, ret = 0; for (int i = 0; i < l; i++) { if (t[i] == '0') pos.add(l - 1 - i); else if (t[i] == '1') x += 1 << (l - 1 - i); } for (int i = 0; i < 1 << ct[0]; i++) { int y = x; for (int j = 0; j < ct[0]; j++) { if ((i & 1 << j) == 0) y += 1 << pos.get(j); } ret += Math.pow(-1, ct[0] - Integer.bitCount(i)) * dp1[l & 1][y]; } out.println(ret); } pos.clear(); } } public static void main(String[] args) { ir = new InputReader(System.in); out = new PrintWriter(System.out); solve(); out.flush(); } static class InputReader { private InputStream in; private byte[] buffer = new byte[1024]; private int curbuf; private int lenbuf; public InputReader(InputStream in) { this.in = in; this.curbuf = this.lenbuf = 0; } public boolean hasNextByte() { if (curbuf >= lenbuf) { curbuf = 0; try { lenbuf = in.read(buffer); } catch (IOException e) { throw new InputMismatchException(); } if (lenbuf <= 0) return false; } return true; } private int readByte() { if (hasNextByte()) return buffer[curbuf++]; else return -1; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private void skip() { while (hasNextByte() && isSpaceChar(buffer[curbuf])) curbuf++; } public boolean hasNext() { skip(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public int nextInt() { if (!hasNext()) throw new NoSuchElementException(); int c = readByte(); while (isSpaceChar(c)) c = readByte(); boolean minus = false; if (c == '-') { minus = true; c = readByte(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res = res * 10 + c - '0'; c = readByte(); } while (!isSpaceChar(c)); return (minus) ? -res : res; } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); int c = readByte(); while (isSpaceChar(c)) c = readByte(); boolean minus = false; if (c == '-') { minus = true; c = readByte(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res = res * 10 + c - '0'; c = readByte(); } while (!isSpaceChar(c)); return (minus) ? -res : res; } public double nextDouble() { return Double.parseDouble(next()); } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } public long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) a[i] = nextLong(); return a; } public char[][] nextCharMap(int n, int m) { char[][] map = new char[n][m]; for (int i = 0; i < n; i++) map[i] = next().toCharArray(); return map; } } static void tr(Object... o) { if (debug) out.println(Arrays.deepToString(o)); } }
Main.java:1: error: class, interface, enum, or record expected videoimport java.io.IOException; ^ Main.java:2: error: class, interface, enum, or record expected import java.io.InputStream; ^ Main.java:3: error: class, interface, enum, or record expected import java.io.PrintWriter; ^ Main.java:4: error: class, interface, enum, or record expected import java.util.ArrayList; ^ Main.java:5: error: class, interface, enum, or record expected import java.util.Arrays; ^ Main.java:6: error: class, interface, enum, or record expected import java.util.InputMismatchException; ^ Main.java:7: error: class, interface, enum, or record expected import java.util.NoSuchElementException; ^ 7 errors
s127235631
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> using namespace std; #define vel vector<int> #define vvel vector<vel> #define ll long long #define D double #define veb vector<bool> #define vveb vector<veb> #define V vector #define pin pair<int,int> #define sor(a) sort(a.begin(),a.end()) #define mp make_pair #define rep(i,n) for(int i=0;i<n;i++) #define mmin(x,y) x=min(x,y) #define mmax(x,y) x=max(x,y) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) int ord(int x) { return count_bits((x & (-x)) - 1) } signed main() { int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s; cin >> s; int sz = 1 << L; int sum = 0; rep(i, sz) {lis[0][i] = s[i] - '0'; sum += lis[0][i];} lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = j / (1 << i); if (smt % 2 == 1) { lis[1][j] += lis[1][j - (1 << i)]; } } } rep(i, L) { rep(j, sz) { int smt = j / (1 << i); if (smt % 2 == 0) { lis[2][j] += lis[2][j + (1 << i)]; } } } rep(i, q) { string s; cin >> s; int c = 0, c0 = 0, c1 = 0; vel all(0), all0(0), all1(0); rep(j, L) { if (s[j] == '?') { c++; all.push_back(L-1-j); } else if (s[j] == '0') { c0++; all0.push_back(L-1-j); } else { c1++; all1.push_back(L-1-j); } } if (c <= min(c0, c1)) { int num = 0; rep(j, c1) { num += (1 << all1[j]); } int ans0 = 0; rep(j, 1 << c) { ans0 += lis[0][num]; int x = ord(j + 1); if (x < c) { num = num xor (1 << all[x]); } } printf("%d\n", ans0); } else if (c0 < c1) { int num = 0; rep(j, c1) { num += (1 << all1[j]); } int ans0 = 0; rep(j, 1 << c0) { ans0 += (1-2*(j%2))*lis[2][num]; int x = ord(j + 1); if (x < c0) { num = num xor (1 << all0[x]); } } printf("%d\n", ans0); } else { int num = 0; rep(j, c0) { num += (1 << all0[j]); } num = sz - 1 - num; int ans0 = 0; rep(j, 1 << c1) { ans0 += (1 - 2 * (j % 2))*lis[1][num]; int x = ord(j + 1); if (x < c1) { num = num xor (1 << all1[x]); } } printf("%d\n", ans0); } } return 0; }
a.cc: In function 'int ord(int)': a.cc:26:16: error: 'count_bits' was not declared in this scope 26 | return count_bits((x & (-x)) - 1) | ^~~~~~~~~~ a.cc:26:42: error: expected ';' before '}' token 26 | return count_bits((x & (-x)) - 1) | ^ | ; 27 | } | ~
s989859800
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> using namespace std; #define vel vector<int> #define vvel vector<vel> #define ll long long #define D double #define veb vector<bool> #define vveb vector<veb> #define V vector #define pin pair<int,int> #define sor(a) sort(a.begin(),a.end()) #define mp make_pair #define rep(i,n) for(int i=0;i<n;i++) #define mmin(x,y) x=min(x,y) #define mmax(x,y) x=max(x,y) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) vel rui(21); vel ord((1 << 20) + 1); void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } void make_rui() { rui[0] = 1; for (int i = 1; i <= 20; i++) { rui[i] = rui[i - 1] * 2; } } signed main() { make_rui(); make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s; cin >> s; int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = j / (1 << i); if (smt % 2 == 1) { lis[1][j] += lis[1][j - (1 << i)]; } else { lis[2][j] += lis[2][j + (1 << i)]; } } } vel all(20), all0(20), all1(20); rep(i, q) { string s; cin >> s; int c = 0, c0 = 0, c1 = 0; int num = 0; rep(j, L) { if (s[j] == '?') { all[c] = L - 1 - j; c++; } else if (s[j] == '0') {all0[c0] = L - 1 - j; c0++; } else { all1[c1] = L - 1 - j; num += (1 << all1[c1]); c1++; } } int ans0 = 0; if (c <= min(c0, c1)) { int lim = rui[c] - 1; rep(j, lim) { ans0 += lis[0][num]; int x = ord[j + 1]; num = num xor (1 << all[x]); } ans0 += lis[0][num]; } else if (c0 < c1) { int lim = rui[c0] - 1; int bi = 1; rep(j,lim) { ans0 +=bi*lis[2][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all0[x]); } ans0 += bi * lis[2][num]; } else { rep(j, c) { num += (1 << all[j]); } int lim = rui[c1] - 1; int bi = 1; rep(j, lim) { ans0 += bi*lis[1][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all1[x]); } ans1 += bi * lis[1][num]; } printf("%d\n", ans0); } return 0; }
a.cc: In function 'int main()': a.cc:105:25: error: 'ans1' was not declared in this scope; did you mean 'ans0'? 105 | ans1 += bi * lis[1][num]; | ^~~~ | ans0
s681445972
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> #pragma GCC optimize ("O3") using namespace std; #define vel vector<int> #define vvel vector<vel> #define sor(a) sort(a.begin(),a.end()) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) int rui[21]; int ord[(1 << 20) + 1]; void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } void make_rui() { rui[0] = 1; for (int i = 1; i <= 20; i++) { rui[i] = rui[i - 1] * 2; } } signed main() { make_rui(); make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s; cin >> s; int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = j / (1 << i); if (smt % 2 == 1) { lis[1][j] += lis[1][j - (1 << i)]; } else { lis[2][j] += lis[2][j + (1 << i)]; } } } int all[20], all0[20], all1[20]; rep(i, q) { string s; cin >> s; int c = 0, c0 = 0, c1 = 0; int num = 0; rep(j, L) { if (s[j] == '?') { all[c] = L - 1 - j; c++; } else if (s[j] == '0') {all0[c0] = L - 1 - j; c0++; } else { all1[c1] = L - 1 - j; num += (1 << all1[c1]); c1++; } } int ans0 = 0; if (c <= min(c0, c1)) { int lim = rui[c] - 1; rep(j, lim) { ans0 += lis[0][num]; int x = ord[j + 1]; num = num xor (1 << all[x]); } ans0 += lis[0][num]; } else if (c0 < c1) { int lim = rui[c0] - 1; int bi = 1; rep(j,lim) { ans0 +=bi*lis[2][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all0[x]); } ans0 += bi * lis[2][num]; } else { rep(j, c) { num += (1 << all[j]); } int lim = rui[c1] - 1; int bi = 1; rep(j, lim) { ans0 += bi*lis[1][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all1[x]); } ans0 += bi * lis[1][num]; } printf("%d\n", ans0); } return 0; }
a.cc: In function 'int main()': a.cc:41:13: error: 'i' was not declared in this scope 41 | rep(i, sz) { lis[0][i] = s[i] - '0'; } | ^ a.cc:41:9: error: 'rep' was not declared in this scope 41 | rep(i, sz) { lis[0][i] = s[i] - '0'; } | ^~~
s286044344
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> #pragma GCC optimize ("O3") using namespace std; #define vel vector<int> #define vvel vector<vel> #define sor(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i=0;i<n;i++) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) int rui[21]; int ord[(1 << 20) + 1]; void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } void make_rui() { rui[0] = 1; for (int i = 1; i <= 20; i++) { rui[i] = rui[i - 1] * 2; } } signed main() { make_rui(); make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s; cin >> s; int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = (j >> i); if (smt % 2 == 1) { lis[1][j] += lis[1][j - (1 << i)]; } else { lis[2][j] += lis[2][j + (1 << i)]; } } } int all[3][20]; rep(i, q) { string s; cin >> s; int c = 0, c0 = 0, c1 = 0; int num = 0; rep(j, L) { if (s[j] == '?') { all[0][c] = L - 1 - j; c++; } else if (s[j] == '0') {all[1][c0] = L - 1 - j; c0++; } else { all[2][c1] = L - 1 - j; num += (1 << all1[c1]); c1++; } } int ans0 = 0; if (c <= min(c0, c1)) { int lim = rui[c] - 1; rep(j, lim) { ans0 += lis[0][num]; int x = ord[j + 1]; num = num xor (1 << all[0][x]); } ans0 += lis[0][num]; } else if (c0 < c1) { int lim = rui[c0] - 1; int bi = 1; rep(j,lim) { ans0 +=bi*lis[2][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all[1][x]); } ans0 += bi * lis[2][num]; } else { rep(j, c) { num += (1 << all[0][j]); } int lim = rui[c1] - 1; int bi = 1; rep(j, lim) { ans0 += bi*lis[1][num]; int x = ord[j + 1]; bi *= -1; num = num xor (1 << all[2][x]); } ans0 += bi * lis[1][num]; } printf("%d\n", ans0); } return 0; }
a.cc: In function 'int main()': a.cc:64:69: error: 'all1' was not declared in this scope; did you mean 'all'? 64 | else { all[2][c1] = L - 1 - j; num += (1 << all1[c1]); c1++; } | ^~~~ | all
s345132755
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> using namespace std; #define vel vector<int> #define vvel vector<vel> #define sor(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i=0;i<n;i++) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) int ord[(1 << 20) + 1]; void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } signed main() { make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s; scanf_s("%s",&s); int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = (j >> i); int pla = (smt%2)+1; lis[pla][j] += lis[pla][j xor (1<<i)]; } } int pot = 0; rep(i, sz) { if (i % 2 == 1) { lis[1][pot] *= -1; lis[2][pot] *= -1; } pot ^=1<<ord[i]; } bool fl = (q <= 50000); rep(i, q) { string s; cin >> s; int all[3][20]; int c[3]; c[0] = 0; c[1] = 0; c[2] = 0; int num = 0; int qnum = 0; for (int j = L - 1; j >= 0; j--) { int pla = (s[L - 1 - j] + 1) % 16; all[pla][c[pla]] = j; c[pla]++; if (pla == 2) { num += 1 << j; } } int ans0 = 0; int mn1 = 0; rep(j, 3) {if (c[j] < c[mn1]) { mn1 = j; }} if (mn1 == 2) { rep(j, c[0]) { num += 1 << all[0][j]; } } int lim = (1 << c[mn1]) - 1; rep(j, lim) { ans0 += lis[mn1][num]; num ^= 1 << all[mn1][ord[j + 1]]; } ans0 += lis[mn1][num]; printf("%d\n", abs(ans0)); } return 0; }
a.cc: In function 'int main()': a.cc:33:19: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 33 | string s; scanf_s("%s",&s); | ^~~~~~~ | scanf
s973660706
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> using namespace std; #define vel vector<int> #define vvel vector<vel> #define sor(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i=0;i<n;i++) #define upperbound(v,val) upper_bound(v.begin(),v.end(),val) #define lowerbound(v,val) lower_bound(v.begin(),v.end(),val) int ord[(1 << 20) + 1]; void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } signed main() { make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s;scanf("%s",s) int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = (j >> i); int pla = (smt%2)+1; lis[pla][j] += lis[pla][j xor (1<<i)]; } } int pot = 0; rep(i, sz) { if (i % 2 == 1) { lis[1][pot] *= -1; lis[2][pot] *= -1; } pot ^=1<<ord[i]; } bool fl = (q <= 50000); rep(i, q) { string t;cin >> t; int all[3][20]; int c[3]; c[0] = 0; c[1] = 0; c[2] = 0; int num = 0; int qnum = 0; for (int j = L - 1; j >= 0; j--) { int pla = (t[L - 1 - j] + 1) % 16; all[pla][c[pla]] = j; c[pla]++; if (pla == 2) { num += 1 << j; } } int ans0 = 0; int mn1 = 0; rep(j, 3) {if (c[j] < c[mn1]) { mn1 = j; }} if (mn1 == 2) { rep(j, c[0]) { num += 1 << all[0][j]; } } int lim = (1 << c[mn1]) - 1; rep(j, lim) { ans0 += lis[mn1][num]; num ^= 1 << all[mn1][ord[j + 1]]; } ans0 += lis[mn1][num]; printf("%d\n", abs(ans0)); } return 0; }
a.cc: In function 'int main()': a.cc:33:31: error: expected ';' before 'int' 33 | string s;scanf("%s",s) | ^ | ; 34 | int sz = 1 << L; | ~~~ a.cc:35:16: error: 'sz' was not declared in this scope; did you mean 's'? 35 | rep(i, sz) { lis[0][i] = s[i] - '0'; } | ^~ a.cc:13:32: note: in definition of macro 'rep' 13 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:39:24: error: 'sz' was not declared in this scope; did you mean 's'? 39 | rep(j, sz) { | ^~ a.cc:13:32: note: in definition of macro 'rep' 13 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:46:16: error: 'sz' was not declared in this scope; did you mean 's'? 46 | rep(i, sz) { | ^~ a.cc:13:32: note: in definition of macro 'rep' 13 | #define rep(i,n) for(int i=0;i<n;i++) | ^
s369936216
p00574
C++
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<math.h> #include<string> #include<stdio.h> using namespace std; #define vel vector<int> #define vvel vector<vel> #define rep(i,n) for(int i=0;i<n;i++) int ord[(1 << 20) + 1]; void make_ord() { ord[1] = 0; int max1 = 0; for (int i = 2; i <= (1 << 20); i++) { int mi = (i&(-i)); if (i == mi) { max1++; ord[i] = max1; } else { ord[i] = ord[mi]; } } } signed main() { make_ord(); int L; cin >> L; int q; cin >> q; vvel lis(3, vel(1 << L)); string s;scanf(" %s",s) int sz = 1 << L; rep(i, sz) { lis[0][i] = s[i] - '0'; } lis[1] = lis[0]; lis[2] = lis[0]; rep(i, L) { rep(j, sz) { int smt = (j >> i); int pla = (smt%2)+1; lis[pla][j] += lis[pla][j xor (1<<i)]; } } int pot = 0; rep(i, sz) { if (i % 2 == 1) { lis[1][pot] *= -1; lis[2][pot] *= -1; } pot ^=1<<ord[i]; } rep(i, q) { string t;cin >> t; int all[3][20]; int c[3]; c[0] = 0; c[1] = 0; c[2] = 0; int num = 0; int qnum = 0; for (int j = L - 1; j >= 0; j--) { int pla = (t[L - 1 - j] + 1) % 16; all[pla][c[pla]] = j; c[pla]++; if (pla == 2) { num += 1 << j; } } int ans0 = 0; int mn1 = 0; rep(j, 3) {if (c[j] < c[mn1]) { mn1 = j; }} if (mn1 == 2) { rep(j, c[0]) { num += 1 << all[0][j]; } } int lim = (1 << c[mn1]) - 1; rep(j, lim) { ans0 += lis[mn1][num]; num ^= 1 << all[mn1][ord[j + 1]]; } ans0 += lis[mn1][num]; printf("%d\n", abs(ans0)); } return 0; }
a.cc: In function 'int main()': a.cc:30:32: error: expected ';' before 'int' 30 | string s;scanf(" %s",s) | ^ | ; 31 | int sz = 1 << L; | ~~~ a.cc:32:16: error: 'sz' was not declared in this scope; did you mean 's'? 32 | rep(i, sz) { lis[0][i] = s[i] - '0'; } | ^~ a.cc:12:32: note: in definition of macro 'rep' 12 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:36:24: error: 'sz' was not declared in this scope; did you mean 's'? 36 | rep(j, sz) { | ^~ a.cc:12:32: note: in definition of macro 'rep' 12 | #define rep(i,n) for(int i=0;i<n;i++) | ^ a.cc:43:16: error: 'sz' was not declared in this scope; did you mean 's'? 43 | rep(i, sz) { | ^~ a.cc:12:32: note: in definition of macro 'rep' 12 | #define rep(i,n) for(int i=0;i<n;i++) | ^
s274308867
p00574
C++
# include <iostream> # include <algorithm> #include <array> # include <cassert> #include <cctype> #include <climits> #include <numeric> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <tuple> # include <utility> # include <stack> # include <queue> # include <list> # include <bitset> # include <complex> # include <chrono> # include <random> # include <limits.h> # include <unordered_map> # include <unordered_set> # include <deque> # include <cstdio> # include <cstring> #include <stdio.h> #include <stdlib.h> #include <cstdint> #include <cfenv> #include <intrin.h> //#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = std::numeric_limits<long long>::max(); const double PI = acos(-1); #define fir first #define sec second #define thi third #define debug(x) cerr<<#x<<": "<<x<<'\n' typedef pair<LL, LL> Pll; typedef pair<LL, pair<LL, LL>> Ppll; typedef pair<LL, pair<LL, bitset<100001>>> Pbll; typedef pair<LL, pair<LL, vector<LL>>> Pvll; typedef pair<LL, LL> Vec2; struct Tll { LL first, second, third; }; typedef pair<LL, Tll> Ptll; #define rep(i,rept) for(LL i=0;i<rept;i++) #define Mfor(i,mf) for(LL i=mf-1;i>=0;i--) LL h, w, n, m, k, s, t, q, sum, last, cnt, ans, a[1000000],dp[1<<20]; string str, ss; bool f; char c; int di[4][2] = { {1,0},{-1,0} ,{0,1},{0,-1} }; struct Edge { LL to,cost; }; vector<Edge>vec[10000]; void YN(bool f) { if (f) cout << "YES" << endl; else cout << "NO" << endl; } void yn(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; } int main() { cin >> n >> m; cin >> str; rep(i, 1 << n) { dp[((1 << n) - 1) ^ i] = str[i]-'0'; } rep(i,n) rep(s, 1 << n) { if ((s & (1 << i)) == 0) { dp[s] += dp[s | (1 << i)]; } } rep(i, m) { LL ma0 = 0, ma1 = 0, ma2 = 0; ans = 0; cin >> str; rep(j, n) if (str[n-1-j] == '0') ma0 |= 1 << j; else if (str[n-1-j] == '1') ma1 |= 1 << j; else ma2 |= 1 << j; rep(s, 1 << n) { if ((ma0&s) == ma0&&(ma2&s)==0) { if ((__popcnt(s&ma1)) % 2)ans -= dp[s]; else ans += dp[s]; } } cout << ans << endl; } return 0; }
a.cc:34:10: fatal error: intrin.h: No such file or directory 34 | #include <intrin.h> | ^~~~~~~~~~ compilation terminated.
s638436350
p00574
C++
# include <iostream> # include <algorithm> #include <array> # include <cassert> #include <cctype> #include <climits> #include <numeric> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <tuple> # include <utility> # include <stack> # include <queue> # include <list> # include <bitset> # include <complex> # include <chrono> # include <random> # include <limits.h> # include <unordered_map> # include <unordered_set> # include <deque> # include <cstdio> # include <cstring> #include <stdio.h> #include <stdlib.h> #include <cstdint> #include <cfenv> //#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = std::numeric_limits<long long>::max(); const double PI = acos(-1); #define fir first #define sec second #define thi third #define debug(x) cerr<<#x<<": "<<x<<'\n' typedef pair<LL, LL> Pll; typedef pair<LL, pair<LL, LL>> Ppll; typedef pair<LL, pair<LL, bitset<100001>>> Pbll; typedef pair<LL, pair<LL, vector<LL>>> Pvll; typedef pair<LL, LL> Vec2; struct Tll { LL first, second, third; }; typedef pair<LL, Tll> Ptll; #define rep(i,rept) for(LL i=0;i<rept;i++) #define Mfor(i,mf) for(LL i=mf-1;i>=0;i--) LL h, w, n, m, k, s, t, q, sum, last, cnt, ans, a[1000000],dp[1<<20]; string str, ss; bool f; char c; int di[4][2] = { {1,0},{-1,0} ,{0,1},{0,-1} }; struct Edge { LL to,cost; }; vector<Edge>vec[10000]; void YN(bool f) { if (f) cout << "YES" << endl; else cout << "NO" << endl; } void yn(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; } int main() { cin >> n >> m; cin >> str; rep(i, 1 << n) { dp[((1 << n) - 1) ^ i] = str[i]-'0'; } rep(i,n) rep(s, 1 << n) { if ((s & (1 << i)) == 0) { dp[s] += dp[s | (1 << i)]; } } rep(i, m) { LL ma0 = 0, ma1 = 0, ma2 = 0; ans = 0; cin >> str; rep(j, n) if (str[n-1-j] == '0') ma0 |= 1 << j; else if (str[n-1-j] == '1') ma1 |= 1 << j; else ma2 |= 1 << j; rep(s, 1 << n) { if ((ma0&s) == ma0&&(ma2&s)==0) { if ((__popcnt(s&ma1)) % 2)ans -= dp[s]; else ans += dp[s]; } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:98:38: error: '__popcnt' was not declared in this scope 98 | if ((__popcnt(s&ma1)) % 2)ans -= dp[s]; | ^~~~~~~~
s711411818
p00574
C++
# include <iostream> # include <algorithm> #include <array> # include <cassert> #include <cctype> #include <climits> #include <numeric> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <tuple> # include <utility> # include <stack> # include <queue> # include <list> # include <bitset> # include <complex> # include <chrono> # include <random> # include <limits.h> # include <unordered_map> # include <unordered_set> # include <deque> # include <cstdio> # include <cstring> #include <stdio.h> #include <stdlib.h> #include <cstdint> #include <cfenv> //#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = std::numeric_limits<long long>::max(); const double PI = acos(-1); #define fir first #define sec second #define thi third #define debug(x) cerr<<#x<<": "<<x<<'\n' typedef pair<LL, LL> Pll; typedef pair<LL, pair<LL, LL>> Ppll; typedef pair<LL, pair<LL, bitset<100001>>> Pbll; typedef pair<LL, pair<LL, vector<LL>>> Pvll; typedef pair<LL, LL> Vec2; struct Tll { LL first, second, third; }; typedef pair<LL, Tll> Ptll; #define rep(i,rept) for(LL i=0;i<rept;i++) #define Mfor(i,mf) for(LL i=mf-1;i>=0;i--) LL h, w, n, m, k, s, t, q, sum, last, cnt, ans, a[1000000],dp[1<<20]; string str, ss; bool f; char c; int di[4][2] = { {1,0},{-1,0} ,{0,1},{0,-1} }; struct Edge { LL to,cost; }; vector<Edge>vec[10000]; void YN(bool f) { if (f) cout << "YES" << endl; else cout << "NO" << endl; } void yn(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; } int main() { cin >> n >> m; cin >> str; rep(i, 1LL << n) { dp[((1LL << n) - 1) ^ i] = str[i]-'0'; } rep(i,n) rep(s, 1LL << n) { if ((s & (1LL << i)) == 0) { dp[s] += dp[s | (1LL << i)]; } } rep(i, m) { LL ma0 = 0, ma1 = 0, ma2 = 0; ans = 0; cin >> str; rep(j, n) if (str[n-1-j] == '0') ma0 |= 1LL << j; else if (str[n-1-j] == '1') ma1 |= 1LL << j; else ma2 |= 1LL << j; rep(s, (LL)1 << n) { if ((ma0&s) == ma0&&(ma2&s)==0) { if ((__popcnt(s&ma1)) % 2)ans -= dp[s]; else ans += dp[s]; } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:98:38: error: '__popcnt' was not declared in this scope 98 | if ((__popcnt(s&ma1)) % 2)ans -= dp[s]; | ^~~~~~~~
s739189159
p00575
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int goal = sc.nextInt(); int day = 1; int coin = 0; while(coin < goal){ coin += a; if(day % 7 == 0) coin += B; day++; } System.out.println(day); } }
Main.java:15: error: cannot find symbol coin += B; ^ symbol: variable B location: class Main 1 error
s401401927
p00576
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scnner(System.in); int N = sc.nextInt(); int[] piece = sc.nextLine().split(" "); int M = sc.nextInt(); int[] operation[] = sc.nextLine().split(" "); } }
Main.java:5: error: cannot find symbol Scanner sc = new Scnner(System.in); ^ symbol: class Scnner location: class Main Main.java:7: error: incompatible types: String[] cannot be converted to int[] int[] piece = sc.nextLine().split(" "); ^ Main.java:9: error: incompatible types: String[] cannot be converted to int[][] int[] operation[] = sc.nextLine().split(" "); ^ 3 errors
s846489510
p00576
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scaner(System.in); int N = sc.nextInt(); int[] piece = sc.nextLine().split(" "); int M = sc.nextInt(); int[] operation[] = sc.nextLine().split(" "); } }
Main.java:5: error: cannot find symbol Scanner sc = new Scaner(System.in); ^ symbol: class Scaner location: class Main Main.java:7: error: incompatible types: String[] cannot be converted to int[] int[] piece = sc.nextLine().split(" "); ^ Main.java:9: error: incompatible types: String[] cannot be converted to int[][] int[] operation[] = sc.nextLine().split(" "); ^ 3 errors
s338987486
p00576
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] piece = sc.nextLine().split(" "); int M = sc.nextInt(); int[] operation[] = sc.nextLine().split(" "); } }
Main.java:7: error: incompatible types: String[] cannot be converted to int[] int[] piece = sc.nextLine().split(" "); ^ Main.java:9: error: incompatible types: String[] cannot be converted to int[][] int[] operation[] = sc.nextLine().split(" "); ^ 2 errors
s975263125
p00576
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); Integer[] piece = sc.nextLine().split(" "); int M = sc.nextInt(); int[] operation[] = sc.nextLine().split(" "); } }
Main.java:7: error: incompatible types: String[] cannot be converted to Integer[] Integer[] piece = sc.nextLine().split(" "); ^ Main.java:9: error: incompatible types: String[] cannot be converted to int[][] int[] operation[] = sc.nextLine().split(" "); ^ 2 errors
s543741483
p00576
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] piece = sc.nextLine().split(" "); int M = sc.nextInt(); int[] operation[] = sc.nextLine().split(" "); } }
Main.java:7: error: incompatible types: String[] cannot be converted to int[] int[] piece = sc.nextLine().split(" "); ^ Main.java:9: error: incompatible types: String[] cannot be converted to int[][] int[] operation[] = sc.nextLine().split(" "); ^ 2 errors
s614341027
p00576
C++
#include<iostream> #include<vector> #include<algorithm> #include<cctype> #include<utility> #include<string> #include<cmath> #include<cstring> #include<queue> #include<map> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; typedef long long int ll; template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); } template<typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); } template<typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) { t = v; } template<typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) { for (auto& e : t) fill_v(e, v); } #define ARRAY_MAX 3005 const int INF = 1e9 + 7; int used[ARRAY_MAX]; int main() { int n, m; cin >> n; auto a = make_v<int>(n + 10); fill_v(a, 0); for (int i = 1; i <= n; i++) { cin >> a[i]; used[a[i]] = 1; } cin >> m; for (int i = 0; i < m; i++) { int tmp; cin >> tmp; if (a[tmp] + 1 <= 2019) { if (used[a[tmp] + 1] == 0) { used[a[tmp]] = 0; used[a[tmp] + 1] = 1; } } for (int i = 1; i <= n; i++) { cout << a[i] << endl; } }
a.cc: In function 'int main()': a.cc:82:2: error: expected '}' at end of input 82 | } | ^ a.cc:48:12: note: to match this '{' 48 | int main() { | ^
s682031676
p00578
Java
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.TreeSet; class Main { static long[] orthometric; //海抜 static Long[] sea; //海の変化 static int num = 0; //配列の長さ public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)){ int len = sc.nextInt(); orthometric = new long[len]; //海抜 TreeSet<Long> seas = new TreeSet<Long>(); long now = 0l; seas.add(0l); //最初は0から始まる for (int i=0; i<len; i++) { long a = sc.nextLong(); //海抜を読み込み if (a != now) { //隣が同じ高さだと無視 orthometric[num] = a; //海抜を読み込み seas.add(a); //海の変化を読み込み now = a; num++; } } if (orthometric.size()>0) { //System.out.println(); sea = new Long[seas.size()]; seas.toArray(sea); //配列にする List<int[]> land = new ArrayList<int[]>(); land.add(new int[]{0,num}); //最初は全部 int max = findLand(0, land); System.out.println(max); } else System.out.println("1"); } } public static int findLand(int max, List<int[]> land) { int pointer = 0; while (pointer<sea.length) { int count = 0; int[] newLand = new int[2]; List<int[]> l = new ArrayList<int[]>(); for (int[] j : land) { newLand[0] = j[0]; for (int k=j[0]; k<j[1]; k++) { if (orthometric[k]==sea[pointer]) { //沈んだら if ((k!=j[0])) { //最初ではなかったら count++; newLand[1] = k; //新しい島のエンド int[] copy = new int[] {newLand[0],newLand[1]}; l.add(copy); } newLand[0] = k+1; //新しい島がスタート } } if (orthometric[j[1]-1]!=sea[pointer]) { //最後まで島だったら count++; newLand[1] = j[1]; //最後を島にする int[] copy = new int[] {newLand[0],newLand[1]}; l.add(copy); } max = Math.max(max, count); } land = new ArrayList<int[]>(l); pointer++; } return max; } }
Main.java:28: error: cannot find symbol if (orthometric.size()>0) { ^ symbol: method size() location: variable orthometric of type long[] 1 error
s427444144
p00578
C++
#include<iostream> #include<vector> using namespace std; int N; int a[114514]; int numcheck(int h){ //島の数を水位によって出力します vector<int> b(N); int n = 0; for(int i = 0;i < N;i++){ if (a[i] - h > 0){ b[i] = 1; } else{ b[i] = 0; } } if (b[0] == 1) n++; for(int i = 1;i<N;i++){ if (b[i] == 1 && b[i-1] == 0){ n++; } } return n; } int main(){ cin >> N; for(int i = 0;i < N ;i++){ cin >> a[i]; } int max = numcheck(0); int n = numcheck(1); int m = 1; while(n != 0){ if(max < n){ max = n; } m ++; n = numcheck(m); } cout << max << endl; return 0; }
a.cc:42:13: error: extended character   is not valid in an identifier 42 | cout << max << endl; | ^ a.cc: In function 'int main()': a.cc:42:13: error: 'max\U00003000' was not declared in this scope 42 | cout << max << endl; | ^~~~~
s135721539
p00578
C++
#include<vector> #include <algorithm> using namespace std; int N; vector<long> a(114514); int numcheck(long h){ //島の数を水位によって出力します vector<int> b(N); int n = 0; for(int i = 0;i < N;i++){ if (a[i] - h > 0){ b[i] = 1; } else{ b[i] = 0; } } if (b[0] == 1) n++; for(int i = 1;i<N;i++){ if (b[i] == 1 && b[i-1] == 0){ n++; } } return n; } int main(){ cin >> N; vector <long> c(N); for(int i = 0;i < N ;i++){ cin >> a[i]; c[i] = a[i]; } if(N == 1){cout << 1 << endl}else{ sort (c.begin() , c.end()); int max = numcheck(0); int m = 1; int n = numcheck(c[m]); while(n != 0){ if(max < n){ max = n; } m ++; n = numcheck(c[m]); } cout << max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'cin' was not declared in this scope 27 | cin >> N; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <algorithm> +++ |+#include <iostream> 3 | using namespace std; a.cc:33:16: error: 'cout' was not declared in this scope 33 | if(N == 1){cout << 1 << endl}else{ | ^~~~ a.cc:33:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:29: error: 'endl' was not declared in this scope 33 | if(N == 1){cout << 1 << endl}else{ | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <algorithm> +++ |+#include <ostream> 3 | using namespace std; a.cc:45:5: error: 'cout' was not declared in this scope 45 | cout << max << endl; | ^~~~ a.cc:45:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:45:20: error: 'endl' was not declared in this scope 45 | cout << max << endl; | ^~~~ a.cc:45:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s944939132
p00578
C++
#include<vector> #include <algorithm> using namespace std; int N; vector<long> a(114514); int numcheck(long h){ //島の数を水位によって出力します vector<int> b(N); int n = 0; for(int i = 0;i < N;i++){ if (a[i] - h > 0){ b[i] = 1; } else{ b[i] = 0; } } if (b[0] == 1) n++; for(int i = 1;i<N;i++){ if (b[i] == 1 && b[i-1] == 0){ n++; } } return n; } int main(){ cin >> N; vector <long> c(N); for(int i = 0;i < N ;i++){ cin >> a[i]; c[i] = a[i]; } if(N == 1){cout << 1 << endl;}else{ sort (c.begin() , c.end()); int max = numcheck(0); int m = 1; int n = numcheck(c[m]); while(n != 0){ if(max < n){ max = n; } m ++; n = numcheck(c[m]); } cout << max << endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'cin' was not declared in this scope 27 | cin >> N; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <algorithm> +++ |+#include <iostream> 3 | using namespace std; a.cc:33:16: error: 'cout' was not declared in this scope 33 | if(N == 1){cout << 1 << endl;}else{ | ^~~~ a.cc:33:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:29: error: 'endl' was not declared in this scope 33 | if(N == 1){cout << 1 << endl;}else{ | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <algorithm> +++ |+#include <ostream> 3 | using namespace std; a.cc:45:5: error: 'cout' was not declared in this scope 45 | cout << max << endl; | ^~~~ a.cc:45:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:45:20: error: 'endl' was not declared in this scope 45 | cout << max << endl; | ^~~~ a.cc:45:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s482724386
p00578
C++
#include<iostream> #include<vector> #include <algorithm> using namespace std; int N; int max; vector<long> a(100000); int numcheck(long h){ //島の数を水位によって出力します vector<int> b(N); int n = 0; int m = 0; for(int i = 0;i < N;i++){ if (a[i] - h > 0){ b[i] = 1; m++; } else{ b[i] = 0; } } if (b[0] == 1) n++; for(int i = 1;i<N;i++){ if (b[i] == 1 && b[i-1] == 0){ n++; } } if(m == n){max=n;n = 0;} //cout << m <<" "<<n << " "; return n; } int main(){ cin >> N; vector <long> c(N); for(int i = 0;i < N ;i++){ cin >> a[i]; c[i] = a[i]; } //cout << "runnning" << endl; if(N == 1){max = 1;}else{ sort (c.begin() , c.end()); c.erase(unique(c.begin(), c.end()), c.end()); /* for(auto it = c.begin(); it != c.end(); it++){ cout << *it; }; cout << endl; */ max = numcheck(0); int m = 0; int n = numcheck(c[m]); while(n > 0){ //cout << n << " " << max <<endl; if(max < n){ max = n; } m ++; n = numcheck(c[m]); } } cout << max << endl; return 0; }
a.cc: In function 'int numcheck(long int)': a.cc:29:16: error: reference to 'max' is ambiguous 29 | if(m == n){max=n;n = 0;} | ^~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc: In function 'int main()': a.cc:41:16: error: reference to 'max' is ambiguous 41 | if(N == 1){max = 1;}else{ | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:50:5: error: reference to 'max' is ambiguous 50 | max = numcheck(0); | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:55:12: error: reference to 'max' is ambiguous 55 | if(max < n){ | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:56:13: error: reference to 'max' is ambiguous 56 | max = n; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:63:13: error: reference to 'max' is ambiguous 63 | cout << max << endl; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~
s289702019
p00578
C++
#include<iostream> #include<vector> #include <algorithm> using namespace std; int N; int max; vector<long> a(100000); int numcheck(long h){ //島の数を水位によって出力します vector<int> b(N); int n = 0; int m = 0; for(int i = 0;i < N;i++){ if (a[i] - h > 0){ b[i] = 1; m++; } else{ b[i] = 0; } } if (b[0] == 1) n++; for(int i = 1;i<N;i++){ if (b[i] == 1 && b[i-1] == 0){ n++; } } if(m == n){max=n;n = 0;} //cout << m <<" "<<n << " "; return n; } int main(){ cin >> N; vector <long> c(N); for(int i = 0;i < N ;i++){ cin >> a[i]; c[i] = a[i]; } //cout << "runnning" << endl; if(N == 1){max = 1;}else{ sort (c.begin() , c.end()); c.erase(unique(c.begin(), c.end()), c.end()); /* for(auto it = c.begin(); it != c.end(); it++){ cout << *it; }; cout << endl; */ max = numcheck(0); int m = 0; int n = numcheck(c[m]); while(n > 0){ //cout << n << " " << max <<endl; if(max < n){ max = n; } m ++; n = numcheck(c[m]); } } cout << max << endl; return 0; }
a.cc: In function 'int numcheck(long int)': a.cc:29:16: error: reference to 'max' is ambiguous 29 | if(m == n){max=n;n = 0;} | ^~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc: In function 'int main()': a.cc:41:16: error: reference to 'max' is ambiguous 41 | if(N == 1){max = 1;}else{ | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:50:5: error: reference to 'max' is ambiguous 50 | max = numcheck(0); | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:55:12: error: reference to 'max' is ambiguous 55 | if(max < n){ | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:56:13: error: reference to 'max' is ambiguous 56 | max = n; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~ a.cc:63:13: error: reference to 'max' is ambiguous 63 | cout << max << endl; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:6:6: note: 'int max' 6 | int max; | ^~~
s385597890
p00578
C++
#include<cstdio> #include<algorithm> #include<iostream> #include<vector> using namespace std; int main() { int N=0; cin>>N;//区画の数 vector<int> A(N); for(int i=0;i<N;i++){ cin>>A[i];// } vector<bool> sea(N+2); sea[0]=sea[N+1]=true; for(int i=0;i<N;i++){ sea[i+1]=(A[i]<=0); } int current=0; for(int i=1;i<=N;i++){ if(!sea[i]&&sea[i-1]){ current++; } } vector<pair<int,int>>AandID; for(int i=0;i<N;i++){ if(A[i]>0){ AandID.push_back(make_pair(A[i],i+1)); } } sort(AandID.begin(),AandID.end()); int answer=current; for(int t=0;t<AandID.size();t++){ int i=AandID[t].second; sea[i]=true; if(sea[i-1]&&sea[i+1]){ current--; } else if(!sea[i-1]&&![i+1]){ current++; } if(t+1=AandID.size()||AandID[t].first<AandID[t+1].first){ answer=max(answer,current); } } cout<<answer<<endl; return 0; }
a.cc: In function 'int main()': a.cc:39:39: error: expected ',' before '+' token 39 | else if(!sea[i-1]&&![i+1]){ | ^ | , a.cc:39:39: error: expected identifier before '+' token a.cc: In lambda function: a.cc:39:42: error: expected '{' before ')' token 39 | else if(!sea[i-1]&&![i+1]){ | ^ a.cc: In function 'int main()': a.cc:39:36: error: no match for 'operator!' (operand type is 'main()::<lambda()>') 39 | else if(!sea[i-1]&&![i+1]){ | ^~~~~~ a.cc:39:36: note: candidate: 'operator!(bool)' (built-in) a.cc:39:36: note: no known conversion for argument 1 from 'main()::<lambda()>' to 'bool' a.cc:42:21: error: lvalue required as left operand of assignment 42 | if(t+1=AandID.size()||AandID[t].first<AandID[t+1].first){ | ~^~
s018702512
p00578
C++
#include<cstdio> #include<algorithm> #include<iostream> #include<vector> using namespace std; int main() { int N=0; cin>>N;//区画の数 vector<int> A(N); for(int i=0;i<N;i++){ cin>>A[i];// } vector<bool> sea(N+2); sea[0]=sea[N+1]=true; for(int i=0;i<N;i++){ sea[i+1]=(A[i]<=0); } int current=0; for(int i=1;i<=N;i++){ if(!sea[i]&&sea[i-1]){ current++; } } vector<pair<int,int> >AandID; for(int i=0;i<N;i++){ if(A[i]>0){ AandID.push_back(make_pair(A[i],i+1)); } } sort(AandID.begin(),AandID.end()); int answer=current; for(int t=0;t<AandID.size();t++){ int i=AandID[t].second; sea[i]=true; if(sea[i-1]&&sea[i+1]){ current--; } else if(!sea[i-1]&&!sea[i+1]){ current++; } if(t+1=AandID.size()||AandID[t].first<AandID[t+1].first){ answer=max(answer,current); } } cout<<answer<<endl; return 0; }
a.cc: In function 'int main()': a.cc:42:21: error: lvalue required as left operand of assignment 42 | if(t+1=AandID.size()||AandID[t].first<AandID[t+1].first){ | ~^~
s701425654
p00579
Java
import java.util.Arrays; import java.util.Scanner; class Main { static long[] beauty; //美しさ static int[] L; static int[] R; public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)){ int treeNum = sc.nextInt(); beauty = new long[treeNum]; boolean[] illumination = new boolean[treeNum]; //イルミネーション trueついてる falseついてない int mNum = sc.nextInt(); L = new int[mNum]; R = new int[mNum]; for (int i=0; i<treeNum; i++) { beauty[i] = sc.nextLong(); //美しさを読み込み illumination[i] = true; } for (int i=0; i<mNum; i++) { //LとRを記録 L[i] = sc.nextInt()-1; R[i] = sc.nextInt()-1; } long max_beauty = allPattern(-1l,illumination,0); System.out.println(max_beauty); } } public static long allPattern(long max,boolean[] illu, int pointer){ //maxの美しさ、イルミネーションの状態、何番目のルール if (pointer >= L.length) { //ルールの数 Long b = 0l; for (int i=0; i<beauty.length; i++) { //System.out.println(i + "-------" + illu[i]); if (illu[i]) { //ついているなら b += beauty[i]; //美しさを加算 } } //System.out.println(b); max=Math.max(max,b); } else { for (int i=L[pointer]; i<=R[pointer]; i++) { boolean[] copy = new boolean[illu.length]; (int j=0; j<illu.length; j++) copy[j] = illu[j]; //コピーする //boolean[] copy = Arrays.copyOf(illu, illu.length); for (int j=L[pointer]; j<=R[pointer]; j++) copy[j] = false; //まず範囲内をイルミネーションを全部消す if (illu[i]) { //すでに消したら処理しない copy[i] = true; //一個ずつつけて再帰する } max = allPattern(max,copy,pointer+1); } } return max; } }
Main.java:45: error: ',', ')', or '[' expected (int j=0; j<illu.length; j++) copy[j] = illu[j]; //????? ^ Main.java:45: error: not a statement (int j=0; j<illu.length; j++) copy[j] = illu[j]; //????? ^ Main.java:45: error: > or ',' expected (int j=0; j<illu.length; j++) copy[j] = illu[j]; //????? ^ Main.java:45: error: not a statement (int j=0; j<illu.length; j++) copy[j] = illu[j]; //????? ^ Main.java:45: error: ';' expected (int j=0; j<illu.length; j++) copy[j] = illu[j]; //????? ^ 5 errors
s803582620
p00586
Java
public class Main { Scanner sc = new Scanner(System.in); void doIt() { while(sc.hasNext()) { System.out.println(sc.nextInt() + sc.nextInt()); } } public static void main(String[] args) { new Main().doIt(); } }
Main.java:2: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:2: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s861731977
p00586
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(true) { System.out.println(scan.nextInt() + scan.nextInt); } } }
Main.java:6: error: cannot find symbol System.out.println(scan.nextInt() + scan.nextInt); ^ symbol: variable nextInt location: variable scan of type Scanner 1 error
s071485965
p00586
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(true) { System.out.println(scan.nextInt().equals(null) ? break : scan.nextInt() + scan.nextInt()); } } }
Main.java:7: error: illegal start of expression System.out.println(scan.nextInt().equals(null) ? break : scan.nextInt() + scan.nextInt()); ^ Main.java:7: error: ';' expected System.out.println(scan.nextInt().equals(null) ? break : scan.nextInt() + scan.nextInt()); ^ Main.java:7: error: not a statement System.out.println(scan.nextInt().equals(null) ? break : scan.nextInt() + scan.nextInt()); ^ Main.java:7: error: ';' expected System.out.println(scan.nextInt().equals(null) ? break : scan.nextInt() + scan.nextInt()); ^ 4 errors
s648865698
p00586
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); while(true) { int a = scan.nextInt(); if(a == null) break; System.out.println( a + scan.nextInt()); } } }
Main.java:8: error: bad operand types for binary operator '==' if(a == null) break; ^ first type: int second type: <null> 1 error
s838984769
p00586
Java
int main(){ Scanner sc = new Scanner(System.in); int a; int b; while(true){ if(!sc.hasNext())break; a = sc.nextInt(); b = sc.nextInt(); System.out.println(a + b); } return 0; }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) 1 error
s785177476
p00586
Java
int main(){ Scanner sc = new Scanner(System.in); int a; int b; while(true){ if(!sc.hasNext())break; a = sc.nextInt(); b = sc.nextInt(); System.out.println(a + b); } return 0; }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) 1 error
s099913417
p00586
Java
class Main { public static void main(String args[]){ Scanner input = new Scanner(System.in); while(true){ System.out.println(input.nextInt() + input.nextInt()); } } }
Main.java:3: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s516886619
p00586
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); while(10){ System.out.println(input.nextInt() + input.nextInt()); } } }
Main.java:7: error: incompatible types: int cannot be converted to boolean while(10){ ^ 1 error
s315518466
p00586
Java
import java.util.Scanner; public class No_1000 { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); String line = ""; String[] lineAry = new String[2]; while (true) { line = sc.nextLine(); if (line.length() == 0) { sc.close(); break; } else { lineAry = line.split(" "); System.out.println(Integer.parseInt(lineAry[0]) + Integer.parseInt(lineAry[1])); } } } }
Main.java:3: error: class No_1000 is public, should be declared in a file named No_1000.java public class No_1000 { ^ 1 error
s367140043
p00586
Java
import java.io.*; import java.util.*; public class j1000 { public static void main(String[] args) throws IOException { Scanner cin = new Scanner(System.in); while (cin.hasNext()) { final int a = cin.nextInt(); final int b = cin.nextInt(); System.out.println(a+b); } } }
Main.java:4: error: class j1000 is public, should be declared in a file named j1000.java public class j1000 { ^ 1 error
s995675289
p00586
Java
main(c,d)for(;scanf("%d%d",&c,&d)+1;)printf("%d\n",c+d);
Main.java:1: error: class, interface, enum, or record expected main(c,d)for(;scanf("%d%d",&c,&d)+1;)printf("%d\n",c+d); ^ Main.java:1: error: class, interface, enum, or record expected main(c,d)for(;scanf("%d%d",&c,&d)+1;)printf("%d\n",c+d); ^ Main.java:1: error: class, interface, enum, or record expected main(c,d)for(;scanf("%d%d",&c,&d)+1;)printf("%d\n",c+d); ^ 3 errors
s802891546
p00586
Java
main(c,d){while(scanf("%d%d",&c,&d)+1)printf("%d\n",c+d);}
Main.java:1: error: class, interface, enum, or record expected main(c,d){while(scanf("%d%d",&c,&d)+1)printf("%d\n",c+d);} ^ Main.java:1: error: class, interface, enum, or record expected main(c,d){while(scanf("%d%d",&c,&d)+1)printf("%d\n",c+d);} ^ 2 errors
s500832343
p00586
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.nextLine()){ int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a+b); } } }
Main.java:6: error: incompatible types: String cannot be converted to boolean while(sc.nextLine()){ ^ 1 error
s148037733
p00586
Java
import java.io.*; public class AOJ1000 { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); String s; String t[]; while((s = r.readLine()) != null){ t = s.split("[ ]"); System.out.println(Integer.parseInt(t[0])+ Integer.parseInt(t[1])); } } }
Main.java:3: error: class AOJ1000 is public, should be declared in a file named AOJ1000.java public class AOJ1000 { ^ 1 error
s332328150
p00586
Java
import java.util.*; public class AOJ_02 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ System.out.println(sc.nextInt() + sc.nextInt()); } } }
Main.java:3: error: class AOJ_02 is public, should be declared in a file named AOJ_02.java public class AOJ_02 { ^ 1 error