submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s172085096
p04005
C
#include <stdio.h> int calDiff(int a, int b, int c){ if(a % 2 == 1 && b % 2 == 1 && c % 2 == 1){ return diff = min(a, b, c); }else{ return 0; } } int min(int a, int b, int c){ int max, mid, min; if(a <= b){ if(b <= c){ max = c; mid = b; min = a; }else{ max = b; if(c >= a){ mid = c; min = a; }else{ mid = a; min = c; } } }else{ if(b >= c){ max = a; mid = b; min = c; }else{ min = b; if(a >= c){ max = a; mid = c; }else{ max = c; mid = a; } } } return min * mid; } int cal_vol(int max, int mid, int min){ int d; if(max % 2 == 0){ d = 0; }else{ d = min * mid * 1; } return d; } int main(void){ int a, b, c; int d; scanf("%d %d %d", &a, &b, &c); d = calDiff(a, b, c); printf("%d", d); putchar('\n'); return 0; }
main.c: In function 'calDiff': main.c:5:24: error: 'diff' undeclared (first use in this function) 5 | return diff = min(a, b, c); | ^~~~ main.c:5:24: note: each undeclared identifier is reported only once for each function it appears in main.c:5:31: error: implicit declaration of function 'min' [-Wimplicit-function-declaration] 5 | return diff = min(a, b, c); | ^~~
s742140016
p04005
C++
#define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF INT_MAX/3 #define PB push_back #define MP make_pair #define ALL(a) (a).begin(),(a).end() #define SET(a,c) memset(a,c,sizeof a) #define CLR(a) memset(a,0,sizeof a) #define PII pair<int,int> #define PCC pair<char,char> #define PIC pair<int,char> #define Pci pair<char,int> #define VS vector<string> #define VI vector<int> #define DEBUG(x) cout<<#x<<": "<<x<<endl #define MIN(a,b) (a>b?b:a) #define MAX(a,b) (a>b?a:b) #define PI 2*acos(0.0) #define INFILE() freopen("in0.txt","r",stdin) #define OUTFILE() freopen("out0.txt","w",stdout) #define IN scanf #define OUT(x) cout<<x<<endl #define LL long long #define ll long long #define ULL unsigned long long #define EPS 1e-14 #define FST first #define SEC second #include<iostream> #include <limits> #include <cstdint> #include<algorithm> using namespace std; int main() { int result = INF; // 入力 int size = 3; int ary[size]; scanf("%d %d %d", &ary[0], &ary[1], &ary[2]); sort(ary, ary + size); if(ary[0] % 2 == 0) result = min(result, 0); if(ary[1] % 2 == 0) result = min(result, 0); result = min(result, ary[2] % 2 * ary[0] * ary[1]); OUT(result); return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: 'INT_MAX' was not declared in this scope 6 | #define INF INT_MAX/3 | ^~~~~~~ a.cc:41:16: note: in expansion of macro 'INF' 41 | int result = INF; | ^~~ a.cc:37:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 36 | #include<algorithm> +++ |+#include <climits> 37 |
s603423486
p04005
C++
#define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF INT_MAX/3 #define PB push_back #define MP make_pair #define ALL(a) (a).begin(),(a).end() #define SET(a,c) memset(a,c,sizeof a) #define CLR(a) memset(a,0,sizeof a) #define PII pair<int,int> #define PCC pair<char,char> #define PIC pair<int,char> #define Pci pair<char,int> #define VS vector<string> #define VI vector<int> #define DEBUG(x) cout<<#x<<": "<<x<<endl #define MIN(a,b) (a>b?b:a) #define MAX(a,b) (a>b?a:b) #define PI 2*acos(0.0) #define INFILE() freopen("in0.txt","r",stdin) #define OUTFILE() freopen("out0.txt","w",stdout) #define IN scanf #define OUT(x) cout<<x<<endl #define LL long long #define ll long long #define ULL unsigned long long #define EPS 1e-14 #define FST first #define SEC second #include<iostream> #include <cstdint> #include<algorithm> using namespace std; int main() { int result = INF; // 入力 int size = 3; int ary[size]; scanf("%d %d %d", &ary[0], &ary[1], &ary[2]); sort(ary, ary + size); if(ary[0] % 2 == 0) result = min(result, 0); if(ary[1] % 2 == 0) result = min(result, 0); result = min(result, ary[2] % 2 * ary[0] * ary[1]); OUT(result); return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: 'INT_MAX' was not declared in this scope 6 | #define INF INT_MAX/3 | ^~~~~~~ a.cc:40:16: note: in expansion of macro 'INF' 40 | int result = INF; | ^~~ a.cc:36:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 35 | #include<algorithm> +++ |+#include <climits> 36 |
s359878234
p04005
C++
#define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF INT_MAX/3 #define PB push_back #define MP make_pair #define ALL(a) (a).begin(),(a).end() #define SET(a,c) memset(a,c,sizeof a) #define CLR(a) memset(a,0,sizeof a) #define PII pair<int,int> #define PCC pair<char,char> #define PIC pair<int,char> #define Pci pair<char,int> #define VS vector<string> #define VI vector<int> #define DEBUG(x) cout<<#x<<": "<<x<<endl #define MIN(a,b) (a>b?b:a) #define MAX(a,b) (a>b?a:b) #define PI 2*acos(0.0) #define INFILE() freopen("in0.txt","r",stdin) #define OUTFILE() freopen("out0.txt","w",stdout) #define IN scanf #define OUT(x) cout<<x<<endl #define LL long long #define ll long long #define ULL unsigned long long #define EPS 1e-14 #define FST first #define SEC second #include<iostream> #include<algorithm> using namespace std; int main() { int result = INF; // 入力 int size = 3; int ary[size]; scanf("%d %d %d", &ary[0], &ary[1], &ary[2]); sort(ary, ary + size); if(ary[0] % 2 == 0) result = min(result, 0); if(ary[1] % 2 == 0) result = min(result, 0); result = min(result, ary[2] % 2 * ary[0] * ary[1]); OUT(result); return 0; }
a.cc: In function 'int main()': a.cc:6:13: error: 'INT_MAX' was not declared in this scope 6 | #define INF INT_MAX/3 | ^~~~~~~ a.cc:39:16: note: in expansion of macro 'INF' 39 | int result = INF; | ^~~ a.cc:35:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 34 | #include<algorithm> +++ |+#include <climits> 35 |
s696846683
p04005
C++
#include <iostream> #include <iomanip> #include <vector> #include <map> #include <set> #include <queue> #include <bitset> #include <stack> #include <utility> #include <numeric> #include <algorithm> #include <functional> #include <complex> #include <string> #include <sstream> #include <fstream> #include <cstdio> #include <cstdlib> #include <cctype> #include <cstring> #include <math.h> #include <cmath> using namespace std; int main(){ int a[3]; int t; cin >> a[0] >> a[1] >> a[2]; sort(a,a+3); if(a[2]%2 == 0 || a[1]%2 == 0 || a[0]%2 == 0 ){ cout << 0 << endl; }else{ t = min(a[0]*a[1],a[0]*a[2],a[1]*a[2]); cout << t << endl; } }
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]': a.cc:32:11: required from here 32 | t = min(a[0]*a[1],a[0]*a[2],a[1]*a[2]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s034915354
p04005
C++
#include <iostream> #include <iomanip> #include <vector> #include <map> #include <set> #include <queue> #include <bitset> #include <stack> #include <utility> #include <numeric> #include <algorithm> #include <functional> #include <complex> #include <string> #include <sstream> #include <fstream> #include <cstdio> #include <cstdlib> #include <cctype> #include <cstring> #include <math.h> #include <cmath> using namespace std; int main(){ int a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a,a+3); if(a[2]%2 == 0 || a[1]%2 == 0 || a[0]%2 == 0 ){ cout << 0 << endl; }else{ cout << min(a[0]*a[1],a[0]*a[2],a[1]*a[2]) << endl; } }
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]': a.cc:31:15: required from here 31 | cout << min(a[0]*a[1],a[0]*a[2],a[1]*a[2]) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s283831551
p04005
Java
import java.util.Scanner; public class A { public static Scanner sc; public static void main(String [] args){ sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int maxi = Math.max(a,Math.max(c, b)); if(a%2==0 || b%2==0 || c%2==0){ System.out.println(0); } else { System.out.println( (a*b*c)/maxi ); } } }
Main.java:3: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s194310642
p04005
C++
import Data.List import Data.Char main = do l <- getLine let a = sort $ map (digitToInt . (\(c:[]) -> c)) $ words l if all even a then print 0 else print $ (a !! 0) * (a !! 1)
a.cc:6:39: error: stray '\' in program 6 | let a = sort $ map (digitToInt . (\(c:[]) -> c)) $ words l | ^ a.cc:1:1: error: 'import' does not name a type 1 | import Data.List | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s287420326
p04005
C++
#include <cstdio> #include <iostream> #include <iomanip> #include <sstream> #include <cmath> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <queue> #include <deque> #include <stack> #include <list> #include <bitset> #include <utility> #include <ctime> #include <cassert> #include <climits> using namespace std; #define TRACE #ifdef TRACE template<class T, class U> ostream& operator<<(ostream& out, const pair<T,U>& a){out<<"["<<a.first<<" "<<a.second<<"]";return out;} template<class T> ostream& operator<<(ostream& out, const vector<T>& a){out<<"[ ";for(auto &it:a)out<<it<<" ";out<<"]";return out;} template<class T> ostream& operator<<(ostream& out, const set<T>& a){out<<"[ ";for(auto &it:a)out<<it<<" ";out<<"]";return out;} template<class T> ostream& operator<<(ostream& out, const multiset<T>& a){out<<"[ ";for(auto &it:a)out<<it<<" ";out<<"]";return out;} template<class T,class U> ostream& operator<<(ostream& out, const map<T,U>& a){for(auto &it:a)out<<it.first<<" -> "<<it.second<<" | ";return out;} template<class T,class U> ostream& operator<<(ostream& out, const multimap<T,U>& a){for(auto &it:a)out<<it.first<<" -> "<<it.second<<" | ";return out;} #define pra(a,n) cerr<<#a<<" : ";for(int i=0;i<n;++i)cerr<<a[i]<<" ";cerr<<endl; #define praa(a,n,m) cerr<<#a<<" : "<<endl;for(int i=0;i<n;++i){for(int j=0;j<m;++j)cerr<<a[i][j]<<" ";cerr<<endl;} #define pr(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define pr(...) #define pra(a,n) #define praa(a,n,m) #endif #define int long long void Main() { int a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); if((a % 2) * (b % 2) * (c % 2) == 0) { cout << "0\n"; return; } cout << a[0] * a[1] << "\n"; } #undef int int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); Main(); }
a.cc: In function 'void Main()': a.cc:62:15: error: invalid operands of types 'long long int [3]' and 'int' to binary 'operator%' 62 | if((a % 2) * (b % 2) * (c % 2) == 0) { | ~ ^ ~ | | | | | int | long long int [3] a.cc:62:23: error: 'b' was not declared in this scope 62 | if((a % 2) * (b % 2) * (c % 2) == 0) { | ^ a.cc:62:33: error: 'c' was not declared in this scope 62 | if((a % 2) * (b % 2) * (c % 2) == 0) { | ^
s224806329
p04005
C++
using namespace std; int main(){ int H=0; int W=0; cin>>H; cin>>W; char hougan[H][W]; char aka[H][W]; char ao[H][W]; for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { aka[i][j]='.'; ao[i][j]='.'; } } for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cin>>hougan[i][j]; } cout<<endl; } for (int k=0; k<H; k+=2) { for (int l=0; l<W-1; l++) { aka[k][l]='#'; } } for (int k=0; k<H; k++) { aka[k][0]='#'; } for (int k=1; k<H; k+=2) { for (int l=1; l<W; l++) { ao[k][l]='#'; } } for (int k=1; k<H; k++) { ao[W][k]='#'; } for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { if (hougan[i][j]=='#' && i%2==0) { ao[i][j]='#'; } else if (hougan[i][j]=='#' && i%2==1){ aka[i][j]='#'; } } } for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cout<<aka[i][j]; } cout<<endl; } cout<<endl; for (int i=0; i<H; i++) { for (int j=0; j<W; j++) { cout<<ao[i][j]; } cout<<endl; } }
a.cc: In function 'int main()': a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin>>H; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:22:9: error: 'cout' was not declared in this scope 22 | cout<<endl; | ^~~~ a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:22:15: error: 'endl' was not declared in this scope 22 | cout<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std; a.cc:52:13: error: 'cout' was not declared in this scope 52 | cout<<aka[i][j]; | ^~~~ a.cc:52:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:54:9: error: 'cout' was not declared in this scope 54 | cout<<endl; | ^~~~ a.cc:54:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:54:15: error: 'endl' was not declared in this scope 54 | cout<<endl; | ^~~~ a.cc:54:15: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:56:5: error: 'cout' was not declared in this scope 56 | cout<<endl; | ^~~~ a.cc:56:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:56:11: error: 'endl' was not declared in this scope 56 | cout<<endl; | ^~~~ a.cc:56:11: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s649681999
p04005
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Scanner; public class twins { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); long a = s.nextLong(), b = s.nextLong(), c = s.nextLong(); long perThing = a*b; if(c%2 == 0) { System.out.println(0); } else { long blue = perThing * (c/2); long red = (c - (c/2)) * perThing; // System.out.println(blue + " " + red); System.out.println(Math.abs(red-blue)); } } }
Main.java:7: error: class twins is public, should be declared in a file named twins.java public class twins { ^ 1 error
s136896626
p04005
C++
#include<iostream> using namespace std; int main(){ int a[2]; cin>>a[0]>>a[1]>>a[2]; sort(a,a+2); int c=a[0]*a[1]; if(a[2]%2==0 || c%2==0){ cout<<0<<endl; return 0; } cout<<c<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:1: error: 'sort' was not declared in this scope; did you mean 'short'? 6 | sort(a,a+2); | ^~~~ | short
s187953186
p04005
C++
#include <stdio.h> #include<algorithm> using namespace std; int main(){ int a[3]; scanf("%d %d %d",&a[0],&a[1],&a[2]); sort(a,a+3); if(!(a[0]%2)||!(a[1]%2)||!(a[2]%2)){ printf("%d\n",0); }else{ printf("%lld\n",long long int(a[0])*a[1]); } }
a.cc: In function 'int main()': a.cc:12:33: error: expected primary-expression before 'long' 12 | printf("%lld\n",long long int(a[0])*a[1]); | ^~~~
s423102141
p04005
Java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main { long A,B,C; public void solve() { A = nextLong(); B = nextLong(); C = nextLong(); long ans = 0; long S = (A * B * C; long min = Math.min(A,Math.min(B,C)); long max = Math.max(A,Math.max(B,C)); long mid = S / min / max; max /= 2; ans = max * min * mid; out.println(Math.abs(S - ans * 2)); } public static void main(String[] args) { out.flush(); new Main().solve(); out.close(); } /* Input */ private static final InputStream in = System.in; private static final PrintWriter out = new PrintWriter(System.out); private final byte[] buffer = new byte[2048]; private int p = 0; private int buflen = 0; private boolean hasNextByte() { if (p < buflen) return true; p = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) return false; return true; } public boolean hasNext() { while (hasNextByte() && !isPrint(buffer[p])) { p++; } return hasNextByte(); } private boolean isPrint(int ch) { if (ch >= '!' && ch <= '~') return true; return false; } private int nextByte() { if (!hasNextByte()) return -1; return buffer[p++]; } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = -1; while (isPrint((b = nextByte()))) { sb.appendCodePoint(b); } return sb.toString(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } }
Main.java:13: error: ')' expected long S = (A * B * C; ^ 1 error
s967368012
p04005
C
// include #include <algorithm> #include <iterator> #include <vector> #include <iomanip> #include <iostream> #include <stack> #include <queue> #include <list> #include <utility> #include <string> #include <cstring> #include <stdio.h> #include <cassert> // M_PI for pi #define _USE_MATH_DEFINES #include <math.h> #include <climits> using namespace std; int N; long long x; long long A[2005]; long long B[2005]; void slove() { } int main(int argc, char* argv[]) { cin >> N >> x; for (int i = 0; i < N; ++i) { cin >> A[i]; } long long S = LLONG_MAX; long long s; for (int i = 0; i < N; ++i) { B[i] = A[i]; } for (int k = 0; k < N; ++k) { for (int i = 0; i < N; ++i) { B[i] = min(B[i], A[(N + i - k) % N]); } //for (int i = 0; i < N; ++i) { // cout << B[i] << " "; //} //cout << endl; s = 0; for (int i = 0; i < N; ++i) { s += B[i]; } s += k * x; //cout << s << endl; S = min(s, S); } cout << S << endl; return 0; }
main.c:2:10: fatal error: algorithm: No such file or directory 2 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s896154330
p04005
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); long a[] = new long[3]; long t; for(int i=0;i<3;i++) { a[i] = sc.nextLong(); if(a[i]%2==0) { System.out.print("0"); System.exit(0); }; }; if(a[0]>=a[2] && a[0]>=a[1]) { System.out.print(a[2]*a[1]); }else if(a[1]>=a[2] && a[0]<=a[1] System.out.print(a[0]*a[2]); else System.out.print(a[0]*a[1]); } }
Main.java:20: error: ')' expected }else if(a[1]>=a[2] && a[0]<=a[1] ^ 1 error
s273201271
p04005
Java
import java.util.*; class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int a[] = new int[3]; for(i=0;i<3;i++) a[i] = sc.nextInt(); Arrays.sort(a); if(a[2]%2==0) System.out.print("0"); else System.out.print(a[0]*a[1]); } } } }
Main.java:22: error: class, interface, enum, or record expected } ^ 1 error
s425687852
p04005
C++
#include <bits/stdc++.h> using namespace std; int64_t main() { vector<int64_t> L(3); for (int64_t i = 0; i < 3; ++i) { cin >> L[i]; } for (int64_t i = 0; i < 3; ++i) { if (L[i] % 2 == 0) { cout << '0' << endl; return 0; } } sort(L.begin(), L.end()); int64_t A, B, C1, C2; A = L[0]; B = L[1]; C1 = L[2]/2; C2 = L[2] - C1; cout << abs(A*B*C1 - A*B*C2) << endl; }
a.cc:5:1: error: '::main' must return 'int' 5 | int64_t main() { | ^~~~~~~
s985875844
p04005
C++
#include <bits/stdc++.h> using namespace std; int64 main() { vector<int64> L(3); for (int64 i = 0; i < 3; ++i) { cin >> L[i]; } for (int64 i = 0; i < 3; ++i) { if (L[i] % 2 == 0) { cout << '0' << endl; return 0; } } sort(L.begin(), L.end()); int64 A, B, C1, C2; A = L[0]; B = L[1]; C1 = L[2]/2; C2 = L[2] - C1; cout << abs(A*B*C1 - A*B*C2) << endl; }
a.cc:5:1: error: 'int64' does not name a type; did you mean 'int64_t'? 5 | int64 main() { | ^~~~~ | int64_t
s180134389
p04005
C++
#include <iostream> using namespace std; int cost[2000]; bool own[2000]; int n, x ; long long decide() { long long costtt =INT_MAX; int minplace = 0; long long sum = 0, sumslide = 0 ; bool gotdemall = true; for(int i=0 ; i<n ; ++i) { if(!own[i]) { sum+=cost[i]; gotdemall = false; if(cost[i]< costtt) { minplace = i; costtt = cost[i] ; } } if(i) { if(!own[i-1]) { sumslide +=cost[i]; } } else if(!own[n - 1]) { sumslide += cost[0]; } } if(gotdemall) return 0 ; if( sumslide + x < sum ) { int tmp = own[n -1]; for(int i=n ; --i ; ) own[i] = own[i-1]; own[0]= tmp ; costtt = x ; } else own[minplace] = 1; return costtt + decide(); } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> x ; for(int i=0; i<n; ++i) cin >> cost[i]; cout << decide(); }
a.cc: In function 'long long int decide()': a.cc:8:23: error: 'INT_MAX' was not declared in this scope 8 | long long costtt =INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std;
s428963893
p04005
C++
#include<algorithm> #define MAX 200 using namespace std; char s[MAX]; int a[5]; void _Itoa(int x,char sa[MAX]) { char ss[MAX]; int i,j; for(i=0;x;i++) { ss[i]='0'+x%10; x/=10; } for(j=0;i>0;j++) sa[j]=ss[--i]; sa[j]='\0'; } void XC_IIA(char *s,int a,int b) { int i,ns1,ns2,ss[MAX],*w; char s1[MAX],s2[MAX],*p,*q; _Itoa(a,s1); ns1=strlen(s1); _Itoa(b,s2); ns2=strlen(s2); for(i=0;i<MAX;i++)ss[i]=-1; for(i=0;i<ns2;i++) { w=ss+MAX-1-i; p=s2+(ns2-1-i); for(q=s1+(ns1-1);q>=s1;q--) { if(*w==-1)*w--=(*p-'0')*(*q-'0'); else *w--=*w+(*p-'0')*(*q-'0'); } } for(w=ss+MAX-1;w>=ss&&*w!=-1;w--) { if(*w>9&&*(w-1)==-1) *(w-1)=0; *(w-1)+=*w/10; *w=*w%10; } for(w++,p=s;w<ss+MAX;w++)*p++=*w+'0'; *p='\0'; } int main() { int flag=0; for(int i=0;i<3;i++) { scanf("%d",&a[i]); if(a[i]%2==0)flag=1; } if(flag){printf("0\n");return 0; } sort(a,a+3); XC_IIA(s,a[0],a[1]); printf("%s\n",s); return 0; }
a.cc: In function 'void XC_IIA(char*, int, int)': a.cc:28:13: error: 'strlen' was not declared in this scope 28 | ns1=strlen(s1); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<algorithm> +++ |+#include <cstring> 2 | #define MAX 200 a.cc: In function 'int main()': a.cc:57:9: error: 'scanf' was not declared in this scope 57 | scanf("%d",&a[i]); | ^~~~~ a.cc:60:14: error: 'printf' was not declared in this scope 60 | if(flag){printf("0\n");return 0; } | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include<algorithm> +++ |+#include <cstdio> 2 | #define MAX 200 a.cc:63:5: error: 'printf' was not declared in this scope 63 | printf("%s\n",s); | ^~~~~~ a.cc:63:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s917686205
p04005
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 200 char s[MAX]; int a[5]; int comp(const void*a,const void*b) { return *(int*)a-*(int*)b; } void XC_IIA(char *s,int a,int b) { int i,ns1,ns2,ss[MAX],*w; char s1[MAX],s2[MAX],*p,*q; _itoa(a,s1,10); ns1=strlen(s1); _itoa(b,s2,10); ns2=strlen(s2); for(i=0;i<MAX;i++)ss[i]=-1; for(i=0;i<ns2;i++) { w=ss+MAX-1-i; p=s2+(ns2-1-i); for(q=s1+(ns1-1);q>=s1;q--) { if(*w==-1)*w--=(*p-'0')*(*q-'0'); else *w--=*w+(*p-'0')*(*q-'0'); } } for(w=ss+MAX-1;w>=ss&&*w!=-1;w--) { if(*w>9&&*(w-1)==-1) *(w-1)=0; *(w-1)+=*w/10; *w=*w%10; } for(w++,p=s;w<ss+MAX;w++)*p++=*w+'0'; *p='\0'; } int main() { int flag=0; int i; for(i=0;i<3;i++) { scanf("%d",&a[i]); if(a[i]%2==0)flag=1; } if(flag){printf("0\n");return 0;} qsort(a,3,sizeof(int),comp); XC_IIA(s,a[0],a[1]); printf("%s\n",s); return 0; }
main.c: In function 'XC_IIA': main.c:16:9: error: implicit declaration of function '_itoa' [-Wimplicit-function-declaration] 16 | _itoa(a,s1,10); | ^~~~~
s956037648
p04005
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 200 char s[MAX]; int a[5]; int comp(const void*a,const void*b) { return *(int*)a-*(int*)b; } void XC_IIA(char *s,int a,int b) { int i,ns1,ns2,ss[MAX],*w; char s1[MAX],s2[MAX],*p,*q; _itoa(a,s1,10); ns1=strlen(s1); _itoa(b,s2,10); ns2=strlen(s2); for(i=0;i<MAX;i++)ss[i]=-1; for(i=0;i<ns2;i++) { w=ss+MAX-1-i; p=s2+(ns2-1-i); for(q=s1+(ns1-1);q>=s1;q--) { if(*w==-1)*w--=(*p-'0')*(*q-'0'); else *w--=*w+(*p-'0')*(*q-'0'); } } for(w=ss+MAX-1;w>=ss&&*w!=-1;w--) { if(*w>9&&*(w-1)==-1) *(w-1)=0; *(w-1)+=*w/10; *w=*w%10; } for(w++,p=s;w<ss+MAX;w++)*p++=*w+'0'; *p='\0'; } int main() { int flag=0; int i; for(i=0;i<3;i++) { scanf("%d",&a[i]); if(a[i]%2==0)flag=1; } if(flag){printf("0\n");return 0;} qsort(a,3,sizeof(int),comp); XC_IIA(s,a[0],a[1]); printf("%s\n",s); return 0; }
main.c: In function 'XC_IIA': main.c:16:9: error: implicit declaration of function '_itoa' [-Wimplicit-function-declaration] 16 | _itoa(a,s1,10); | ^~~~~
s216040704
p04005
Java
import java.util.Scanner; public class Batc { public static void main (String args[]){ Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long x= sc.nextLong(); long[] a = new long[2*(int)n]; for (int i = 0; i<n; i++) { a[i]=sc.nextLong(); a[i+(int)n]=a[i]; } long[][] costs = new long[(int)n][(int)n]; for (int i = (int)n; i<2*n; i++) { long best=a[i]; for (int j=0; j<n; j++) { best=Math.min(best, a[i-j]); costs[i-(int)n][j]=best; } } long best = n*1000000000; for (int j = 0; j<n;j++) { long curr = j*x; for (int i = 0; i<n; i++) { curr+=costs[i][j]; } best=Math.min(best, curr); } System.out.println(best); } }
Main.java:3: error: class Batc is public, should be declared in a file named Batc.java public class Batc { ^ 1 error
s655305932
p04005
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<algorithm> #define MAX 200 using namespace std; char s[MAX]; int a[5]; void XC_IIA(char *s,int a,int b) { int i,ns1,ns2,ss[MAX],*w; char s1[MAX],s2[MAX],*p,*q; _itoa(a,s1,10); ns1=strlen(s1); _itoa(b,s2,10); ns2=strlen(s2); for(i=0;i<MAX;i++)ss[i]=-1; for(i=0;i<ns2;i++) { w=ss+MAX-1-i; p=s2+(ns2-1-i); for(q=s1+(ns1-1);q>=s1;q--) { if(*w==-1)*w--=(*p-'0')*(*q-'0'); else *w--=*w+(*p-'0')*(*q-'0'); } } for(w=ss+MAX-1;w>=ss&&*w!=-1;w--) { if(*w>9&&*(w-1)==-1) *(w-1)=0; *(w-1)+=*w/10; *w=*w%10; } for(w++,p=s;w<ss+MAX;w++)*p++=*w+'0'; *p='\0'; } int main() { int flag=0; for(int i=0;i<3;i++) { scanf("%d",&a[i]); if(a[i]%2==0)flag=1; } if(flag){printf("0\n");return 0; } sort(a,a+3); XC_IIA(s,a[0],a[1]); printf("%s\n",s); return 0; }
a.cc: In function 'void XC_IIA(char*, int, int)': a.cc:16:9: error: '_itoa' was not declared in this scope 16 | _itoa(a,s1,10); | ^~~~~
s721851030
p04005
C++
#include <iostream> #include <climits> #include <array> #include <cmath> #include <vector> #include <queue> #include <algorithm> using namespace std; #define MODULE 1000000007 #define MP make_pair template<class T, class U> inline void chmin(T &t, U f) { if (t > f)t = f; } template<class T, class U> inline void chmax(T &t, U f) { if (t < f)t = f; } typedef pair<int, int> P; typedef long long LL; const int INF = INT_MAX / 2; //int_max->2*e+9 const int MAXN = 1001; /*struct edge { //structとclassの違いは,メンバが初期状態でpublicとなっているかprivateとなっているか edge(int to, int cost) : to(to), cost(cost) {} int to, cost; }; vector<edge> graph[MAXN];*/ vector<int> graph[MAXN+1]; int color[MAXN+1]; int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; //-----Template--------- int a,b,c,count=0; priority_queue<int> qu; //これで最大値を取り出せる 最小値なら <int ,std::vector<int>, std::greater<int>> int main() { ios::sync_with_stdio(false); cin >> a>>b>>c; if(a%2==0) count++; if(b%2==0) count++; if(c%2==0) count++; qu.push(a); qu.push(b); qu.push(c); if(count>=1){ cout<<0<<endl; }else{ int Max=qu.top()/2;qu.pop(); int a=qu.top();qu.pop(); int b=qu.top();qu.pop(); cout<<a*b<<endl; } }
a.cc: In function 'int main()': a.cc:43:9: error: reference to 'count' is ambiguous 43 | count++; | ^~~~~ In file included from /usr/include/c++/14/algorithm:86, from a.cc:7: /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:37:11: note: 'int count' 37 | int a,b,c,count=0; | ^~~~~ a.cc:45:9: error: reference to 'count' is ambiguous 45 | count++; | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:37:11: note: 'int count' 37 | int a,b,c,count=0; | ^~~~~ a.cc:47:9: error: reference to 'count' is ambiguous 47 | count++; | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:37:11: note: 'int count' 37 | int a,b,c,count=0; | ^~~~~ a.cc:51:8: error: reference to 'count' is ambiguous 51 | if(count>=1){ | ^~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)' 4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ a.cc:37:11: note: 'int count' 37 | int a,b,c,count=0; | ^~~~~
s610804452
p04005
C++
#include <iostream> using namespace std; typedef unsigned long long ll; int main() { int a,b,c; cin>>a>>b>>c; if(a>b) swap(a,b); if(a>c) swap(a,c); if(b>c) swap(b,c); maxi=c; if(maxi%2==0) { cout<<0<<endl; } else { ll res=a*b; cout<<res<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:3: error: 'maxi' was not declared in this scope 14 | maxi=c; | ^~~~
s353642416
p04005
C++
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<algorithm> #define MAX 200 using namespace std; char s[100]; void XC_IIA(char *s,long long int a,long long int b) { int i,ns1,ns2,ss[MAX],*w; char s1[MAX],s2[MAX],*p,*q; _itoa(a,s1,10); ns1=strlen(s1); _itoa(b,s2,10); ns2=strlen(s2); for(i=0;i<MAX;i++)ss[i]=-1; for(i=0;i<ns2;i++) { w=ss+MAX-1-i; p=s2+(ns2-1-i); for(q=s1+(ns1-1);q>=s1;q--) { if(*w==-1)*w--=(*p-'0')*(*q-'0'); else *w--=*w+(*p-'0')*(*q-'0'); } } for(w=ss+MAX-1;w>=ss&&*w!=-1;w--) { if(*w>9&&*(w-1)==-1) *(w-1)=0; *(w-1)+=*w/10; *w=*w%10; } for(w++,p=s;w<ss+MAX;w++)*p++=*w+'0'; *p='\0'; } long long int a[5]; int main() { int flag=0; for(int i=0;i<3;i++) { scanf("%d",&a[i]); if(a[i]%2==0)flag=1; } if(flag){printf("0\n");return 0; } sort(a,a+3); XC_IIA(s,a[0],a[1]); printf("%s\n",s); return 0; }
a.cc: In function 'void XC_IIA(char*, long long int, long long int)': a.cc:15:9: error: '_itoa' was not declared in this scope 15 | _itoa(a,s1,10); | ^~~~~
s475285340
p04005
C++
#include<iostream> #include<vector> using namespace std; int main() { vector<long int> a; long int b; for(int i = 0; i < 3; i++) { cin >> b; a.push_back(b); } if(a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0) { cout << 0 << endl; return 0; } sort(a.begin(), a.end()); cout << a[0] * a[1] << endl; }
a.cc: In function 'int main()': a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(a.begin(), a.end()); | ^~~~ | short
s641333699
p04005
C++
#include <stdio.h> int main(){ int a,b,c; int p1,p2,p3; int min; scanf("%d %d %d",&a,&b,&c); if(a%2==0 || b%2==0 || c%2==0){ printf("0\n"); return 0; } p1=b*c; p2=a*b; p3=a*c min=(p1<p2)?p1:p2; min=(min<p3)?min:p3; printf("%d\n",min); return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: expected ';' before 'min' 14 | p3=a*c | ^ | ; 15 | min=(p1<p2)?p1:p2; | ~~~
s225671845
p04005
C++
#include<iostream> typedef long long ll; using namespace std; int main(){ ll num[3]; for(int i = 0; i < 3; i++){ cin >> num[i]; } sort(num, num + 3); for (int i = 0; i < 3; i++){ if(num[i] % 2== 0){ cout << 0 << endl; return 0; } } cout << num[0] * num[1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(num, num + 3); | ^~~~ | short
s455833385
p04005
C++
using System; using System.Collections.Generic; class Program { static long f(long A, long B, long C){ long dc = C - 2*(C/2); return dc*A*B; } static void Main(string[] args){ string[] str = Console.ReadLine().Split(' '); long A = long.Parse(str[0]); long B = long.Parse(str[1]); long C = long.Parse(str[2]); long ans = f(A,B,C); ans = Math.Min(ans, f(C,B,A)); ans = Math.Min(ans, f(A,C,B)); Console.WriteLine(ans); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:9:22: error: 'string' has not been declared 9 | static void Main(string[] args){ | ^~~~~~ a.cc:9:31: error: expected ',' or '...' before 'args' 9 | static void Main(string[] args){ | ^~~~ a.cc:22:2: error: expected ';' after class definition 22 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:10:9: error: 'string' was not declared in this scope 10 | string[] str = Console.ReadLine().Split(' '); | ^~~~~~ a.cc:10:16: error: expected primary-expression before ']' token 10 | string[] str = Console.ReadLine().Split(' '); | ^ a.cc:11:18: error: expected primary-expression before 'long' 11 | long A = long.Parse(str[0]); | ^~~~ a.cc:12:18: error: expected primary-expression before 'long' 12 | long B = long.Parse(str[1]); | ^~~~ a.cc:13:18: error: expected primary-expression before 'long' 13 | long C = long.Parse(str[2]); | ^~~~ a.cc:17:15: error: 'Math' was not declared in this scope 17 | ans = Math.Min(ans, f(C,B,A)); | ^~~~ a.cc:20:9: error: 'Console' was not declared in this scope 20 | Console.WriteLine(ans); | ^~~~~~~
s118635419
p04005
C++
import std.stdio; import std.conv, std.array, std.algorithm, std.string; import std.math, std.random, std.range, std.datetime; import std.bigint; void main(){ int[] ds = readln.chomp.split.map!(to!int).array; int a = ds[0], b = ds[1], c = ds[2]; int ans; if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) ans = 0; else ans = min(a * b, a * c, b * c); ans.writeln; }
a.cc:1:1: error: 'import' does not name a type 1 | import std.stdio; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.conv, std.array, std.algorithm, std.string; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import std.math, std.random, std.range, std.datetime; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import std.bigint; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: '::main' must return 'int' 6 | void main(){ | ^~~~ a.cc: In function 'int main()': a.cc:7:12: error: structured binding declaration cannot have type 'int' 7 | int[] ds = readln.chomp.split.map!(to!int).array; | ^~ a.cc:7:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:7:12: error: empty structured binding declaration a.cc:7:15: error: expected initializer before 'ds' 7 | int[] ds = readln.chomp.split.map!(to!int).array; | ^~ a.cc:9:17: error: 'ds' was not declared in this scope 9 | int a = ds[0], b = ds[1], c = ds[2]; | ^~ a.cc:12:26: error: 'b' was not declared in this scope 12 | if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) ans = 0; | ^ a.cc:12:40: error: 'c' was not declared in this scope 12 | if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) ans = 0; | ^ a.cc:13:20: error: 'min' was not declared in this scope; did you mean 'main'? 13 | else ans = min(a * b, a * c, b * c); | ^~~ | main a.cc:15:13: error: request for member 'writeln' in 'ans', which is of non-class type 'int' 15 | ans.writeln; | ^~~~~~~
s099280889
p04005
C++
#include <iostream> using namespace std; long long main() { long long A, B, C; cin >> A >> B >> C; if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) { cout << 0 << endl; return 0; } if (A >= B&&A >= C) { cout << B*C << endl; return 0; } else if (B >= C){ cout << A*C << endl; return 0; } else{ cout << A*B << endl; return 0; } return 0; }
cc1plus: error: '::main' must return 'int'
s453668690
p04005
C++
#include <iostream> #include <algorithm> using namespace std; main(){ int a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a.begin(),a.end()); }
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:8:16: error: request for member 'begin' in 'a', which is of non-class type 'int [3]' 8 | sort(a.begin(),a.end()); | ^~~~~ a.cc:8:26: error: request for member 'end' in 'a', which is of non-class type 'int [3]' 8 | sort(a.begin(),a.end()); | ^~~
s636336111
p04005
C++
#include <stdio.h> int main(void){ int x, y, z, d; scanf("%d%d%d", &x, &y, &z); m = x; m = m<y?y:m; m = m<z?z:m; d = x*y*z/m; if (x%2==0 || y%2==0 || z%2==0) d=0; printf("%d\n", d); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'm' was not declared in this scope 8 | m = x; | ^
s373346031
p04005
C++
#include <iostream> #include <algorithm> #include <functional> #include <string> #include <climits> #include <vector> #include <numeric> #include <complex> #include <map> #include <bitset> #include <stack> #include <queue> #include <set> using namespace std; //#define __int64 long long #define long __int64 #define REP(i,a,b) for(int i=a;i<b;i++) #define rep(i,n) REP(i,0,n) const int Vec = 4; const int Vecy[Vec] = {0,-1,0,1}; const int Vecx[Vec] = {1,0,-1,0}; const int Modd = 1000000007; int main(){ int a[3]; int ans,maxd; cin >> a[0] >> a[1] >> a[2]; maxd = max_element(a, a+3) - &a[0]; if(a[maxd] % 2 == 0){ cout << 0 << endl; }else{ if(maxd == 0){ cout << (long)a[1] * a[2] << endl; }else if(maxd == 1){ cout << (long)a[0] * a[2] << endl; }else{ cout << (long)a[1] * a[2] << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:17:14: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 17 | #define long __int64 | ^~~~~~~ a.cc:37:34: note: in expansion of macro 'long' 37 | cout << (long)a[1] * a[2] << endl; | ^~~~ a.cc:17:14: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 17 | #define long __int64 | ^~~~~~~ a.cc:39:34: note: in expansion of macro 'long' 39 | cout << (long)a[0] * a[2] << endl; | ^~~~ a.cc:17:14: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 17 | #define long __int64 | ^~~~~~~ a.cc:41:34: note: in expansion of macro 'long' 41 | cout << (long)a[1] * a[2] << endl; | ^~~~
s888324597
p04005
C++
> using namespace std; typedef long long LL; typedef double DB; #define F(i,a,b) for(int i=(a);i<=(b);++i) #define R(i,n) for(int i=(0);i<(n);++i) #define fill(a,b) memset(a,b,sizeof a); const LL INF = 0x3f3f3f3f3f3f3f3fLL; int main() { //freopen("test.txt","r",stdin); LL a,b,c; scanf("%lld %lld %lld",&a,&b,&c); LL ans = INF; ans = min(ans,b*c*((a+1)/2 - a/2)); ans = min(ans,a*c*((b+1)/2 - b/2)); ans = min(ans,a*b*((c+1)/2 - c/2)); printf("%lld",ans); return 0; }
a.cc:1:1: error: expected unqualified-id before '>' token 1 | > | ^ a.cc: In function 'int main()': a.cc:16:9: error: 'scanf' was not declared in this scope 16 | scanf("%lld %lld %lld",&a,&b,&c); | ^~~~~ a.cc:18:15: error: 'min' was not declared in this scope; did you mean 'main'? 18 | ans = min(ans,b*c*((a+1)/2 - a/2)); | ^~~ | main a.cc:21:9: error: 'printf' was not declared in this scope 21 | printf("%lld",ans); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | >
s292112339
p04005
C++
{-# LANGUAGE MultiParamTypeClasses,FlexibleContexts,FlexibleInstances,TypeSynonymInstances,BangPatterns,RankNTypes,TupleSections #-} import Control.Monad import Control.Monad.ST import Control.Applicative import Control.Arrow import Debug.Trace import Text.Printf import Data.List import Data.Int import Data.Bits import Data.Maybe import Data.Monoid import Data.Array.Unboxed import Data.Array.ST import Data.Array.Base import Data.Function(on) import Data.Tuple(swap) import qualified Data.Map as M import qualified Data.Set as S import qualified Data.ByteString.Char8 as B main :: IO () main = do [a,b,c] <- readInts if all odd [a,b,c] then print $ minimum [a * b , b * c, c * a] else putStrLn "0" -- IO readInt :: B.ByteString -> Int readInt = fromJust . fmap fst . B.readInt readInts :: IO [Int] readInts = map readInt . B.words <$> B.getLine readIntPair :: IO (Int,Int) readIntPair = l2p . map readInt . take 2 . B.words <$> B.getLine readAllInts :: IO [[Int]] readAllInts = map (map readInt . B.words) . B.lines <$> B.getContents readLns :: Read a => IO [a] readLns = map read . words <$> getLine -- Utilities l2p :: [a] -> (a,a) l2p (a:b:_) = (a,b) l2p _ = error "l2p: the input list is too short" p2l :: (a,a) -> [a] p2l (a,b) = [a,b] itof :: Int -> Double itof = fromIntegral inf :: Int inf = maxBound `div` 2 -- Monad stepM_ :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m ()) -> m () stepM_ i0 judge incr step = sub i0 where sub i | judge i = step i >> sub (incr i) | otherwise = return () rep_ :: Monad m => Int -> (Int -> m ()) -> m () rep_ n = stepM_ 0 (<n) (+1) thru :: Monad m => (v -> m ()) -> v -> m v thru m v = m v >> return v memoize :: (Monad m) => (k -> m (Maybe v)) -> (k -> v -> m ()) -> k -> m v -> m v memoize getter setter key action = do mv <- getter key case mv of Just v -> return v Nothing -> action >>= thru (setter key) -- Array newUArray :: (MArray (STUArray s) e (ST s),Ix i) => (i,i) -> e -> ST s (STUArray s i e) newUArray = newArray newBArray :: (Ix i) => (i,i) -> e -> ST s (STArray s i e) newBArray = newArray defaultArray :: (IArray a e,Ix i) => e -> (i,i) -> [(i,e)] -> a i e defaultArray = accumArray $ curry snd fromEdges :: Ix i => (i,i) -> [(i,e)] -> Array i [e] fromEdges = accumArray (flip (:)) []
a.cc:1:3: error: stray '#' in program 1 | {-# LANGUAGE MultiParamTypeClasses,FlexibleContexts,FlexibleInstances,TypeSynonymInstances,BangPatterns,RankNTypes,TupleSections #-} | ^ a.cc:1:130: error: stray '#' in program 1 | {-# LANGUAGE MultiParamTypeClasses,FlexibleContexts,FlexibleInstances,TypeSynonymInstances,BangPatterns,RankNTypes,TupleSections #-} | ^ a.cc:52:16: error: stray '`' in program 52 | inf = maxBound `div` 2 | ^ a.cc:52:20: error: stray '`' in program 52 | inf = maxBound `div` 2 | ^ a.cc:1:1: error: expected unqualified-id before '{' token 1 | {-# LANGUAGE MultiParamTypeClasses,FlexibleContexts,FlexibleInstances,TypeSynonymInstances,BangPatterns,RankNTypes,TupleSections #-} | ^ a.cc:2:1: error: 'import' does not name a type 2 | import Control.Monad | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
s467955400
p04005
C++
#include <iostream> using namespace std; int main(){ long long int A,B,C; cin>>A>>B>>C; if(A%2==0||B%2==0||C%2==0){ cout<<0<<endl; }else{ cout<<min(A*B,B*C,C*A})<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:30: error: expected ')' before '}' token 10 | cout<<min(A*B,B*C,C*A})<<endl; | ~ ^ | ) a.cc:10:31: error: expected primary-expression before ')' token 10 | cout<<min(A*B,B*C,C*A})<<endl; | ^ a.cc: At global scope: a.cc:13:5: error: expected unqualified-id before 'return' 13 | return 0; | ^~~~~~ a.cc:14:1: error: expected declaration before '}' token 14 | } | ^
s837347163
p04005
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Pair = System.Collections.Generic.KeyValuePair<int, int>; class Program { public Program() { } static void Main(string[] args) { new Program().prog(); } Scanner cin; const int MOD = 1000000007; const int INF = int.MaxValue; const double EPS = 1e-7; const double PI = 3.1415926536; void prog() { cin = new Scanner(); int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } }; int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } }; long A = cin.nextInt(); long B = cin.nextInt(); long C = cin.nextInt(); if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0) { Console.WriteLine(0); return; } long max = Math.Max(A, Math.Max(B, C)); if (max == A) { Console.WriteLine(B * C); return; }else if (max == B) { Console.WriteLine(A * C); return; } else { Console.WriteLine(A * B); return; } } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.IO; | ^~~~~~ a.cc:7:14: error: 'System' does not name a type 7 | using Pair = System.Collections.Generic.KeyValuePair<int, int>; | ^~~~~~ a.cc:11:15: error: expected ':' before 'Program' 11 | public Program() { } | ^~~~~~~~ | : a.cc:13:26: error: 'string' has not been declared 13 | static void Main(string[] args) | ^~~~~~ a.cc:13:35: error: expected ',' or '...' before 'args' 13 | static void Main(string[] args) | ^~~~ a.cc:17:9: error: 'Scanner' does not name a type 17 | Scanner cin; | ^~~~~~~ a.cc:53:2: error: expected ';' after class definition 53 | } | ^ | ; a.cc:19:25: error: expected primary-expression before 'int' 19 | const int INF = int.MaxValue; | ^~~ a.cc: In static member function 'static void Program::Main(int*)': a.cc:15:30: error: expected ';' before '.' token 15 | new Program().prog(); | ^ a.cc: In member function 'void Program::prog()': a.cc:25:17: error: 'cin' was not declared in this scope 25 | cin = new Scanner(); | ^~~ a.cc:25:27: error: expected type-specifier before 'Scanner' 25 | cin = new Scanner(); | ^~~~~~~ a.cc:26:21: error: expected identifier before ',' token 26 | int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } }; | ^ a.cc:26:21: error: expected ']' before ',' token a.cc:26:20: error: structured binding declaration cannot have type 'int' 26 | int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } }; | ^ a.cc:26:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:26:20: error: empty structured binding declaration a.cc:26:24: error: expected initializer before 'dir8' 26 | int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } }; | ^~~~ a.cc:27:21: error: expected identifier before ',' token 27 | int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } }; | ^ a.cc:27:21: error: expected ']' before ',' token a.cc:27:20: error: structured binding declaration cannot have type 'int' 27 | int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } }; | ^ a.cc:27:20: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:27:20: error: empty structured binding declaration a.cc:27:24: error: expected initializer before 'dir4' 27 | int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } }; | ^~~~ a.cc:34:25: error: 'Console' was not declared in this scope 34 | Console.WriteLine(0); | ^~~~~~~ a.cc:37:28: error: 'Math' was not declared in this scope 37 | long max = Math.Max(A, Math.Max(B, C)); | ^~~~ a.cc:40:25: error: 'Console' was not declared in this scope 40 | Console.WriteLine(B * C); | ^~~~~~~ a.cc:44:25: error: 'Console' was not declared in this scope 44 | Console.WriteLine(A * C); | ^~~~~~~ a.cc:49:25: error: 'Console' was not declared in this scope 49 | Console.WriteLine(A * B); | ^~~~~~~ a.cc: At global scope: a.cc:57:9: error: 'string' does not name a type 57 | string[] s; | ^~~~~~ a.cc:60:13: error: expected unqualified-id before '[' token 60 | char[] cs = new char[] { ' ' }; | ^ a.cc:62:15: error: expected ':' before 'Scanner' 62 | public Scanner() | ^~~~~~~~ | : a.cc:68:15: error: expected ':' before 'string' 68 | public string next() | ^~~~~~~ | : a.cc:68:16: error: 'string' does not name a type 68 | public string next() | ^~~~~~ a.cc:78:15: error: expected ':' before 'int' 78 | public int nextInt() | ^~~~ | : a.cc:83:15: error: expected ':' before 'long' 83 | public long nextLong() | ^~~~~ | : a.cc:88:15: error: expected ':' before 'double' 88 | public double nextDouble() | ^~~~~~~ | : a.cc:92:2: error: expected ';' after class definition 92 | } | ^ | ; a.cc: In constructor 'Scanner::Scanner()': a.cc:64:17: error: 's' was not declared in this scope 64 | s = new string[0]; | ^ a.cc:64:25: error: 'string' does not name a type 64 | s = new string[0]; | ^~~~~~ a.cc: In member function 'int Scanner::nextInt()': a.cc:80:24: error: expected primary-expression before 'int' 80 | return int.Parse(next()); | ^~~ a.cc:80:24: error: expected ';' before 'int' a.cc:80:27: error: expected unqualified-id before '.' token 80 | return int.Parse(next()); | ^ a.cc: In member function 'long int Scanner::nextLong()': a.cc:85:24: error: expected primary-expression before 'long' 85 | return long.Parse(next()); | ^~~~ a.cc:85:24: error: expected ';' before 'long' a.cc:85:28: error: expected unqualified-id before '.' token 85 | return long.Parse(next()); | ^ a.cc: In member function 'double Scanner::nextDouble()': a.cc:90:24: error: expected primary-expression before 'double' 90 | return double.Parse(next()); | ^~~~~~ a.cc:90:24: error: expected ';' before 'double' a.cc:90:30: error: expected unqualified-id before '.' token 90 | return double.Parse(next()); | ^
s085330485
p04005
C++
#include <stdio.h> #include <algorithm> using namespace std; int main( void ) { long long A[3] scanf("%lld %lld %lld", &A[0], &A[1], &A[2]); sort(A, A+3); printf("%lld\n", A[0] * A[1]); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: expected initializer before 'scanf' 8 | scanf("%lld %lld %lld", &A[0], &A[1], &A[2]); | ^~~~~ a.cc:10:14: error: 'A' was not declared in this scope 10 | sort(A, A+3); | ^
s302617029
p04005
C++
#include <bits/stdc++.h> using namespace std; #define ll long long #define vvi vector< vector<int> > #define vi vector<int> #define All(X) X.begin(),X.end() #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define REP(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define pii pair<int,int> #define mp make_pair #define pi 3.14159265359 #define shosu(X) fixed << setprecision(X) ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ ll int a,b,c; cin >> a >> b >> c; if(a%2 == 0 || b%2 == 0 || c%2 == 0){ cout << 0 << endl; return 0; } ans = b*c; ans = min(ans, a*b); ans = min(ans, a*c); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | ans = b*c; | ^~~ | abs
s626372525
p04005
C++
#include <iostream> #include <vector> #include <set> #include <iomanip> #include <cassert> #include <algorithm> #include <string> #include <cstring> #include <cmath> using namespace std; namespace fastinput { /** Interface */ inline int readChar(); template <class T = int> inline T readInt(); template <class T> inline void writeInt(T x, char end = 0); inline void writeChar(int x); inline void writeWord(const char *s); /** Read */ static const int buf_size = 16384; inline int getChar() { static char buf[buf_size]; static int len = 0, pos = 0; if (pos == len) pos = 0, len = fread(buf, 1, buf_size, stdin); if (pos == len) return -1; return buf[pos++]; } inline int readChar() { int c = getChar(); while (c <= 32) c = getChar(); return c; } template <class T> inline T readInt() { int s = 1, c = readChar(); T x = 0; if (c == '-') s = -1, c = getChar(); while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getChar(); return s == 1 ? x : -x; } /** Write */ static int write_pos = 0; static char write_buf[buf_size]; inline void writeChar(int x) { if (write_pos == buf_size) fwrite(write_buf, 1, buf_size, stdout), write_pos = 0; write_buf[write_pos++] = x; } template <class T> inline void writeInt(T x, char end) { if (x < 0) writeChar('-'), x = -x; char s[24]; int n = 0; while (x || !n) s[n++] = '0' + x % 10, x /= 10; while (n--) writeChar(s[n]); if (end) writeChar(end); } inline void writeWord(const char *s) { while (*s) writeChar(*s++); } struct Flusher { ~Flusher() { if (write_pos) fwrite(write_buf, 1, write_pos, stdout), write_pos = 0; } } flusher; } using namespace fastinput; int main() { long long a, b, c; a = readInt(); b = readInt(); c = readInt(); if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl; else { cout << min(a * b, b * c, c * a) << endl; } return 0; }
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:2: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:107:14: required from here 107 | cout << min(a * b, b * c, c * a) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s947735959
p04005
C++
#include <iostream> #include <queue> #include <set> #include <cassert> #include <map> #include <sstream> using namespace std; int main(){ long long A,B,C; cin >> A >> B >> C; long long ans = 1e18; ans = min({(B%2)*A*C,(A%2)*B*C,(C%2)*A*B}); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:18: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 14 | ans = min({(B%2)*A*C,(A%2)*B*C,(C%2)*A*B}); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: 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
s994806504
p04005
C++
#include "bits/stdc++.h" #include "ext/pb_ds/tree_policy.hpp" #include "ext/pb_ds/assoc_container.hpp" #define PB push_back #define PF push_front #define LB lower_bound #define UB upper_bound #define fr(x) freopen(x,"r",stdin) #define fw(x) freopen(x,"w",stdout) #define in(x) (read(x)) #define iout(x) printf("%d\n",x) #define lout(x) printf("%lld\n",x) #define REP(x,l,u) for(ll x = l;x<u;x++) #define RREP(x,l,u) for(ll x = l;x>=u;x--) #define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end()) #define mst(x,a) memset(x,a,sizeof(x)) #define all(a) a.begin(),a.end() #define PII pair<int,int> #define PLL pair<ll,ll> #define MP make_pair #define sqr(x) ((x)*(x)) #define lowbit(x) (x&(-x)) #define lson (ind<<1) #define rson (ind<<1|1) #define se second #define fi first #define dbg(x) cout<<#x<<" = "<<(x)<<endl; #define sz(x) ((int)x.size()) typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; using namespace std; const int block_size = 320; typedef complex<ll> point; const ll mod = 1e9+7; const ld eps = 1e-9; const int inf = mod; template<typename T> inline int sign(const T&a){if(a<0)return -1;if(a>0)return 1;return 0;} template<typename T> inline void read(T &x){ x = 0; T f = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();} while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();} x *= f; } int main(){ ll a,b,c;cin>>a>>b>>c; if(a%2==0 || b%2 == 0 || c%2==0){ cout<<0;return 0; } ll ans = min(a*b,a*c);ll ans = min(ans,b*c); cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:55:34: error: redeclaration of 'll ans' 55 | ll ans = min(a*b,a*c);ll ans = min(ans,b*c); | ^~~ a.cc:55:12: note: 'll ans' previously declared here 55 | ll ans = min(a*b,a*c);ll ans = min(ans,b*c); | ^~~
s442468002
p04005
C++
#include<bits/stdc++.h> using namespace std; #define FZ(n) memset((n),0,sizeof(n)) #define FMO(n) memset((n),-1,sizeof(n)) #define MC(n,m) memcpy((n),(m),sizeof(n)) #define F first #define S second #define MP make_pair #define PB push_back #define ALL(x) begin(x),end(x) #define IOS do { ios_base::sync_with_stdio(0);cin.tie(0); } while (0) #define SZ(x) ((int)(x).size()) #ifndef OFFLINE #define ONLINE_JUDGE #endif #ifdef ONLINE_JUDGE #define FILEIO(name) \ do { \ freopen(name".in", "r", stdin); \ freopen(name".out", "w", stdout); \ } while (0) #else #define FILEIO(name) do { } while(0) #endif #define _TOKEN_CAT2(x, y) x ## y #define _TOKEN_CAT(x, y) _TOKEN_CAT2(x, y) #define _MACRO_OVERL3(_1, _2, _3, _N, ...) _N #define _RANGE1(a) int _TOKEN_CAT(_t, __LINE__)=0; _TOKEN_CAT(_t, __LINE__)<(a); (_TOKEN_CAT(_t, __LINE__))++ #define _RANGE2(i, a) int (i)=0; (i)<(a); (i)++ #define _RANGE3(i, a, b) int (i)=(a); (i)!=(b); (i)+=((b)>(a)?1:-1) #define loop(...) for (_MACRO_OVERL3(__VA_ARGS__, _RANGE3, _RANGE2, _RANGE1)(__VA_ARGS__)) #ifdef OFFLINE template<typename T> void _dump(const char* s, T&& head) { cerr << s << " = " << head << " <<" << endl; } template<typename T, typename... Args> void _dump(const char* s, T&& head, Args&&... tail) { int c = 0; while (*s!=',' || c!=0) { if (*s=='(' || *s=='[' || *s=='{' || *s=='<') c++; if (*s==')' || *s==']' || *s=='}' || *s=='>') c--; cerr << *s++; } cerr << " = " << head << ", "; _dump(s+1, tail...); } #define dump(...) do { \ cerr << "\033[32m>> " << __LINE__ << ": " << __PRETTY_FUNCTION__ << endl; \ cout << " "; \ _dump(#__VA_ARGS__, __VA_ARGS__); \ cout << "\033[0m"; \ } while (0) #else #define dump(...) #endif #define au auto template<class T> using vec = vector<T>; template<typename Iter> ostream& _IterOutput_(ostream &o, Iter b, Iter e, const string ss="", const string se="") { o << ss; for (auto it=b; it!=e; it++) o << (it==b ? "" : ", ") << *it; return o << se; } template<typename T1, typename T2> ostream& operator << (ostream &o, const pair<T1, T2> &pair) { return o << "(" << pair.F << ", " << pair.S << ")"; } template<typename T> ostream& operator << (ostream &o, const vector<T> &vec) { return _IterOutput_(o, ALL(vec), "[", "]"); } template<typename T> ostream& operator << (ostream &o, const set<T> &st) { return _IterOutput_(o, ALL(st), "{", "}"); } template<typename T, size_t N> ostream& operator << (ostream &o, const array<T, N> &arr) { return _IterOutput_(o, ALL(arr), "|", "|"); } template<typename T1, typename T2> ostream& operator << (ostream &o, const map<T1, T2> &mp) { o << "{"; for (auto it=mp.begin(); it!=mp.end(); it++) { o << (it==mp.begin()?"":", ") << it->F << ":" << it->S; } o << "}"; return o; }
/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
s435515928
p04005
C++
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define li long long #define itn int using namespace std; inline int nxt(){ int n; scanf("%d", &n); return n; } int main(){ vector<int> a(3); for (int i = 0; i < 3; i++) a[i] = nxt(); sort(all(a[i])); if (a[0] % 2 == 0 || a[1] % 2 == 0 || a[2] % 2 == 0){ puts("0"); } else { cout << 1ll * a[0] * a[1] << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:20:20: error: 'i' was not declared in this scope 20 | sort(all(a[i])); | ^ a.cc:3:17: note: in definition of macro 'all' 3 | #define all(x) (x).begin(), (x).end() | ^
s521136840
p04006
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K;cin>>N>>K;vector<int>A(N); for(int i=0;i<N;i++)cin>>A[i]; sort(A.begin(),A.end()); long long count=A[0]+K; long long ans=A[0]; for(int i=1;i<N;i++)ans+=min(count,A[i]); cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:31: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 9 | for(int i=1;i<N;i++)ans+=min(count,A[i]); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:9:31: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 9 | for(int i=1;i<N;i++)ans+=min(count,A[i]); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:9:31: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 9 | for(int i=1;i<N;i++)ans+=min(count,A[i]); | ~~~^~~~~~~~~~~~
s763440804
p04006
C++
// ----------------------------------- // author : MatsuTaku // country : Japan // created : 09/03/20 01:08:28 // ----------------------------------- #include <bits/stdc++.h> #include "../../../library/include/segment_tree.hpp" using namespace std; using ll = long long; struct Min { int x; Min(int x=1e9): x(x) {} Min operator*(const Min& r) const {return min(x,r.x);} Min& operator*=(const Min& r) {return *this = *this * r;} }; using Rmq = SegmentTree<Min>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n,x; cin>>n>>x; vector<int> A(n); for (auto& a:A) cin>>a; Rmq rmq(A.begin(), A.end()); vector<long long> dp(n); { for (int i = 0; i < n; i++) { dp[i] = A[(n-i)%n]; if (i > 0) dp[i] = min(dp[i], dp[i-1]); } } constexpr ll INF = 1e18; for (int i = 1; i < n; i++) { auto nxt = dp; for (int j = 0; j < n; j++) { auto mina = rmq.query(max(i-j, 0), i+1).x; if (i-j < 0) mina = min(mina, rmq.query(i-j+n, n).x); nxt[j] = dp[j] + mina; if (j > 0) nxt[j] = min(nxt[j], nxt[j-1]); } dp = nxt; } ll ans = INF; for (int i = 0; i < n; i++) { ans = min(ans, dp[i] + (ll)x * i); } cout << ans << endl; return 0; }
a.cc:8:10: fatal error: ../../../library/include/segment_tree.hpp: No such file or directory 8 | #include "../../../library/include/segment_tree.hpp" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s822763662
p04006
C++
#include <iostream> #include <vector> #include <utility> using namespace std; typedef pair<long long, long long> P; long long MAX = 1e18; struct segK{ int n; vector<P> dat; void init(int n_){ n = 1; while(n < n_) n *= 2; dat.resize(n * 2 - 1); for(int i = 0; i < n * 2 - 1; i++) dat[i] = P(MAX, 0); } void update(int k, long long p, long long c){ k += n - 1; dat[k] = P(p, c); while(k > 0){ k = (k - 1) / 2; if(dat[2 * k + 1].first < dat[2 * k + 2].first) dat[k] = dat[2 * k + 1]; else if(dat[2 * k + 1].first > dat[2 * k + 2].first) dat[k] = dat[2 * k + 2]; else if(dat[2 * k + 1].second < dat[2 * k + 2].second) dat[k] = dat[2 * k + 1]; else dat[k] = dat[2 * k + 2]; } } P query(int a, int b, int k, int l, int r){ if(r <= a || b <= l) return P(MAX, 0); if(l <= a && b <= r) return dat[k]; else{ P v1 = query(a, b, k * 2 + 1, l, (l + r) / 2); P v2 = query(a, b, k * 2 + 2, (l + r) / 2, r); if(v1.first > v2.first) return v2; else if(v1.first < v2.first) return v1; else if(v1.second < v2.second) return v1; else return v2; } } }; int main(){ long long N; long long x; cin >> N >> x; vector<segK> segtree(N); vector<long long> a(N); for(int i = 0; i < N; i++) { cin >> a[i]; segtree[i].init(N); } for(int i = 0; i < N; i++){ for(long long j = 0; j < N; j++){ segtree[i].update(j, a[(i + j) % N] + (N - j) % N * x, (N - j) % N); } } long long ans = 0; vector<P> vec; long long n = segtree[i].n; long long cnt = 0; for(int i = 0; i < N; i++){ P temp = segtree[i].query(0, N, 0, 0, n); vec.push_back(temp); cnt = max(cnt, temp.second); } for(int i = 0; i < N; i++) ans += vec[i].first - x * vec[i].second; ans += cnt * x; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:57:27: error: 'i' was not declared in this scope 57 | long long n = segtree[i].n; | ^
s546501444
p04006
C++
#include <iostream> #include <vector> #include <utility> using namespace std; typedef pair<long long, long long> P; long long MAX = 1e18; struct segK{ int n; vector<P> dat; void init(int n_){ n = 1; while(n < n_) n *= 2; dat.resize(n * 2 - 1); for(int i = 0; i < n * 2 - 1; i++) dat[i] = P(MAX, 0); } void update(int k, long long p, long long c){ k += n - 1; dat[k] = P(p, c); while(k > 0){ k = (k - 1) / 2; if(dat[2 * k + 1].first < dat[2 * k + 2].first) dat[k] = dat[2 * k + 1]; else if(dat[2 * k + 1].first > dat[2 * k + 2].first) dat[k] = dat[2 * k + 2]; else if(dat[2 * k + 1].second < dat[2 * k + 2].second) dat[k] = dat[2 * k + 1]; else dat[k] = dat[2 * k + 2]; } } P query(int a, int b, int k, int l, int r){ if(r <= a || b <= l) return P(MAX, 0); if(l <= a && b <= r) return dat[k]; else{ P v1 = query(a, b, k * 2 + 1, l, (l + r) / 2); P v2 = query(a, b, k * 2 + 2, (l + r) / 2, r); if(v1.first > v2.first) return v2; else if(v1.first < v2.first) return v1; else if(v1.second < v2.second) return v1; else return v2; } } }; int main(){ long long N; long long x; cin >> N >> x; vector<segK> segtree(N); vector<long long> a(N); for(int i = 0; i < N; i++) { cin >> a[i]; segtree[i].init(N); } for(int i = 0; i < N; i++){ for(long long j = 0; j < N; j++){ segtree[i].update(j, a[(i + j) % N] + (N - j) % N * x, (N - j) % N); } } long long ans = 0; vector<P> vec; long long cnt = 0; for(int i = 0; i < N; i++){ P temp = segtree[i].query(0, N, 0, 0, segT.n); vec.push_back(temp); cnt = max(cnt, temp.second); } for(int i = 0; i < N; i++) ans += vec[i].first - x * vec[i].second; ans += cnt * x; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:59:47: error: 'segT' was not declared in this scope; did you mean 'segK'? 59 | P temp = segtree[i].query(0, N, 0, 0, segT.n); | ^~~~ | segK
s607434561
p04006
C++
#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; using ll=long long; using P=pair<ll,ll>; template<class T> using V=vector<T>; #define fi first #define se second #define all(v) (v).begin(),(v).end() const ll inf=(1e18); //const ll mod=998244353; const ll mod=1000000007; ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;} ll LCM(ll c,ll d){return c/GCD(c,d)*d;} struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } int main(){ ll n,x; cin>>n>>x; V<ll> a(n); for(int i=0;i<n;i++){ cin>>a[i]; } reverse(a.begin(),a.end()); V<P> res(n,{inf,inf}); ll ans=inf; for(ll i=0;i<n;i++){ for(ll j=0;j<n;j++){ int id=(i+j)%n; if(res[id].fi+res[id].se>a[i]+j*x){ res[id].se=j*x; res[id].fi=a[i]; } if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ res[id].se = j*x; res[id].fi = a[i]; } } } ll sum=0,tmp=0; for(ll j=0;j<n;j++){ chmax(tmp,res[j].se); sum+=res[j].fi; } cout<<sum+tmp<<"\n"; }
a.cc: In function 'int main()': a.cc:35:59: error: no match for 'operator>' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'll' {aka 'long long int'}) 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:2: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:35:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'} 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:35:63: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'} 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:35:63: note: mismatched types 'const std::pair<_T1, _T2>' and 'll' {aka 'long long int'} 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::move_iterator<_IteratorL>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:35:63: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} is not derived from 'const std::move_iterator<_IteratorL>' 35 | if(res[id].fi+res[id].se==a[i]+j*x && res[id] > j*x){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/b
s297859900
p04006
C++
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <stack> #include <queue> #include <limits.h> #include <cmath> #include <map> using namespace std; using P=pair<int,int>; using ll=long long; #define int long long bool chmin(ll &a,ll b){ if(a>b){ a=b; return true; }else{ return false; } } signed main(){ ll n,x; cin>>n>>x; vector<int> a(n); for(int i=0;i<n;i++)cin>>a[i]; vector<int> cnt(n,0); int mx; ll ret=0; for(int i=0;i<n;i++){ ll plus=INT_MAX; int memo=-1; for(int j=0;j<n;j++){ if(j<=i){ if(chmin(plus,a[j]+x*(i-j))){ memo=j; } }else{ if(chmin(plus,a[j]+x*(n-j+i))){ memo=j; } } } cnt[memo]++; if(memo<=i){ mx=max(mx,i-memo); }else{ mx=max(mx,(int)n-memo+i); } } for(int i=0;i<n;i++){ ret+=a[i]*cnt[i]; ret+=mx[i]*x; } cout<<ret<<endl; }
a.cc: In function 'int main()': a.cc:53:16: error: invalid types 'long long int[long long int]' for array subscript 53 | ret+=mx[i]*x; | ^
s798534352
p04006
C++
#include <iostream> #include <algorithm> #include <queue> #include <cassert> #include <set> using namespace std; typedef long long ll; const int MINF=-1e9; typedef pair<int,int> P; int main() { ll n,x; cin>>n>>x; ll a[n]; for(int i=0;i<n;i++) cin>>a[i]; if (n==1) { cout<<a[0]<<endl; return 0; } ll an=1e18; ll b[n];for(int i=0;i<n;i++) b[i]=a[i]; for(ll i=0;i<=n;i++) { ll sm=0; for(int j=0;j<n;j++) { sm+=b[j]; } an=min(an,sm+x*i); //cout<<i<<" "<<an<<endl; if (i==n) break; ll temp0=min(b[0],b[n-1]); for(int j=n-1;j>=1;j--) { b[j]=min(b[j-1],b[j]); } b[0]=temp0; /for(int j=0;j<n;j++) cout<<b[j]<<" "; cout<<endl; } cout<<an<<endl; }
a.cc: In function 'int main()': a.cc:30:5: error: expected primary-expression before '/' token 30 | /for(int j=0;j<n;j++) cout<<b[j]<<" "; cout<<endl; | ^ a.cc:30:6: error: expected primary-expression before 'for' 30 | /for(int j=0;j<n;j++) cout<<b[j]<<" "; cout<<endl; | ^~~ a.cc:30:18: error: 'j' was not declared in this scope 30 | /for(int j=0;j<n;j++) cout<<b[j]<<" "; cout<<endl; | ^
s220225849
p04006
C++
def main(): n, x = map(int, input().split()) a = list(map(int, input().split())) ans = 1100100100100100100 b = [10000000000 for i in range(n)] for i in range(n): for j in range(n): b[j] = min(b[j], a[i - j]) sumb = sum(b) ans = min(ans, sumb + i * x) print(ans) if __name__ == '__main__': main()
a.cc:14:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 14 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:1:1: error: 'def' does not name a type 1 | def main(): | ^~~
s282920825
p04006
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, X; cin >> N >> X; vector<ll> A(N), B(N); for (auto &e : A) cin >> e; ll minv = accumulate<ll>(begin(A), end(A), 0); for (int i = 1; i < N; i++) { for (int j = 0; j < N; j++) B[(j+1)%N] = min(A[(j+1)%N], A[j]); A = B; minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X); } cout << minv << endl; return (0); }
a.cc: In function 'int main()': a.cc:12:33: error: no matching function for call to 'accumulate<ll>(std::vector<long long int>::iterator, std::vector<long long int>::iterator, int)' 12 | ll minv = accumulate<ll>(begin(A), end(A), 0); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/numeric:62, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)' 134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_numeric.h:134:5: note: template argument deduction/substitution failed: a.cc:12:39: note: cannot convert 'std::begin<vector<long long int> >(A)' (type 'std::vector<long long int>::iterator') to type 'long long int' 12 | ll minv = accumulate<ll>(begin(A), end(A), 0); | ~~~~~^~~ /usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)' 161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate expects 4 arguments, 3 provided a.cc:16:44: error: no matching function for call to 'accumulate<ll>(std::vector<long long int>::iterator, std::vector<long long int>::iterator, int)' 16 | minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)' 134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_numeric.h:134:5: note: template argument deduction/substitution failed: a.cc:16:50: note: cannot convert 'std::begin<vector<long long int> >(A)' (type 'std::vector<long long int>::iterator') to type 'long long int' 16 | minv = min(minv, accumulate<ll>(begin(A), end(A), 0) + i * X); | ~~~~~^~~ /usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)' 161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_numeric.h:161:5: note: candidate expects 4 arguments, 3 provided
s925350866
p04006
C++
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> P; typedef long long ll; int main(){ ll N, x; cin >> N >> x; ll a[N]; for(int i=0; i<N; i++) cin >> a[i]; int min_cost[N][N]; for(int i=0; i<N; i++){ for(int j=0; j<N; j++){ if(i==0) min_cost[j][i] = a[j]; else{ if(min_cost[j][i-1] > a[(j+N-i)%N]) time[j][i] = a[(j+N-i)%N]; } } } ll ans = 1e18; for(int i=0; i<N; i++){ ll cnt = x*i; for(int j=0; j<N; j++){ cnt += time[j][i]; } if(ans > cnt) ans = cnt; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:75: warning: pointer to a function used in arithmetic [-Wpointer-arith] 15 | if(min_cost[j][i-1] > a[(j+N-i)%N]) time[j][i] = a[(j+N-i)%N]; | ^ a.cc:15:78: warning: pointer to a function used in arithmetic [-Wpointer-arith] 15 | if(min_cost[j][i-1] > a[(j+N-i)%N]) time[j][i] = a[(j+N-i)%N]; | ^ a.cc:15:80: error: assignment of read-only location '*(time + (((sizetype)j) + ((sizetype)i)))' 15 | if(min_cost[j][i-1] > a[(j+N-i)%N]) time[j][i] = a[(j+N-i)%N]; | ~~~~~~~~~~~^~~~~~~~~~~~~~ a.cc:23:38: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | cnt += time[j][i]; | ^ a.cc:23:41: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | cnt += time[j][i]; | ^ a.cc:23:29: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | cnt += time[j][i]; | ~~~~^~~~~~~~~~~~~ a.cc:23:29: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'll' {aka 'long long int'} [-fpermissive] 23 | cnt += time[j][i]; | ~~~~^~~~~~~~~~~~~ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
s744028171
p04006
C++
#include<bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; #define rep(i,s,e) for(ll i = (ll)(s); i < (ll)(e); ++i) #define per(i,s,e) for(ll i = (ll)(s)-1; i >= (ll)(e); --i) using ll = long long; template<class T, class U> using P = pair<T,U>; template<class T> using Heap = priority_queue<T>; template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>; template<class T> bool ChangeMax(T&a,const T&b){ if(a >= b) return false; a = b; return true; } template<class T> bool ChangeMin(T&a,const T&b){ if(a <= b) return false; a = b; return true; } template<class T, size_t N, class U> void Fill(T (&a)[N], const U&v){ fill((U*)a,(U*)(a+N),v); } template<class T> istream& operator >> (istream&is, vector<T>&v){ for(auto&e:v)is >> e; return is; } int main(){ int n,x; cin >> n >> x; vector<int> a(n); cin >> a; vector<int> v(n,1001001001); ll ans = 2010 * (1e+9); rep(i,0,n){ ll now = i*x; rep(i,0,n){ ChangeMin(v[i], a[(i-k+n)%n]); now += v[i]; } ChangeMin(ans, now); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:46:28: error: 'k' was not declared in this scope 46 | ChangeMin(v[i], a[(i-k+n)%n]); | ^
s880715597
p04006
C++
#include<bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; #define rep(i,s,e) for(int i = (int)(s); i < (int)(e); ++i) #define per(i,s,e) for(int i = (int)(s)-1; i >= (int)(e); --i) using ll = long long; template<class T, class U> using P = pair<T,U>; template<class T> using Heap = priority_queue<T>; template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>; template<class T> bool ChangeMax(T&a,const T&b){ if(a >= b) return false; a = b; return true; } template<class T> bool ChangeMin(T&a,const T&b){ if(a <= b) return false; a = b; return true; } template<class T, size_t N, class U> void Fill(T (&a)[N], const U&v){ fill((U*)a,(U*)(a+N),v); } template<class T> istream& operator >> (istream&is, vector<T>&v){ for(auto&e:v)is >> e; return is; } int main(){ int n,x; cin >> n >> x; vector<int> a(n); cin >> a; vector<int> v(n,1001001001); ll ans = 1001001001; auto f = [&](int k)->int{ ll res = k*x; rep(i,0,n){ ChangeMin(v[i], a[(i-k+n)%n]); res += v[i]; } return res; }; rep(i,0,n) ChangeMin(ans, f(i)); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:51:23: error: no matching function for call to 'ChangeMin(ll&, int)' 51 | rep(i,0,n) ChangeMin(ans, f(i)); | ~~~~~~~~~^~~~~~~~~~~ a.cc:22:6: note: candidate: 'template<class T> bool ChangeMin(T&, const T&)' 22 | bool ChangeMin(T&a,const T&b){ | ^~~~~~~~~ a.cc:22:6: note: template argument deduction/substitution failed: a.cc:51:23: note: deduced conflicting types for parameter 'const T' ('long long int' and 'int') 51 | rep(i,0,n) ChangeMin(ans, f(i)); | ~~~~~~~~~^~~~~~~~~~~
s012386874
p04006
C++
#include<iostream> #include<string> #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> using namespace std; typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; typedef long double ld; const ll mod = 1000000007; const ll INF = mod * mod; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<int, int> P; typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; typedef vector<int> vec; typedef vector<string> svec; #define fr first #define sc second #define all(c) c.begin(),c.end() #define pb push_back //#define int long long //ダブりに注意 //魔法をダブらせて使う void solve() { int n; cin >> n; ll x; cin >> x; vector<ll> a(n); rep(i, n) cin >> a[i]; ll ans = 0; vector<ll> b(n), c(n); rep(i, n) { a[i] = b[i]; c[i] = a[i]; } ll ans = INF; //魔法を使う回数 rep(i, n) { ll res = x * i; rep(j, n) { int k = (j - i + n) % n; if(b[j] > a[k] + x * i){ c[j] = a[k]; } } rep(j, n) { res += c[j]; } ans = min(ans, res); } cout << ans << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(10); //init(); solve(); //cout << "finish" << endl; return 0; }
a.cc: In function 'void solve()': a.cc:62:8: error: redeclaration of 'll ans' 62 | ll ans = INF; | ^~~ a.cc:56:8: note: 'll ans' previously declared here 56 | ll ans = 0; | ^~~
s673813988
p04006
C++
v/* it was worth becoming a chemist */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ld; typedef unsigned int uni; typedef unsigned long long unll; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long long, int> pli; typedef pair<int, long long> pil; typedef vector<int> vi; typedef vector<long long> vll; #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)x.size() #define NAME "puts" #define F first #define S second const ll INF = 1e18; const int inf = 1e9; const int mod = 1e9 + 7; const db EPS = (db) 1e-9; const db pi = acos(-1.0); const int MAXN = 1e5 + 5; ll a, b, c; int main() { cin >> a >> b >> c; if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) { cout << 0; return 0; } cout << min(a, min(b, c)) * ((a + b + c) - min(a, min(b, c)) - max(a, max(b, c))); return 0; }
a.cc:1:1: error: 'v' does not name a type 1 | v/* it was worth becoming a chemist */ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s173317874
p04006
C++
#include <bits/stdc++.h> using namespace std; const int MAXN = 2000 + 10, inf = INT_MAX; long long n, x; long long ans; long long shift; long long a[MAXN], b[MAXN]; int main() { cin >> n >> x; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } ans = inf; rep(int k = 0; k < n; k++) { shift = k * x; for (int i = 0; i < n; i++) { b[i] = min(b[i], a[(i + n - k) % N]); shift += b[i]; } ans = min(ans, shift); } cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:20:13: error: expected primary-expression before 'int' 20 | rep(int k = 0; k < n; k++) { | ^~~ a.cc:20:24: error: 'k' was not declared in this scope 20 | rep(int k = 0; k < n; k++) { | ^
s798557992
p04006
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 2000 + 10, inf = 1e18; ll dp[N][N]; int main() { ll n, x; cin >> n >> x; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) dp[0][i] = a[i]; for (int i = 1; i < n; i++) for (int j = 0; j < n; j++) dp[i][j] = min(dp[i - 1][j], a[(i + j) % n]) ll ans = inf; for (int i = 0; i < n; i++) { ll cnt = x * i; for (int j = 0; j < n; j++) cnt += dp[i][j]; ans = min(ans, cnt); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:16: error: 'a' was not declared in this scope 13 | cin >> a[i]; | ^ a.cc:15:20: error: 'a' was not declared in this scope 15 | dp[0][i] = a[i]; | ^ a.cc:18:54: error: 'a' was not declared in this scope 18 | dp[i][j] = min(dp[i - 1][j], a[(i + j) % n]) | ^ a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | ans = min(ans, cnt); | ^~~ | abs a.cc:26:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 26 | cout << ans << endl; | ^~~ | abs
s261538954
p04006
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <set> #include <queue> #include <deque> #include <map> #include <stack> #include<bitset> #include<list> #include<cassert> #include<numeric> using namespace std; const int N = 2 * 1000 + 5; vector<long long> a; long long n, x; long long dp[N][N]; int main() { cin >> n >> x; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; a.push_back(tmp); } long long ans = 1000 * 1000 * 1000; for (int i = 0; i < n; i++) dp[0][i] = a[i]; for (int i = 1; i < n; i++) { for (int j = 0; j < n; j++) { dp[i][j] = min(a[((i - k) + n) % n], dp[(i - 1 + n) % n][j]); } } for (int i = 0; i < n; i++) { long long tmp = 0; for (int j = 0; j < n; j++) { tmp += dp[i][j]; } ans = min(ans, tmp); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:38:48: error: 'k' was not declared in this scope 38 | dp[i][j] = min(a[((i - k) + n) % n], dp[(i - 1 + n) % n][j]); | ^
s265703232
p04006
C++
#include <bits/stdc++.h> using namespace std; const int N = 2000 + 7; pair < long long, long long > w[N][N]; long long res, x, n, a[N]; long long dis[N]; long long main() { cin >> n >> x; for (long long i = 1; i <= n; i++) cin >> a[i]; for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= n; j++) { if (j >= i) w[i][j] = {a[i] + (j - i) * x, j - i}; else w[i][j] = {a[i] + (j + n - i) * x, j + n - i}; } } long long maxd = 0; for (long long i = 1; i <= n; i++) { long long mn = w[1][i].first, d = i - 1; for (long long j = 1; j <= n; j++) { if (w[j][i].first < mn) mn = w[j][i].first, d = w[j][i].second; // cout << j << " " << i << " " << w[j][i].first << endl; } maxd = max(d, maxd); res += mn - d * x; } cout << res + maxd * x; return 0; }
cc1plus: error: '::main' must return 'int'
s017547872
p04006
C++
#include<iostream> #include<iomanip> #include<cstdio> #include<string> #include<cstring> #include<climits> #include<algorithm> #include<vector> #include<cmath> #include<map> #include<set> #include<stack> #include<queue> #include<deque> #include<tuple> #include<list> #include<unordered_map> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define vii vector<int> #define vll vector<ll> #define lb lower_bound #define pb push_back #define mp make_pair #define rep(i,n) for(ll i=0;i<n;i++) #define rep2(i,a,b) for(ll i=a;i<b;i++) #define repr(i,n) for(ll i=n-1;i>=0;i--) #define all(x) x.begin(),x.end() #define INF (1 << 30) - 1 #define LLINF (1LL << 61) - 1 // #define int ll using namespace std; const int MOD = 1000000007; const int MAX = 510000; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n,x,a[3999],b[3999][3999],ans=INF; cin>>n>>x; rep(i,n) cin>>a[i]; rep(i,n) b[i][0]=a[i]; rep(i,n){ ll sec=0; rep(j,n){ if(i==0){ sec+=a[j]; continue; } ll s=j-i; if(j-i<0) s+=n; b[j][i]=min(b[j][i-1],a[s]);, sec+=min(b[j][i-1],a[s]); } ans=min(ans,sec+i*x); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:55:38: error: expected primary-expression before ',' token 55 | b[j][i]=min(b[j][i-1],a[s]);, | ^
s295023792
p04006
C++
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <cassert> #include <map> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); int n, x; cin >> n >> x; std::vector<int> v(n); for (auto& el : v) { cin >> el; } auto ind = std::min_element(v.begin(), v.end()) - v.begin(); int64_t ans = (int64_t)1e18; for (int k = 0; k < n; k++) { auto begin_seg = ind; auto cur = ind; auto sum = 0LL; int can_take = k; for (int i = 0; i < n; i++) { if (v[begin_seg] >= v[cur]) { begin_seg = cur; can_take = k; } sum += v[begin_seg]; cur++; cur %= n; if (can_take == 0) { can_take = k; begin_seg = cur; } else { can_take--; } } ans = min(ans, sum + x * 1ll * k); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:41:14: error: no matching function for call to 'min(int64_t&, long long int)' 41 | ans = min(ans, sum + x * 1ll * k); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:41:14: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 41 | ans = min(ans, sum + x * 1ll * k); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:41:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 41 | ans = min(ans, sum + x * 1ll * k); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~
s556774363
p04006
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long int ll; ll mi[2005]; int main(){ int n,x; cin >> n >> x; vector<int> a(n); for(int i=0;i<n;i++){ cin >> a[i]; mi[i]=a[i]; } ll ans=1e18; for(int i=0;i<n;i++){ ll sum=0; for(int j=0;j<n;j++){ sum+=mi[j]; } ans=min(ans,sum+x*i); for(int j=0;j<n;j++){ mi[j]=min(mi[j],a[(j+n-i-1)%n]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:24:34: error: no matching function for call to 'min(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)' 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:24:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:24:34: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s667176367
p04006
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long int ll; int mi[2005]; int main(){ int n,x; cin >> n >> x; vector<ll> a(n); for(int i=0;i<n;i++){ cin >> a[i]; mi[i]=a[i]; } ll ans=1e18; for(int i=0;i<n;i++){ ll sum=0; for(int j=0;j<n;j++){ sum+=mi[j]; } ans=min(ans,sum+x*i); for(int j=0;j<n;j++){ mi[j]=min(mi[j],a[(j+n-i-1)%n]); } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:24:34: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:24:34: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:24:34: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | mi[j]=min(mi[j],a[(j+n-i-1)%n]); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s359858951
p04006
Java
public class Main { public static void main(String[] args) { // TODO Auto-generated method stub long x,kk,ans; int n; Scanner in =new Scanner(System.in); n=in.nextInt();x=in.nextLong(); long [] a=new long[n+1000]; long [][] dp = new long[n+500][n+500]; for(int i=1;i<=n;i++) { a[i]=in.nextLong(); } ans=9000000000000000000L;kk=-1; for(int i=1;i<=n;i++) { dp[i][0]=a[i]; for(int k=1;k<n;k++) { int pi=((i-k) + n) % n; if(pi<=0)pi=n+pi; if(dp[i][k-1]>=a[pi])dp[i][k]=a[pi]; else dp[i][k]=dp[i][k-1]; // if(bal1>a[pi] + ((long)k)*x) { // bal1=a[pi]+(k)*x;bal2=k;bal3=a[pi]; // } } // if(bal2>kk)kk=bal2; // ans+=bal3; } long sum=0; for(int k=0;k<n;k++) { sum=0; for(int i=1;i<=n;i++) { sum+=dp[i][k]; } if(sum<ans)ans=sum+k*x; } System.out.println(ans); } }
Main.java:7: error: cannot find symbol Scanner in =new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:7: error: cannot find symbol Scanner in =new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s765065183
p04006
Java
#include<iostream> #include<string> #include<cstring> #include<map> #include<algorithm> #include<set> #include<vector> #include<cstdio> #include<cmath> #include<queue> using namespace std; typedef long long LL; const int maxn = 2e3 + 5; LL a[maxn]; LL b[maxn][maxn]; int main(){ int n; LL x,sum = 1LL << 60LL; cin >> n >> x; for(int i = 1;i <= n;i++) cin >> a[i]; for(int i = 1;i <= n;i++){ b[i][0] = a[i]; for(int k = 1;k <= n - 1;k++){ int pos = i - k; if(pos <= 0) pos = n - abs(pos); b[i][k] = min(b[i][k - 1],a[pos]); } } for(int k = 0;k <= n - 1;k++){ LL ans = 0; for(int i = 1;i <= n;i++){ ans += b[i][k]; } sum = min(sum,ans + x * k); } cout << sum << endl; }
Main.java:1: error: illegal character: '#' #include<iostream> ^ Main.java:2: error: illegal character: '#' #include<string> ^ Main.java:3: error: illegal character: '#' #include<cstring> ^ Main.java:4: error: illegal character: '#' #include<map> ^ Main.java:5: error: illegal character: '#' #include<algorithm> ^ Main.java:6: error: illegal character: '#' #include<set> ^ Main.java:7: error: illegal character: '#' #include<vector> ^ Main.java:8: error: illegal character: '#' #include<cstdio> ^ Main.java:9: error: illegal character: '#' #include<cmath> ^ Main.java:10: error: illegal character: '#' #include<queue> ^ Main.java:12: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:14: error: class, interface, enum, or record expected const int maxn = 2e3 + 5; ^ Main.java:15: error: class, interface, enum, or record expected LL a[maxn]; ^ Main.java:16: error: class, interface, enum, or record expected LL b[maxn][maxn]; ^ Main.java:19: error: not a statement LL x,sum = 1LL << 60LL; ^ Main.java:19: error: not a statement LL x,sum = 1LL << 60LL; ^ Main.java:20: error: not a statement cin >> n >> x; ^ Main.java:21: error: not a statement for(int i = 1;i <= n;i++) cin >> a[i]; ^ Main.java:37: error: not a statement cout << sum << endl; ^ Main.java:17: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) Main.java:19: error: ';' expected LL x,sum = 1LL << 60LL; ^ 21 errors
s014168088
p04006
Java
#include<bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 2e3 + 5; LL a[maxn]; LL b[maxn][maxn]; int main(){ int n; LL x,sum = 1LL << 60LL; cin >> n >> x; for(int i = 1;i <= n;i++) cin >> a[i]; for(int i = 1;i <= n;i++){ b[i][0] = a[i]; for(int k = 1;k <= n - 1;k++){ int pos = i - k; if(pos <= 0) pos = n - abs(pos); b[i][k] = min(b[i][k - 1],a[pos]); } } for(int k = 0;k <= n - 1;k++){ LL ans = 0; for(int i = 1;i <= n;i++){ ans += b[i][k]; } sum = min(sum,ans + x * k); } cout << sum << endl; }
Main.java:1: error: illegal character: '#' #include<bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include<bits/stdc++.h> ^ Main.java:3: error: class, interface, enum, or record expected typedef long long LL; ^ Main.java:5: error: class, interface, enum, or record expected const int maxn = 2e3 + 5; ^ Main.java:6: error: class, interface, enum, or record expected LL a[maxn]; ^ Main.java:7: error: class, interface, enum, or record expected LL b[maxn][maxn]; ^ Main.java:10: error: not a statement LL x,sum = 1LL << 60LL; ^ Main.java:10: error: not a statement LL x,sum = 1LL << 60LL; ^ Main.java:11: error: not a statement cin >> n >> x; ^ Main.java:12: error: not a statement for(int i = 1;i <= n;i++) cin >> a[i]; ^ Main.java:28: error: not a statement cout << sum << endl; ^ Main.java:8: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) Main.java:10: error: ';' expected LL x,sum = 1LL << 60LL; ^ 13 errors
s412664358
p04006
Java
public static void main(String[] args) { // TODO Auto-generated method stub long x,bal1,bal2,bal3,ans,kk; int n; Scanner in =new Scanner(System.in); n=in.nextInt();x=in.nextLong(); long [] a=new long[n+1000]; for(int i=1;i<=n;i++) { a[i]=in.nextLong(); } ans=0;kk=-1; for(int i=1;i<=n;i++) { bal1=a[i];bal2=0;bal3=a[i]; for(int k=1;k<n;k++) { int pi=((i-k) + n) % n; if(pi==0)pi=n; if(bal1>a[pi] + ((long)k)*x) { bal1=a[pi]+(k)*x;bal2=k;bal3=a[pi]; } } if(bal2>kk)kk=bal2; ans+=bal3; } System.out.println(ans+(kk)*x); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s964139691
p04006
Java
import java.util.Scanner; public class BBBBBBBBBB { public static void main(String[] args) { // TODO Auto-generated method stub long x,bal1,bal2,bal3,ans,kk; int n; Scanner in =new Scanner(System.in); n=in.nextInt();x=in.nextLong(); long [] a=new long[n+1000]; for(int i=1;i<=n;i++) { a[i]=in.nextLong(); } ans=0;kk=-1; for(int i=1;i<=n;i++) { bal1=a[i];bal2=0;bal3=a[i]; for(int k=1;k<n;k++) { int pi=((i-k) + n) % n; if(pi==0)pi=n; if(bal1>a[pi] + ((long)k)*x) { bal1=a[pi]+(k)*x;bal2=k;bal3=a[pi]; } } if(bal2>kk)kk=bal2; ans+=bal3; } System.out.println(ans+(kk)*x); } }
Main.java:3: error: class BBBBBBBBBB is public, should be declared in a file named BBBBBBBBBB.java public class BBBBBBBBBB { ^ 1 error
s767280357
p04006
Java
public class BBBBBBBBBB { public static void main(String[] args) { // TODO Auto-generated method stub long x,bal1,bal2,bal3,ans,kk; int n; Scanner in =new Scanner(System.in); n=in.nextInt();x=in.nextLong(); long [] a=new long[n+1000]; for(int i=1;i<=n;i++) { a[i]=in.nextLong(); } ans=0;kk=-1; for(int i=1;i<=n;i++) { bal1=a[i];bal2=0;bal3=a[i]; for(int k=1;k<n;k++) { int pi=((i-k) + n) % n; if(pi==0)pi=n; if(bal1>a[pi] + ((long)k)*x) { bal1=a[pi]+(k)*x;bal2=k;bal3=a[pi]; } } if(bal2>kk)kk=bal2; ans+=bal3; } System.out.println(ans+(kk)*x); } }
Main.java:1: error: class BBBBBBBBBB is public, should be declared in a file named BBBBBBBBBB.java public class BBBBBBBBBB { ^ Main.java:7: error: cannot find symbol Scanner in =new Scanner(System.in); ^ symbol: class Scanner location: class BBBBBBBBBB Main.java:7: error: cannot find symbol Scanner in =new Scanner(System.in); ^ symbol: class Scanner location: class BBBBBBBBBB 3 errors
s762765996
p04006
C++
#include <bits/stdc++.h> using namespace std; #define lli long long int #define REP(i,s,l) for(lli i=s;i<l;i++) #define DEBUG 0 #define INF (1LL<<50) #define MOD 1000000007 signed main(){ lli n,x; cin>>n>>x; lli a[n],c[n]; lli ans=0; for(lli i=0;i<n;i++){ cin>>a[i]; c[i] = a[i]; ans += a[i]; } for(lli t=1;t<N;t++){ lli cost = t*x; for(lli i=0;i<n;i++){ c[i] = min(c[i],a[(i+n-t)%n]); cost += c[i]; } ans = min(ans,cost); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:23: error: 'N' was not declared in this scope 25 | for(lli t=1;t<N;t++){ | ^
s127586654
p04006
C
#include<stdio.h> long long nn[2000][2000]; int main(){ int n,i,j; long long x,a[2000]; scanf("%d%lld",&n,&x); for(i=0;i<n;i++)scanf("%lld",&a[i]); for(i=0;i<n;i++){ nn[i][i]=a[i]; } for(i=0;i<n;i++){ for(j=0;j<n;j++){ nn[i][j]=nn[i][i]; if(i>j)nn[i][j]+=(n-i+j)*x; else nn[i][j]+=(j-i)*x; } } long long ans=0; for(i=0;i<n;i++){ long long tmp=-1; for(j=0;j<n;j++){ if(tmp==-1)tmp=n[j][i]; if(tmp>nn[j][i])tmp=nn[j][i]; } ans+=tmp; } printf("%lld\n",ans); return 0; }
main.c: In function 'main': main.c:24:57: error: subscripted value is neither array nor pointer nor vector 24 | if(tmp==-1)tmp=n[j][i]; | ^
s991888144
p04006
C++
#include<bits/stdc++.h> #define LL long long using namespace std; int main() { int n,x,a[2005]; while(scanf("%d%d",&n,&x)!=EOF) { LL sum=0;///sum求出若所有数都直接取本身的总花费 int minn=0x7fffffff,mini; for(int i=0;i<n;i++) { scanf("%d",&a[i]); sum+=a[i]; if(a[i]<minn)mini=i,minn=a[i];///找到最小值做遍历起点 } while(true) { LL dis=0; for(int i=0;i<n-1;i++)///多次循环,遍历一圈,当前值大于上一个值说明可以通过挪动优化 { if(a[(mini-i+n-1)%n]>a[(mini-i+n-2)%n]) { dis+=a[(mini-i+n-1)%n]-a[(mini-i+n-2)%n];///求前后两数差和 a[(mini-i+n-1)%n]=a[(mini-i+n-2)%n];///将较大数等于前者较小值,说明该数有上一个值挪动而来 } } if(dis<x)break; sum-=dis-x;///因为每次挪动是对整段序列,因此求差值也就是可优化值是对所有两两差值的求和,也就是差值和对比x可优化值,若大于,继续优化 }///用总费用直接减去差值和,从中剃去挪动费用 printf("%lld\n",sum); } } /* 后者花费ai前者花费a(i-1),单独拿来两者花费是ai+a(i-1), 否则是a(i-1)+a(i-1)+x,因为后者比前者大,所以加和必定 大于a(i-1)+a(i-1),那么两者之差就是ai-a(i-1),也就是单独 拿来的花费减去挪动的花费,这个值如果大于x,那么挪动是划 算的,如果小于x说明这里不需要挪动 我不能仅考虑两两之间的差值是否小于x,因为是整体挪动。。 。如果仅是两两差值小于x,求和大于x,必定还可以优化,因为 我明明可以不是单个移动的,而是整体移动的,那么,你更改成 相同值的一些数就可以看做是一段区间,看做一个单独的数,我 其实是在比较当前这个值,和i-1那个区间的所有相等的值
a.cc:34:1: error: unterminated comment 34 | /* | ^
s039440366
p04006
C++
#include <bits/stdc++.h> #define fi first #define se second #define ll long long //priority_queue<int, vector<int>, greater<int> > pq; #define _CRT_SECURE_NO_DEPRECATE const int N = 33003; #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) const ll mod = 1e9+7; using namespace std; //ll n,s; multiset<long long> m; int main(){ ll n; ll x; cin>>n>>x; ans=1e18; ll a[n]; rep(i,0,n) cin>>a[i]; rep(i,0,n) { ll y=i*x; m.clear(); rep(j,0,i+1) m.insert(a[j]); rep(j,0,n) { y+=*m.begin(); m.erase(m.find(a[j])); m.insert(a[(i+j+1)%n]); } ans=min(ans,y); } cout<<ans; }
a.cc: In function 'int main()': a.cc:17:1: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | ans=1e18; | ^~~ | abs
s973233209
p04006
C++
#include <bits/stdc++.h> //#include <rng_58> //#include <chokudai> //#include <tourist> using namespace std; // Macro and Macro Functions #define rep(a, b) for(int a = 0; a < b; ++a) #define REP(a, b, c) for(int a = b; a < c; ++a) #define drep(a, b, c) for(int a=0,b=0;b<c?:(b=0,++a<c);++b) #define int long long #define SORT(a) sort(ALL(a)) #define RSORT(a) sort(RALL(a)) #define REVERSE(a) reverse(ALL(a)) #define MOD 1000000007 #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define ALLIN(a) rep(nanika,a.size()) cin>>a[nanika] #define ALLINDE(a) rep(kyawa,a.size()){cin>>a[kyawa]; --a[kyawa];} #define YN(a) do{if(a) cout<<"YES"; else cout<<"NO";}while(0) #define Yn(a) do{if(a) cout<<"Yes"; else cout<<"No";}while(0) #define yn(a) do{if(a) cout<<"yes"; else cout<<"no";}while(0) #define spa " " #define dspa " " #define ctoi(c) (c)-'0' #define altoi(a) (a)-'a' #define fi first #define se second #define dvec_int(name,row,column,value) vector<vector<int>> name(row,vector<int>(column,value)) // List of using using ll = signed long long; using ull = unsigned long long; using pint = pair<int, int>; using pong = pair<long, long>; using tint = tuple<int, int, int>; using tong = tuple<long, long, long>; using vint = vector<int>; using vll = vector<long long>; using vbol = vector<bool>; using vstr = vector<string>; using vull = vector<unsigned long long>; using dvin = vector<vector<int>>; using dvbo = vector<vector<bool>>; using mint = map<int,int>; // Common Variable bool DEBUG=false; long long INF=2000000000; void print(){ cout<<'\n'; } template<class HEAD,class... TAIL> void print(HEAD&& head,TAIL&&... tail){ cout<<head<<spa; print(forward<TAIL>(tail)...); } void scan(){} template<class HEAD,class... TAIL> void scan(HEAD&& head,TAIL&&... tail){ cin>>head; scan(forward<TAIL>(tail)...); } template<typename t> void print(vector<t> &v){ rep(i,v.size()){ cout<<v[i]<<spa; } cout<<endl; } template<typename t, typename u> void print(vector<pair<t,u>> &v){ rep(i,v.size()){ cout<<i<<" : "<<v[i].first<<" "<<v[i].second<<endl; } } template<typename t,typename u> t min(t a,u b){ return a<=b?a:b; } //-------------------------------- // Template Place //-------------------------------- int dx[]={ 1, 0,-1, 0}; int dy[]={ 0,-1, 0, 1}; signed main(){ int n,x; cin>>n>>x; vint a(n); ALLIN(a); //dvec_int(dp,n,n,0); vector<vector<int>> dp(n,vector<int>(n,0)); int ans=0,ans_i=0; for(int j=0; j<n; ++j){ dp[0][j]=a[j]; ans+=a[j]; } for(int i=1; i<n; ++i){ int tmp=0; for(int j=0; j<n; ++j){ dp[i][j]=min(dp[i-1][j],a[(j-i+n)%n]); tmp+=dp[i][j]; } // print(i,":",tmp,"+",i*x,"=",tmp+i*x,"Minimum :",ans,ans_i); tmp+=i*x; if(ans>tmp){ ans=tmp; ans_i=i; } } // rep(i,n){ // rep(j,n){ // cout<<setw(4)<<dp[i][j]; // } // cout<<endl; // } cout<<ans; }#include <bits/stdc++.h> //#include <rng_58> //#include <chokudai> //#include <tourist> using namespace std; // Macro and Macro Functions #define rep(a, b) for(int a = 0; a < b; ++a) #define REP(a, b, c) for(int a = b; a < c; ++a) #define drep(a, b, c) for(int a=0,b=0;b<c?:(b=0,++a<c);++b) #define int long long #define SORT(a) sort(ALL(a)) #define RSORT(a) sort(RALL(a)) #define REVERSE(a) reverse(ALL(a)) #define MOD 1000000007 #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define ALLIN(a) rep(nanika,a.size()) cin>>a[nanika] #define ALLINDE(a) rep(kyawa,a.size()){cin>>a[kyawa]; --a[kyawa];} #define YN(a) do{if(a) cout<<"YES"; else cout<<"NO";}while(0) #define Yn(a) do{if(a) cout<<"Yes"; else cout<<"No";}while(0) #define yn(a) do{if(a) cout<<"yes"; else cout<<"no";}while(0) #define spa " " #define dspa " " #define ctoi(c) (c)-'0' #define altoi(a) (a)-'a' #define fi first #define se second #define dvec_int(name,row,column,value) vector<vector<int>> name(row,vector<int>(column,value)) // List of using using ll = signed long long; using ull = unsigned long long; using pint = pair<int, int>; using pong = pair<long, long>; using tint = tuple<int, int, int>; using tong = tuple<long, long, long>; using vint = vector<int>; using vll = vector<long long>; using vbol = vector<bool>; using vstr = vector<string>; using vull = vector<unsigned long long>; using dvin = vector<vector<int>>; using dvbo = vector<vector<bool>>; using mint = map<int,int>; // Common Variable bool DEBUG=false; long long INF=2000000000; void print(){ cout<<'\n'; } template<class HEAD,class... TAIL> void print(HEAD&& head,TAIL&&... tail){ cout<<head<<spa; print(forward<TAIL>(tail)...); } void scan(){} template<class HEAD,class... TAIL> void scan(HEAD&& head,TAIL&&... tail){ cin>>head; scan(forward<TAIL>(tail)...); } template<typename t> void print(vector<t> &v){ rep(i,v.size()){ cout<<v[i]<<spa; } cout<<endl; } template<typename t, typename u> void print(vector<pair<t,u>> &v){ rep(i,v.size()){ cout<<i<<" : "<<v[i].first<<" "<<v[i].second<<endl; } } template<typename t,typename u> t min(t a,u b){ return a<=b?a:b; } //-------------------------------- // Template Place //-------------------------------- int dx[]={ 1, 0,-1, 0}; int dy[]={ 0,-1, 0, 1}; signed main(){ int n,x; cin>>n>>x; vint a(n); ALLIN(a); //dvec_int(dp,n,n,0); vector<vector<int>> dp(n,vector<int>(n,0)); int ans=0,ans_i=0; for(int j=0; j<n; ++j){ dp[0][j]=a[j]; ans+=a[j]; } for(int i=1; i<n; ++i){ int tmp=0; for(int j=0; j<n; ++j){ dp[i][j]=min(dp[i-1][j],a[(j-i+n)%n]); tmp+=dp[i][j]; } // print(i,":",tmp,"+",i*x,"=",tmp+i*x,"Minimum :",ans,ans_i); tmp+=i*x; if(ans>tmp){ ans=tmp; ans_i=i; } } // rep(i,n){ // rep(j,n){ // cout<<setw(4)<<dp[i][j]; // } // cout<<endl; // } cout<<ans; }
a.cc:128:2: error: stray '#' in program 128 | }#include <bits/stdc++.h> | ^ a.cc:128:3: error: 'include' does not name a type 128 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:175:6: error: redefinition of 'bool DEBUG' 175 | bool DEBUG=false; | ^~~~~ a.cc:48:6: note: 'bool DEBUG' previously defined here 48 | bool DEBUG=false; | ^~~~~ a.cc:176:11: error: redefinition of 'long long int INF' 176 | long long INF=2000000000; | ^~~ a.cc:49:11: note: 'long long int INF' previously defined here 49 | long long INF=2000000000; | ^~~ a.cc:178:6: error: redefinition of 'void print()' 178 | void print(){ | ^~~~~ a.cc:51:6: note: 'void print()' previously defined here 51 | void print(){ | ^~~~~ a.cc:183:6: error: redefinition of 'template<class HEAD, class ... TAIL> void print(HEAD&&, TAIL&& ...)' 183 | void print(HEAD&& head,TAIL&&... tail){ | ^~~~~ a.cc:56:6: note: 'template<class HEAD, class ... TAIL> void print(HEAD&&, TAIL&& ...)' previously declared here 56 | void print(HEAD&& head,TAIL&&... tail){ | ^~~~~ a.cc:188:6: error: redefinition of 'void scan()' 188 | void scan(){} | ^~~~ a.cc:61:6: note: 'void scan()' previously defined here 61 | void scan(){} | ^~~~ a.cc:191:6: error: redefinition of 'template<class HEAD, class ... TAIL> void scan(HEAD&&, TAIL&& ...)' 191 | void scan(HEAD&& head,TAIL&&... tail){ | ^~~~ a.cc:64:6: note: 'template<class HEAD, class ... TAIL> void scan(HEAD&&, TAIL&& ...)' previously declared here 64 | void scan(HEAD&& head,TAIL&&... tail){ | ^~~~ a.cc:197:6: error: redefinition of 'template<class t> void print(std::vector<_Tp>&)' 197 | void print(vector<t> &v){ | ^~~~~ a.cc:70:6: note: 'template<class t> void print(std::vector<_Tp>&)' previously declared here 70 | void print(vector<t> &v){ | ^~~~~ a.cc:205:6: error: redefinition of 'template<class t, class u> void print(std::vector<std::pair<_T1, _T2> >&)' 205 | void print(vector<pair<t,u>> &v){ | ^~~~~ a.cc:78:6: note: 'template<class t, class u> void print(std::vector<std::pair<_T1, _T2> >&)' previously declared here 78 | void print(vector<pair<t,u>> &v){ | ^~~~~ a.cc:212:3: error: redefinition of 'template<class t, class u> t min(t, u)' 212 | t min(t a,u b){ | ^~~ a.cc:85:3: note: 'template<class t, class u> t min(t, u)' previously declared here 85 | t min(t a,u b){ | ^~~ a.cc:219:5: error: redefinition of 'long long int dx []' 219 | int dx[]={ 1, 0,-1, 0}; | ^~ a.cc:92:5: note: 'long long int dx [4]' previously defined here 92 | int dx[]={ 1, 0,-1, 0}; | ^~ a.cc:220:5: error: redefinition of 'long long int dy []' 220 | int dy[]={ 0,-1, 0, 1}; | ^~ a.cc:93:5: note: 'long long int dy [4]' previously defined here 93 | int dy[]={ 0,-1, 0, 1}; | ^~ a.cc:222:8: error: redefinition of 'int main()' 222 | signed main(){ | ^~~~ a.cc:95:8: note: 'int main()' previously defined here 95 | signed main(){ | ^~~~
s263187488
p04006
C++
#include "bits/stdc++.h" using namespace std; #define Rep(i,n) for(int i=0;i<(int)(n);i++) #define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++) #define REP(i,n) for(ll i=0;i<(ll)(n);i++) #define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--) #define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++) #define put(a) cout<<a<<"\n" #define all(a) (a).begin(),(a).end() #define SORT(a) sort((a).begin(),(a).end()) #define oorret 0 #define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}() typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> P; template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;} template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;} inline template<typename T> T up(const T& l, const T& r) {//SegmentTreeのupdate関数 T res; res = min<T>(l,r); return res; } inline template<typename T> class SegmentTree { public: vector<T> seg; int sz = 1; T unit; //T (*up)(const T& l,const T& r); SegmentTree(int n, T unit = 0) { this->unit = unit; //int sz = 1; while (sz < n) sz <<= 1; seg.resize(sz * 2, unit); //up = &up1; } void set(const int& k, const T& x) {//左からk番目の葉にxを代入する seg[sz - 1 + k] = x; } T get(const int& k) {//左からk番目の葉を得る return seg[sz - 1 + k]; } void update(int k, const T& v) {// k 番目の値をvに変更 k += sz - 1; seg[k] = v; while (k > 0) { k = (k - 1) / 2; seg[k] = up(seg[2 * k + 1], seg[2 * k + 2]); } } T query(int a, int b, int k, int l,int r) {//[a,b)のupの合成を求める(a,b,0,0,sz)のように使う if (r <= a || b <= l) { return unit; } if (a <= l && r <= b) { return seg[k]; } else { T vl = query(a, b, k * 2 + 1, l, (l + r) / 2); T vr = query(a, b, k * 2 + 2, (l + r) / 2, r); return up(vl, vr); } } }; int main(){ int n; ll x; cin >> n >> x; vector<ll> a(n*2); REP(i,n){ cin >> a[i]; a[i+n] = a[i]; } SegmentTree<ll> sg(n*2,LLONG_MAX); Rep(i,n){ sg.update(i,a[i]); sg.update(i+n,a[i+n]); } ll res = LLONG_MAX; Rep(k,n){ ll cost = k*x; int sz = sg.sz; Rep(j,n){ if(j-k<0){ cost+=sg.query(j-k+n,j+1+n,0,0,sz); }else{ cost+=sg.query(j-k,j+1,0,0,sz); } } chmin(res,cost); } put(res); return 0; }
a.cc:19:16: error: expected unqualified-id before '<' token 19 | inline template<typename T> | ^ a.cc:24:2: error: expected ';' before 'inline' 24 | } | ^ | ; 25 | 26 | inline template<typename T> | ~~~~~~ a.cc: In function 'int main()': a.cc:78:5: error: 'SegmentTree' was not declared in this scope 78 | SegmentTree<ll> sg(n*2,LLONG_MAX); | ^~~~~~~~~~~ a.cc:78:19: error: expected primary-expression before '>' token 78 | SegmentTree<ll> sg(n*2,LLONG_MAX); | ^ a.cc:78:21: error: 'sg' was not declared in this scope 78 | SegmentTree<ll> sg(n*2,LLONG_MAX); | ^~
s873452297
p04006
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x;cin>>n>>x; vector<int> a(n),b(n); for(int i=0;i<n;i++){int x ;cin>>x;a[i]=b[i]=x;} int num=0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(a[(i+j)%n]>a[i%n]+j*x;){ a[(i+j)%n]=a[i%n]+x; b[(i+j)%n]=b[i%n]; num=j;} }} int ans=accumulate(begin(b),end(b),0); cout<<ans+num*x<<endl; }
a.cc: In function 'int main()': a.cc:11:34: error: expected primary-expression before ')' token 11 | if(a[(i+j)%n]>a[i%n]+j*x;){ | ^
s026587006
p04006
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x;cin>>n>>x; vector<int> a(n); for(auto&& w:a)cin>>w; int num=0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(a[(i+j)%n]<a[i%n]+j*x;){ a[(i+j)%n]=a[i%n]; num=j;} }} int ans=accumulate(begin(a),end(a),0); cout<<ans+num*x<<endl; }
a.cc: In function 'int main()': a.cc:11:34: error: expected primary-expression before ')' token 11 | if(a[(i+j)%n]<a[i%n]+j*x;){ | ^
s183746174
p04006
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x;cin>>n>>x; vector<int> a(n); for(auto&& w:a)cin>>w; for(int i=0;<2*n;i++){ a[(i+1)%n]=min(a[(i+1)%n],a[i%n]+x); } int ans=accumulate(begin(a),end(a),0); cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:13: error: expected primary-expression before '<' token 9 | for(int i=0;<2*n;i++){ | ^
s510610500
p04006
C++
#include <queue> #include <iostream> #include <cmath> #include <cstdlib> #include <algorithm> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <map> #include <stdio.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define FOR(i, a, b) for(int i = (a); i < (int)(b); i++) typedef long long ll; typedef unsigned long long ull; typedef vector<ll> vint; typedef vector<string> vstr; typedef pair<ll, ll> pint; unsigned long long inf = (1LL << 62); ll mod = 998244353; pint dx[4] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1}}; ll N, x; vector<ll> a; ll vis[2000]; int main() { cin >> N >> x; a.resize(N); ll mi = inf; rep(i, N) { cin >> a[i]; mi = min(a[i], mi); } ll sum = 0; rep(i, N) { if (a[i] == mi) { sum += mi; vis[i] = 1; } } bool flag = true; ll index = 0; vector<ll> q; while (flag == true) { flag = false; for (index = 0; index < N; index++) { if (index > 0 && vis[index] == 0 && vis[index - 1] == 1) { q.push_back(index); flag = true; } else if (index == 0 && vis[index] == 0 && vis[N - 1] == 1) { q.push_back(index); flag = true; } } ll s = 0; rep(i, q.size()) { s += a[q[i]]; vis[q[i]] = 1; } sum += min(s, x + mi * q.size()); while (!q.empty()) { q.pop_back(); } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:76:27: error: no matching function for call to 'min(ll&, long long unsigned int)' 76 | sum += min(s, x + mi * q.size()); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/deque:62, from /usr/include/c++/14/queue:62, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:76:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 76 | sum += min(s, x + mi * q.size()); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:76:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 76 | sum += min(s, x + mi * q.size()); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s290022223
p04006
C++
#include <algorithm> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string> #include <string.h> #include <unordered_map> #include <unordered_set> #include <vector> #define rep(i,n) for(int i=0;i<n;i++) #define eps LDBL_EPSILON #define moder 1000000007 #define int long long #define ll long long #define double long double #define INF LLONG_MAX/3 #define P pair<int,int> #define prique priority_queue<int,vector<int>,greater<int>> using namespace std; int n, x, a[2010]; int dp[2010][2010]; signed main() { cin >> n >> x; rep(i, n) { cin >> a[i]; dp[0][i] = a[i]; } for (int i = 1; i < n; i++) { rep(j, n) { dp[i][j] = min(dp[i - 1][j], a[(j - i + n) % n]); } } int ans = INF; rep(i, n) { int cnt = i*x; rep(j, n) { cnt += dp[i][j]; } ans = min(ans, cnt); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:13: error: 'LLONG_MAX' was not declared in this scope 21 | #define INF LLONG_MAX/3 | ^~~~~~~~~ a.cc:38:19: note: in expansion of macro 'INF' 38 | int ans = INF; | ^~~ a.cc:14:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 13 | #include <unordered_set> +++ |+#include <climits> 14 | #include <vector>
s602827419
p04006
C++
// https://atcoder.jp/contests/agc004/tasks/agc004_b #include <algorithm> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <set> #include <tuple> #include <vector> using namespace std; typedef long long ll; #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, x, ans = 0; cin >> n >> x; vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } // N色を集めるため、捕獲して色変化に必要な時間を求める。 // ただし、色変化にX秒かかるため一定以上離れた色は対象外とする。 for (int i = 0; i < n; i++) { ll minv = INT_MAX; int mov = 0; // 右側へN-1回分を変化させて最小値を求める。 for (int j = i; i < n && mov * x < minv; j++) { minv = min(minv, a[j] + (mov++) * x); } for (int j = 0; i <= i - 1 && mov * x < minv; j++) { minv = min(minv, a[j] + (mov++) * x); if (mov * x >= minv) { break; } } // 左側へN-1回分を変化させて最小値を求める。 mov = 0; for(int j = i; j >= 0 && mov * x < minv; j--) { minv = min(minv, a[j] + (mov++) * x); } for(int j = n - 1; j >= i + 1 && mov * x < minv; j--) { minv = min(minv, a[j] + (mov++) * x); } ans += minv; } cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:29:19: error: 'INT_MAX' was not declared in this scope 29 | ll minv = INT_MAX; | ^~~~~~~ a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 10 | #include <vector> +++ |+#include <climits> 11 | using namespace std;
s805375598
p04006
C++
#include <iostream> #include <vector> #include <algorithm> int main (void) { int N = 0 long long x = 0; std::cin >> N >> x; long long A = 0; std::vector<long long> a; while(std::cin >> A) { a.push_back(A); } std::vector<long long> cost; long long temp = 0; //magic k:0 ~ N-1 for(int k = 0; k < N; k++) { //calculate cost : 1 ~ N for(int i = 0; i < N; i++) { temp = k * x + a[(N - 1 + i - k) % N]; if(k == 0) {cost.push_back(temp);} cost[i] = std::min(temp, cost[i]); } } long long result = 0; for(auto ite = cost.begin(); ite != cost.end(); ite++) { result = result + *ite; } std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:7:3: error: expected ',' or ';' before 'long' 7 | long long x = 0; | ^~~~ a.cc:8:20: error: 'x' was not declared in this scope 8 | std::cin >> N >> x; | ^
s393688618
p04006
C++
#include <stdio.h> #include <string.h> #include <string> #include <vector> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;i++) #define rep(i,n) for(ll i=0;i<n;i++) #define vecll vector<ll> using namespace std; int in() {int x;scanf("%d",&x);return x;} ll lin() {ll x;scanf("%lld",&x);return x;} int main(){ int n=in(); ll x=lin(); vecll a(n); rep(i,n)a[i]=in(); vector<vector<ll>> b(n,vector<ll>(n)); rep(i,n){ b[i][0]=a[i]; rep2(j,1,n-1) b[i][j]=min(b[i][j-1],a[(i-j+n)%n]); } ll ans=LONG_MAX; rep(k,n){ ll tmp=x*k; rep(i,n) tmp+=b[i][k]; ans=min(ans,tmp); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:12: error: 'LONG_MAX' was not declared in this scope 22 | ll ans=LONG_MAX; | ^~~~~~~~ a.cc:5:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <vector> +++ |+#include <climits> 5 | #define ll long long a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout<<ans<<endl; | ^~~~ a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include <vector> +++ |+#include <iostream> 5 | #define ll long long a.cc:28:16: error: 'endl' was not declared in this scope 28 | cout<<ans<<endl; | ^~~~ a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 4 | #include <vector> +++ |+#include <ostream> 5 | #define ll long long
s048036339
p04006
C++
#include <bits/stdc++.h> const int INF = 1e9; const int MOD = 1e9+7; const long long LINF = 1e18; #define dump(x) cout << 'x' << ' = ' << (x) << ` `; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) for(int i=0;i<(n);++i) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOREACH(x,a) for(auto& (x) : (a) ) typedef long long ll; using namespace std; int main(int argc, char const *argv[]) { ll n, x; cin >> n >> x; vector<ll> a(n); REP(i,n) cin >> a[i]; ll ans = 0; sort(a.begin(), a.end()); ll minimun = a[0]; ans += minimum; for(int i = 1; i < n; ++i) { ans += min(minimun+x, a[i]); } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:20:12: error: 'minimum' was not declared in this scope; did you mean 'minimun'? 20 | ans += minimum; | ^~~~~~~ | minimun
s627929329
p04006
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, x, i, m = 0, f = 0; long long s = 0; cin >> n >> x; int a[n], c[n] = {}; for(i=0; i<n; i++){ cin >> a[i]; } while(f == 0){ f = 1; for(i=0; i<n; i++){#include <bits/stdc++.h> using namespace std; int main(){ int n, x, i, m = 0, f = 0; long long s = 0; cin >> n >> x; int a[n], c[n] = {}; for(i=0; i<n; i++){ cin >> a[i]; } while(f == 0){ f = 1; for(i=0; i<n; i++){ if(i == 0){ if(a[0] > a[n-1] + x){ a[0] = a[n-1] + x; c[0] = c[n-1] + 1; m = max(m, c[0]); f = 0; } }else{ if(a[i] > a[i-1] + x){ a[i] = a[i-1] + x; c[i] = c[i-1] + 1; m = max(m, c[i]); f = 0; } } } } s += (long long)m*(long long)x; for(i=0; i<n; i++){ if(i-c[i] < 0){ s += (long long)a[n+i-c[i]]; }else{ s += (long long)a[i-c[i]]; } } cout << s; return 0; } if(i == 0){ if(a[0] > a[n-1] + x){ a[0] = a[n-1] + x; c[0] = c[n-1] + 1; m = max(m, c[0]); f = 0; } }else{ if(a[i] > a[i-1] + x){ a[i] = a[i-1] + x; c[i] = c[i-1] + 1; m = max(m, c[i]); f = 0; } } } } s += (long long)m*(long long)x; for(i=0; i<n; i++){ if(i-c[i] < 0){ s += (long long)a[n-1+i-c[i]]; }else{ s += (long long)a[i-c[i]]; } } cout << s; return 0; }
a.cc:14:28: error: stray '#' in program 14 | for(i=0; i<n; i++){#include <bits/stdc++.h> | ^ a.cc: In function 'int main()': a.cc:14:29: error: 'include' was not declared in this scope 14 | for(i=0; i<n; i++){#include <bits/stdc++.h> | ^~~~~~~ a.cc:14:38: error: 'bits' was not declared in this scope 14 | for(i=0; i<n; i++){#include <bits/stdc++.h> | ^~~~ a.cc:14:43: error: 'stdc' was not declared in this scope; did you mean 'std'? 14 | for(i=0; i<n; i++){#include <bits/stdc++.h> | ^~~~ | std a.cc:15:1: error: expected primary-expression before 'using' 15 | using namespace std; | ^~~~~ a.cc:17:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 17 | int main(){ | ^~ a.cc:17:9: note: remove parentheses to default-initialize a variable 17 | int main(){ | ^~ | -- a.cc:17:9: note: or replace parentheses with braces to value-initialize a variable a.cc:17:11: error: a function-definition is not allowed here before '{' token 17 | int main(){ | ^
s094711481
p04006
C++
/*#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <array> #include <vector> #include <deque> #include <set> #include <map> #include <string> #include <stack> #include <queue> #include <unordered_map> #include <unordered_set> */ #include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mp make_pair #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define REP(i,n) FOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define SORT(c) sort((c).begin(),(c).end()) typedef long long ll; const ll INF = LLONG_MAX - 100; const ll mod = 2e9 + 7; const int MAX_N = 5e5 + 5; int dx[] = { -(ll)1,0,(ll)1,0 }, dy[] = { 0,(ll)1,0,-(ll)1 }; vector<ll> prime; ll inv[MAX_N], fac[MAX_N]; template <class T = ll> T in() { T x; cin >> x; return (x); } inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; } inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); } inline ll POW(ll a, ll b) { ll c = (ll)1; while (b > 0) { if (b & (ll)1) { c = a * c%mod; }a = a * a%mod; b >>= (ll)1; }return c; } inline void _nCr() { fac[0] = (ll)1; for (int i = (ll)1; i < MAX_N; i++) { fac[i] = fac[i - (ll)1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } } inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; } inline void PRI(ll n) { bool a[n + (ll)1]; for (int i = 0; i < n + (ll)1; i++) { a[i] = (ll)1; }for (int i = 2; i < n + (ll)1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } } typedef pair<int, pair<int, int>> edge; class UnionFind { private: vector<int> par; public: UnionFind(int N) { par = vector<int>(N, -(ll)1); } int find(int x); ll size(int x); void unite(int x, int y); bool same(int x, int y); }; class Kruskal { private: UnionFind *uf; vector<edge> e; public: vector<edge> mst; Kruskal(int N) { uf = new UnionFind(N); } void add(int x, int y, ll z); void run(); }; //----UnionFind------------------------------- int UnionFind::find(int x) { if (par[x] < 0) return x; else return par[x] = find(par[x]); } ll UnionFind::size(int x) { return -par[find(x)]; } void UnionFind::unite(int x, int y) { x = find(x); y = find(y); //大きい方に小さい方をくっ付ける if (size(x) < size(y)) swap(x, y); par[x] += par[y]; par[y] = x; } bool UnionFind::same(int x, int y) { x = find(x); y = find(y); return x == y; } //----Kruskal------------------------------- void Kruskal::add(int x, int y, ll z) { //x < y if (x > y) swap(x, y); e.push_back({ z,{x,y} }); } void Kruskal::run() { sort(e.begin(), e.end()); e.erase(unique(e.begin(), e.end()), e.end()); for (auto x : e) { if (uf->same(x.second.first, x.second.second)) { continue; } else { mst.push_back(x); uf->unite(x.second.first, x.second.second); } } } signed main() { ll n,x; cin >> n >> x; ll a[n]; ll ans = INF; REP (i,n) {cin >> a[i];b[i] = a[i];} REP (i,n) { ll geta = i * x; REP (j,n) b[j] = min(b[j],a[(j - i + n) % n]); REP (j,n) geta += b[j]; ans = min(geta, ans); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:130:32: error: 'b' was not declared in this scope 130 | REP (i,n) {cin >> a[i];b[i] = a[i];} | ^ a.cc:133:27: error: 'b' was not declared in this scope 133 | REP (j,n) b[j] = min(b[j],a[(j - i + n) % n]); | ^ a.cc:134:35: error: 'b' was not declared in this scope 134 | REP (j,n) geta += b[j]; | ^
s317397490
p04006
C++
#include <bits/stdc++.h> using namespace std; int a[2010]; int main(){ int i,j,n,mn,mi; long long x,ans=0; scanf("%d%lld",&n,&x); for(i=1;i<=n;++i){ for(j=1,mn=2e9;j<=n;++j)if(a[j]>0&&mn>a[j])mn=a[j],mi=j; ans+=mn; for(j=1;j<=n;++j)a[j]=min(a[j],mn+(j-mi+n)%n*x); a[mi]=-1; } printf("%lld",ans); return 0; }
a.cc: In function 'int main()': a.cc:11:30: error: no matching function for call to 'min(int&, long long int)' 11 | for(j=1;j<=n;++j)a[j]=min(a[j],mn+(j-mi+n)%n*x); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:11:30: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 11 | for(j=1;j<=n;++j)a[j]=min(a[j],mn+(j-mi+n)%n*x); | ~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:11:30: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 11 | for(j=1;j<=n;++j)a[j]=min(a[j],mn+(j-mi+n)%n*x); | ~~~^~~~~~~~~~~~~~~~~~~~~~
s033203315
p04006
C++
#pragma once #include <sstream> #include <string> #include <vector> #include <map> #include <algorithm> #include <iostream> #include <utility> #include <set> #include <cctype> #include <queue> #include <stack> #include <cstdio> #include <cstdlib> #include <cmath> #include <deque> #include <numeric> #include <iomanip> #define M_PI acos(-1) using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1000000007; const int MAX_V = 201; int now = 0; const int MAX = 200000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } struct edge { int t; ll cost; edge(int _t, ll _cost) : t(_t) , cost(_cost) { } }; bool isPrime(int n) { if (n == 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } void Solve() { int n; ll x; cin >> n >> x; ll a[2010]; for (size_t i = 0; i < n; i++) { cin >> a[i]; } ll res = 0; ll aval = 0; for (size_t i = 0; i < n; i++) { ll val = a[i]; int iv = i + n; int in = i; for (size_t j = 0; j < n; j++) { if (i == j) continue; ll tv; if (j < i) { tv = min((i - j) * x + a[j], val); } else { tv = min((iv - j) * x + a[j], val); } if (tv < val) { in = j; val = tv; } } aval += a[in]; res = max(val - a[in],res); } cout << (res + aval) << endl; } int main() { Solve(); return 0; }
a.cc:1:9: warning: #pragma once in main file 1 | #pragma once | ^~~~ a.cc:19:9: warning: "M_PI" redefined 19 | #define M_PI acos(-1) | ^~~~ In file included from /usr/include/c++/14/cmath:47, from a.cc:15: /usr/include/math.h:1121:10: note: this is the location of the previous definition 1121 | # define M_PI 3.14159265358979323846 /* pi */ | ^~~~ a.cc: In function 'void Solve()': a.cc:88:41: error: no matching function for call to 'min(long long unsigned int, ll&)' 88 | tv = min((i - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/istream:40, from /usr/include/c++/14/sstream:40, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:88:41: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'll' {aka 'long long int'}) 88 | tv = min((i - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:6: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:88:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 88 | tv = min((i - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:91:41: error: no matching function for call to 'min(long long unsigned int, ll&)' 91 | tv = min((iv - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:91:41: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'll' {aka 'long long int'}) 91 | tv = min((iv - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:91:41: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int' 91 | tv = min((iv - j) * x + a[j], val); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
s336699491
p04006
C++
#include <bits/stdc++.h> using namespace std; #define dump(a) cout << (a) << '\n'; typedef int64_t Int; Int mod = 1e9+7; // Int MOD = 998244353; int main() { ios::sync_with_stdio(false); Int n, x; cin >> n >> x; vector<Int> a(n); for (Int i = 0; i < n; i++) cin >> a[i]; vector<Int> cost = a; vector<Int> cnt(n, 1); Int rotate = 0; for (Int i = 0; i < n; i++) { for (Int j = 1; j < n; j++) { if (cost[(i + j) % n] > a[i] + x * j) { cost[(i + j) % n] = a[i] + x * j; rotate = max(rotate, j); cnt[i]++; cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); } } } Int res = rotate * x; for (Int i = 0; i < n; i++) { res += cnt[i] * a[i]; } dump(res); return 0; }
a.cc: In function 'int main()': a.cc:23:39: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:23:39: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'}) 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:23:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s663271460
p04006
C++
#include <bits/stdc++.h> using namespace std; #define dump(a) cout << (a) << '\n'; typedef int64_t Int; Int mod = 1e9+7; // Int MOD = 998244353; int main() { ios::sync_with_stdio(false); Int n, x; cin >> n >> x; vector<Int> a(n); for (Int i = 0; i < n; i++) cin >> a[i]; vector<Int> cost = a; vector<Int> cnt(n, 1); Int rotate = 0; for (Int i = 0; i < n; i++) { for (Int j = 1; j < n; j++) { if (cost[(i + j) % n] > a[i] + x * j) { cost[(i + j) % n] = a[i] + x * j; rotate = max(rotate, j); cnt[i]++; cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); } } } Int res = rotate * x; for (Int i = 0; i < n; i++) { res += cnt[i] * a[i]; } dump(res); return 0; }
a.cc: In function 'int main()': a.cc:23:43: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)' 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:23:43: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type' {aka 'long int'}) 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:23:43: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | cnt[(i + j) % n] = max(0LL, cnt[(i + j) % n] - 1); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
s802089195
p04006
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int) n; i++) ll n, x; vector<ll> a, mi; ll calc(int pos) { ll res = 0; rep(i, n) mi[i] = min(mi[i], a[(i+pos)%n]); rep(i, n) res+= mi[i]; return res + pos * x; } int main() { cin >> n >> x; rep(i, n) { ll t; cin >> t; a.push_back(t); mi.push_back(t); } ll res = INF; rep(i, n) { res = min(res, calc(i)); } cout << res << endl; }
a.cc: In function 'int main()': a.cc:29:12: error: 'INF' was not declared in this scope 29 | ll res = INF; | ^~~
s383633653
p04006
C++
x
a.cc:1:1: error: 'x' does not name a type 1 | x | ^
s659302733
p04006
C++
#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define mp make_pair using namespace std; const int mnx = 3e5 + 9; const int mod = 1e9 + 7; ll n, x, ans = 1e18; ll a[mnx], b[mnx]; int main(){ cin >> n >> x; for(int i = 0; i < n; i++){ cin >> a[i]; b[i] = a[i]; } for(int i = 0; i <= n; i++){ ll cur = 0; for(int j = 0; j < n; j++){ b[j] = min(b[j], a[(j - i + n) % n]); cur += b[j]; } ans = min(ans, cur + i * x); } cout << ans; return 0; }
a.cc:12:1: error: 'll' does not name a type 12 | ll n, x, ans = 1e18; | ^~ a.cc:13:1: error: 'll' does not name a type 13 | ll a[mnx], b[mnx]; | ^~ a.cc: In function 'int main()': a.cc:17:8: error: 'n' was not declared in this scope; did you mean 'yn'? 17 | cin >> n >> x; | ^ | yn a.cc:17:13: error: 'x' was not declared in this scope 17 | cin >> n >> x; | ^ a.cc:20:12: error: 'a' was not declared in this scope 20 | cin >> a[i]; | ^ a.cc:21:5: error: 'b' was not declared in this scope 21 | b[i] = a[i]; | ^ a.cc:25:5: error: 'll' was not declared in this scope 25 | ll cur = 0; | ^~ a.cc:27:9: error: 'b' was not declared in this scope 27 | b[j] = min(b[j], a[(j - i + n) % n]); | ^ a.cc:27:26: error: 'a' was not declared in this scope 27 | b[j] = min(b[j], a[(j - i + n) % n]); | ^ a.cc:28:9: error: 'cur' was not declared in this scope 28 | cur += b[j]; | ^~~ a.cc:30:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 30 | ans = min(ans, cur + i * x); | ^~~ | abs a.cc:30:20: error: 'cur' was not declared in this scope 30 | ans = min(ans, cur + i * x); | ^~~ a.cc:33:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 33 | cout << ans; | ^~~ | abs