submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s973252111
p03714
C++
#include <iostream> #include <vector> #include <algorithm> #include <vector> #include <queue> #include <stdio.h> #include <functional> #define int long long using namespace std; signed main(){ int n; int max=0; int min=0; cin>> n; int N=3*n; int a[N]; priority_queue<int> PQ1; priority_queue<int, vector<int>, greater<int> >PQ2; int max_arr[n+2]={0}; int min_arr[n+2]={0}; for(int i=0;i<3*n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ max+=a[i]; min+=a[i+2*n]; } // cout<<max<<" "<<min<<endl; max_arr[0]=max; for(int i=0;i<n;i++){ PQ2.push(a[i]); } for(int i=n;i<2*n+1;i++){ PQ2.push(a[i]); max+=a[i]; max-=PQ2.top(); PQ2.pop(); max_arr[i-n+1]=max; } // for(int i=0;i<n+1;i++){ // cout<<max_arr[i]<<" "; // } min_arr[n]=min; for(int i=2*n;i<3*n;i++){ PQ1.push(a[i]); } for(int i=3*n;i>2*n;i--){ // cout<<i-n-1<<endl; PQ1.push(a[i-n-1]); min+=a[i-n-1]; min-=PQ1.top(); // cout<<PQ1.top()<<endl; PQ1.pop(); min_arr[(i-2*n)-1]=min; } // cout<<count<<endl; // for(int i=0;i<n+1;i++){ // cout<<min_arr[i]<<" "; // } // for(int i=0;i<n+1;i++){ // max[i]= // } long long int ans=-1e19; for(int i=0;i<n+1;i++){ if(ans<max_arr[i]-min_arr[i]){ ans=max_arr[i]-min_arr[i]; } // ans=max(ans,); } // cout<<ans<<endl; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:13: error: 'long long long' is too long for GCC 8 | #define int long long | ^~~~ a.cc:82:15: note: in expansion of macro 'int' 82 | long long int ans=-1e19; | ^~~ a.cc:8:18: error: 'long long long' is too long for GCC 8 | #define int long long | ^~~~ a.cc:82:15: note: in expansion of macro 'int' 82 | long long int ans=-1e19; | ^~~ a.cc:82:23: warning: overflow in conversion from 'double' to 'long long int' changes value from '-1.0e+19' to '-9223372036854775808' [-Woverflow] 82 | long long int ans=-1e19; | ^~~~~
s127902552
p03714
C++
#include <iostream> #include <algorithm> #include <numeric> using namespace std; int main() { long long n; cin >> n; vector<long long> a; for(long long i=0; i<3*n; i++) { long long j; cin >> j; a.push_back(j); } for(long long i=0; i<n; i++) { auto left_min = min_element(a.begin(), a.begin()+n+1); auto right_max = max_element(a.end()-n-1, a.end()); long long left_diff = a.at(n) - *left_min; long long right_diff = *right_max - a.at(2*n-i-1); if(left_diff > right_diff) { a.erase(left_min); } else { a.erase(right_max); } } long long left_sum = accumulate(a.begin(), a.begin()+n, 0LL); long long right_sum = accumulate(a.begin()+n, a.end(), 0LL); long long score = left_sum - right_sum; cout << score << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'vector' was not declared in this scope 10 | vector<long long> a; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <numeric> +++ |+#include <vector> 4 | a.cc:10:10: error: expected primary-expression before 'long' 10 | vector<long long> a; | ^~~~ a.cc:14:5: error: 'a' was not declared in this scope 14 | a.push_back(j); | ^ a.cc:17:33: error: 'a' was not declared in this scope 17 | auto left_min = min_element(a.begin(), a.begin()+n+1); | ^ a.cc:27:35: error: 'a' was not declared in this scope 27 | long long left_sum = accumulate(a.begin(), a.begin()+n, 0LL); | ^
s086310368
p03714
C++
#include <iostream> #include <algorithm> #include <numeric> using namespace std; int main() { long long n; cin >> n; vector<long long> a; for(long long i=0; i<3*n; i++) { long long j; cin >> j; a.push_back(j); } for(long long i=0; i<n; i++) { auto left_min = min_element(a.begin(), a.begin()+n+1); auto right_max = max_element(a.end()-n-1, a.end()); long long left_diff = a.at(n) - *left_min; long long right_diff = *right_max - a.at(2*n-i-1); if(left_diff > right_diff) { a.erase(left_min); } else { a.erase(right_max); } } long long left_sum = accumulate(a.begin(), a.begin()+n, 0LL); long long right_sum = accumulate(a.begin()+n, a.end(), 0LL); long long score = left_sum - right_sum; cout << score << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'vector' was not declared in this scope 10 | vector<long long> a; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <numeric> +++ |+#include <vector> 4 | a.cc:10:10: error: expected primary-expression before 'long' 10 | vector<long long> a; | ^~~~ a.cc:14:5: error: 'a' was not declared in this scope 14 | a.push_back(j); | ^ a.cc:17:33: error: 'a' was not declared in this scope 17 | auto left_min = min_element(a.begin(), a.begin()+n+1); | ^ a.cc:27:35: error: 'a' was not declared in this scope 27 | long long left_sum = accumulate(a.begin(), a.begin()+n, 0LL); | ^
s749320178
p03714
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 INF INT_MAX/3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(),(a).end() #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 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 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 printf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second #define sint(x) int x; (void*)scanf("%d",&x); #define sint2(x,y) int x,y; (void*)scanf("%d %d",&x,&y); #define lint(x) long long x; (void*)scanf("%lld",&x); #define vint(v,n) vector<int> v(n); rep(i,n) (void*)scanf("%d", &v[i]); #define vlint(v,n) vector<lint> v(n); rep(i,n) (void*)scanf("%lld", &v[i]); #define sdouble(x) double x; (void*)scanf("%lf",&x); #define vdouble(v,n) vector<double> v(n); rep(i,n) (void*)scanf("%lf", &v[i]); #define schar(x) char x; (void*)scanf(" %c", &x); #define sstring(x) string x; cin >> x; #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <numeric> using namespace std; #include "Main.h" int main(int argc, char** argv) { sint(N); vint(a, 3 * N); int min = -2147483647; rep(i, N + 1) { vector<int> left(N + i), right(2 * N - i), left2(N), right2(N); copy(a.begin(), a.begin() + N + i, left.begin()); sort(all(left)); copy(a.begin() + N + i, a.end(), right.begin()); sort(all(right)); copy(left.begin() + i, left.begin() + i + N, left2.begin()); copy(right.begin(), right.begin() + N, right2.begin()); ll score = accumulate(all(left2), (ll)0) - accumulate(all(right2), (ll)0); if (min < score) { min = score; } } printf("%d\n", min); }
a.cc:65:10: fatal error: Main.h: No such file or directory 65 | #include "Main.h" | ^~~~~~~~ compilation terminated.
s876402308
p03714
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 INF INT_MAX/3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(),(a).end() #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 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 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 printf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second #define sint(x) int x; scanf("%d",&x); #define sint2(x,y) int x,y; scanf("%d %d",&x,&y); #define lint(x) long long x; scanf("%lld",&x); #define vint(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]); #define vlint(v,n) vector<lint> v(n); rep(i,n) scanf("%lld", &v[i]); #define sdouble(x) double x; scanf("%lf",&x); #define vdouble(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]); #define schar(x) char x; scanf(" %c", &x); #define sstring(x) string x; cin >> x; #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <numeric> #include <cstdint> #include <limits> using namespace std; int main(int argc, char** argv) { sint(N); vint(a, 3 * N); int min = INT_MIN; rep(i, N + 1) { vector<int> left(N + i), right(2 * N - i), left2(N), right2(N); copy(a.begin(), a.begin() + N + i, left.begin()); sort(all(left)); copy(a.begin() + N + i, a.end(), right.begin()); sort(all(right)); copy(left.begin() + i, left.begin() + i + N, left2.begin()); copy(right.begin(), right.begin() + N, right2.begin()); int score = accumulate(all(left2), 0) - accumulate(all(right2), 0); if (min < score) { min = score; } } printf("%d\n", min); }
a.cc: In function 'int main(int, char**)': a.cc:70:19: error: 'INT_MIN' was not declared in this scope 70 | int min = INT_MIN; | ^~~~~~~ a.cc:64:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 63 | #include <limits> +++ |+#include <climits> 64 | using namespace std;
s279138618
p03714
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 INF INT_MAX/3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(),(a).end() #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 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 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 printf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second #define sint(x) int x; scanf("%d",&x); #define sint2(x,y) int x,y; scanf("%d %d",&x,&y); #define lint(x) long long x; scanf("%lld",&x); #define vint(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]); #define vlint(v,n) vector<lint> v(n); rep(i,n) scanf("%lld", &v[i]); #define sdouble(x) double x; scanf("%lf",&x); #define vdouble(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]); #define schar(x) char x; scanf(" %c", &x); #define sstring(x) string x; cin >> x; #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <numeric> #include <cstdint> #include <limits> using namespace std; #include "Main.h" int main(int argc, char** argv) { sint(N); vint(a, 3 * N); int min = INT_MIN; rep(i, N + 1) { vector<int> left(N + i), right(2 * N - i), left2(N), right2(N); copy(a.begin(), a.begin() + N + i, left.begin()); sort(all(left)); copy(a.begin() + N + i, a.end(), right.begin()); sort(all(right)); copy(left.begin() + i, left.begin() + i + N, left2.begin()); copy(right.begin(), right.begin() + N, right2.begin()); int score = accumulate(all(left2), 0) - accumulate(all(right2), 0); if (min < score) { min = score; } } printf("%d\n", min); }
a.cc:67:10: fatal error: Main.h: No such file or directory 67 | #include "Main.h" | ^~~~~~~~ compilation terminated.
s671698600
p03714
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 INF INT_MAX/3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(),(a).end() #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 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 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 printf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SEC second #define sint(x) int x; scanf("%d",&x); #define sint2(x,y) int x,y; scanf("%d %d",&x,&y); #define lint(x) long long x; scanf("%lld",&x); #define vint(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]); #define vlint(v,n) vector<lint> v(n); rep(i,n) scanf("%lld", &v[i]); #define sdouble(x) double x; scanf("%lf",&x); #define vdouble(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]); #define schar(x) char x; scanf(" %c", &x); #define sstring(x) string x; cin >> x; #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <cstdio> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <functional> #include <numeric> using namespace std; int main(int argc, char** argv) { sint(N); vint(a, 3 * N); int min = INT_MIN; rep(i, N + 1) { vector<int> left(N + i), right(2 * N - i), left2(N), right2(N); copy(a.begin(), a.begin() + N + i, left.begin()); sort(all(left)); copy(a.begin() + N + i, a.end(), right.begin()); sort(all(right)); copy(left.begin() + i, left.begin() + i + N, left2.begin()); copy(right.begin(), right.begin() + N, right2.begin()); int score = accumulate(all(left2), 0) - accumulate(all(right2), 0); if (min < score) { min = score; } } printf("%d\n", min); }
a.cc: In function 'int main(int, char**)': a.cc:68:19: error: 'INT_MIN' was not declared in this scope 68 | int min = INT_MIN; | ^~~~~~~ a.cc:62:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 61 | #include <numeric> +++ |+#include <climits> 62 | using namespace std;
s581104651
p03714
C++
# include <stdio.h> # include <string.h> # include <stdlib.h> # include <iostream> # include <vector> # include <queue> # include <stack> # include <map> # include <math.h> # include <algorithm> using namespace std; # define pi acos(-1.0) # define mem(a,b) memset(a,b,sizeof(a)) # define FOR(i,a,n) for(int i=a; i<=n; ++i) # define FO(i,a,n) for(int i=a; i<n; ++i) typedef long long LL; typedef unsigned long long ULL; int a[3005],b[3005]; LL c[3005]; bool cmp1(int a,int b) { return a>b; } bool cmp2(int a,int b) { return a<b; } int main() { int n; scanf("%d",&n); for(int i=1;i<=3*n;i++) scanf("%d",&a[i]); for(int i=n;i<=2*n;i++) { LL s1=0,s2=0; //for(int j=1;j<=3*n;j++)b[j]=a[j]; strcpy((char*)b,(char*)a); sort(b+1,b+i+1); for(int j=i,z=1;z<=n;j--,z++)s1+=b[j]; sort(b+i+2,b+3*n+1); for(int j=i+1,z=1;z<=n;j++,z++)s2+=b[j]; c[i]=s1-s2; } sort(c+n+1,c+2*n+1); cout<<c[2*n]; return 0; }
a.cc:18:20: error: expected initializer before '\U0000ff1b' 18 | int a[3005],b[3005]; | ^~ a.cc: In function 'int main()': a.cc:38:23: error: 'b' was not declared in this scope 38 | strcpy((char*)b,(char*)a); | ^ a.cc:43:9: error: 'c' was not declared in this scope 43 | c[i]=s1-s2; | ^ a.cc:45:10: error: 'c' was not declared in this scope 45 | sort(c+n+1,c+2*n+1); | ^
s395680217
p03714
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long[] a = new long[3 * N]; for(int i = 0; i < 3 * N; i++) { a[i] = sc.nextLong(); } PriorityQueue<Long> pq = new PriorityQueue<Long>(); long[] max = new long[N + 1]; for(int i = 0; i < N; i++) { pq.add(a[i]); max[0] += a[i]; } for(int i = 1; i < N + 1; i++) { pq.add(a[N + i - 1]); long m = pq.poll(); max[i] = max[i - 1] + a[N + i - 1] - m; } PriorityQueue<Long> pq2 = new PriorityQueue<>(N, Collections.reverseOrder()); long[] min = new long[N + 1]; for(int i = 3 * N - 1; i > 2 * N - 1; i--) { pq2.add(a[i]); min[0] += a[i]; } for(int i = 1; i < N + 1; i++) { pq2.add(a[2 * N - i]); long m = pq2.poll(); min[i] = min[i - 1] + a[2 * N - i] - m; } long ans = -1000000000000000000; for(int i = 0; i < N + 1; i++) { ans = Math.max(ans, max[i] - min[N - i]); } System.out.println(ans); } }
Main.java:34: error: integer number too large long ans = -1000000000000000000; ^ 1 error
s085648410
p03714
C++
#include <functional> #include <iostream> #include <queue> #include <sstream> #include <stdio.h> #include <stdlib.h> #include <string> #include <valarray> #include <vector> std::vector<std::string> GetInputValues(); std::valarray<int> DeriveSumArr1(); std::valarray<int> DeriveSumArr2(); std::string InputPattern = "InputX"; std::vector<std::string> GetInputValues() { std::vector<std::string> InputValuesVect; if (InputPattern == "Input1") { InputValuesVect.push_back("2"); InputValuesVect.push_back("3 1 4 1 5 9"); //1 } else if (InputPattern == "Input2") { InputValuesVect.push_back("1"); InputValuesVect.push_back("1 2 3"); //-1 } else if (InputPattern == "Input3") { InputValuesVect.push_back("3"); InputValuesVect.push_back("8 2 2 7 4 6 5 3 8"); //5 } else { //実際の入力 while (true) { std::string wkStr; std::getline(std::cin,wkStr); if(std::cin.eof()) break; InputValuesVect.push_back(wkStr.c_str()); } } return InputValuesVect; } int N; int UB; std::valarray<int> AArr; int main() { std::vector<std::string> InputVect = GetInputValues(); N=atoi(InputVect.at(0).c_str()); UB=3*N-1; AArr = std::valarray<int> (UB+1); int CurrInd=0; std::istringstream iss1(InputVect.at(1)); while(iss1.eof() == false){ int wkInt; iss1 >> wkInt; AArr[CurrInd++]=wkInt; } std::valarray<long long> SumArr1=DeriveSumArr1(); //for(int I=0;I<=(int)SumArr1.size()-1;I++){ // printf("%d,",SumArr1[I]); //} //puts(""); std::valarray<long long> SumArr2=DeriveSumArr2(); //for(int I=0;I<=(int)SumArr2.size()-1;I++){ // printf("%d,",SumArr2[I]); //} //puts(""); long long Answer=LLONG_MIN; for(int I=N;I<=2*N;I++){ int AnswerKouho=SumArr1[I-1]-SumArr2[I]; if(Answer<AnswerKouho){ Answer=AnswerKouho; } } printf("%d\n",Answer); } //添字ごとのTopNの合計の配列を返す(前半部分) std::valarray<long long> DeriveSumArr1() { std::valarray<long long> SumArr1(UB+1); std::priority_queue<long long,std::vector<long long>, std::greater<long long> > Que; long long SumVal=0; for(int I=0;I<=UB;I++){ Que.push(AArr[I]); SumVal+=AArr[I]; if((int)Que.size()>N){ SumVal-=Que.top(); Que.pop(); } SumArr1[I]=SumVal; } return SumArr1; } //添字ごとのTopNの合計の配列を返す(後半部分) std::valarray<long long> DeriveSumArr2() { std::valarray<long long> SumArr2(UB+1); std::priority_queue<long long> Que; long long SumVal=0; for(int I=UB;0<=I;I--){ Que.push(AArr[I]); SumVal+=AArr[I]; if((int)Que.size()>N){ SumVal-=Que.top(); Que.pop(); } SumArr2[I]=SumVal; } return SumArr2; }
a.cc: In function 'int main()': a.cc:67:51: error: conversion from 'valarray<int>' to non-scalar type 'valarray<long long int>' requested 67 | std::valarray<long long> SumArr1=DeriveSumArr1(); | ~~~~~~~~~~~~~^~ a.cc:73:51: error: conversion from 'valarray<int>' to non-scalar type 'valarray<long long int>' requested 73 | std::valarray<long long> SumArr2=DeriveSumArr2(); | ~~~~~~~~~~~~~^~ a.cc:79:22: error: 'LLONG_MIN' was not declared in this scope 79 | long long Answer=LLONG_MIN; | ^~~~~~~~~ a.cc:9:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <valarray> +++ |+#include <climits> 9 | #include <vector> a.cc: At global scope: a.cc:90:26: error: ambiguating new declaration of 'std::valarray<long long int> DeriveSumArr1()' 90 | std::valarray<long long> DeriveSumArr1() | ^~~~~~~~~~~~~ a.cc:12:20: note: old declaration 'std::valarray<int> DeriveSumArr1()' 12 | std::valarray<int> DeriveSumArr1(); | ^~~~~~~~~~~~~ a.cc:111:26: error: ambiguating new declaration of 'std::valarray<long long int> DeriveSumArr2()' 111 | std::valarray<long long> DeriveSumArr2() | ^~~~~~~~~~~~~ a.cc:13:20: note: old declaration 'std::valarray<int> DeriveSumArr2()' 13 | std::valarray<int> DeriveSumArr2(); | ^~~~~~~~~~~~~
s230245936
p03714
C++
#include <iostream> #include <queue> #include <vector> #include <limits> using namespace std; using ll = long long; int main(){ // 入力 int N = N, vector a = {a_1, a_2, ... a_N*3} int N; cin >> N; int N3 = N * 3; vector<ll> a(N3); for (int i=0; i<N3; ++i){ cin >> a[i]; } // 優先度つきキューの作成 // pq_front: 前から N+k 個の要素で常に最大のN要素をもつキュー(降順に取り出す) // pq_back: 後ろから N+k 個の要素で常に最小のN要素をもつキュー(昇順に取り出す) priority_queue<ll, vector<ll>, greater<ll>> pq_front; priority_queue<ll> pq_back; // sum_front[k]: あるkに対するpq_front の総和 // sum_front[k]: あるkに対するpq_back の総和 vector<ll> sum_front(N+1, 0), sum_back(N+1, 0); // pq_front(back)に前から(後ろから)N要素を追加、sum_front(back)を計算 for (int i=0; i<N; ++i){ pq_front.push(a[i]); pq_back.push(a[N3 - i - 1]); sum_front[0] += a[i]; sum_back[N] += a[N3 - i - 1]; } // k = 0, 1, ... , N-1 に対してsum_front(back)を計算 for (int k=0; k<N; ++k){ // a_k+N を pq_front に追加、最小要素をpopして総和を更新。 pq_front.push(a[N+k]); pq_back.push(a[N*2-k-1]); sum_front[k+1] = sum_front[k] + a[N+k] - pq_front.top(); sum_back[N-k-1] = sum_back[N-k] + a[N*2-k-1] - pq_back.top(); pq_front.pop(); pq_back.pop(); } // sum_front[k] - sum_back[k] の最大値を計算 ll max_score = LLONG_MIN; for (int k=0; k<=N; ++k){ ll score = sum_front[k] - sum_back[k]; if (max_score < score){ max_score = score; } } // 出力 cout << max_score << endl; }
a.cc: In function 'int main()': a.cc:55:24: error: 'LLONG_MIN' was not declared in this scope 55 | ll max_score = LLONG_MIN; | ^~~~~~~~~ a.cc:5:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 4 | #include <limits> +++ |+#include <climits> 5 |
s149371376
p03714
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; long long int n,m,max; inline int uesort(vector<int> a,int num){ int sum=0; sort(a.begin(),a.begin()+num); for(int i=n;i>=0;i--) sum += a[i]; return sum; } inline int sitasort(vector<int> a,int num){ int sum=0; sort(a.end()-num,a.end()); for(int i=0;i<n;i++) sum += a[i]; return sum; } int main(){ long long int n,m; cin >> n; m = n << 1 + n; vector <int> a(m); vector<long long int> left(n),right(n); for(int i=0;i<m;i++) cin >> a[i]; for(int i=0;i<n;i++){ left[i] = uesort(a,i); right[i] = sitasort(a,i); } max = left[1] - right[1]; for(int i=1;i<n;i++){ if(max < (left[i] - right[i])) max = (left[i] - right[i]); } cout << max << endl; }
a.cc: In function 'int main()': a.cc:34:9: error: reference to 'max' is ambiguous 34 | max = left[1] - right[1]; | ^~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:19: note: 'long long int max' 5 | long long int n,m,max; | ^~~ a.cc:36:20: error: reference to 'max' is ambiguous 36 | if(max < (left[i] - right[i])) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:19: note: 'long long int max' 5 | long long int n,m,max; | ^~~ a.cc:37:25: error: reference to 'max' is ambiguous 37 | max = (left[i] - right[i]); | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:19: note: 'long long int max' 5 | long long int n,m,max; | ^~~ a.cc:39:17: error: reference to 'max' is ambiguous 39 | cout << max << endl; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:5:19: note: 'long long int max' 5 | long long int n,m,max; | ^~~
s578859270
p03714
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ // input int N; cin >> N; int N3 = N * 3; vector<long long> v(N3); vector<long long *> vp(N3); vector<long long> sum(N3 + 1); sum[0] = 0; for (int i = 0; i< N3; ++i){ cin >> v[i]; vp[i] = &v[i]; sum[i+1] = sum[i] + v[i]; } sort(vp.begin(), vp.end(),[](long long* x, long long* y) -> int {return ( *x < *y );}); long long int max_score = -1 * sum[3N]; for (int n = 1; n <= N; ++n){ long long int S_b = sum[N+n]; int count = n; int j = 0; while (count > 0){ if((long long int)(vp[j] - &v[0]) < N + n){ S_b -= *vp[j]; count--; } ++j; } long long int S_a = sum[N3] - sum[N+n]; count = N - n; j = N3 - 1; while (count > 0){ if((long long int)(vp[j] - &v[0]) >= N + n){ S_a -= *vp[j]; count--; } --j; } long long score = S_b - S_a; if(max_score < score){ max_score = score; } } cout << max_score << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:44: error: unable to find numeric literal operator 'operator""N' 27 | long long int max_score = -1 * sum[3N]; | ^~
s996814875
p03714
C++
#if 1 #include <iostream> #include <fstream> #include <string> #include <vector> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <queue> #include <stack> #include <array> #include <deque> #include <algorithm> #include <utility> #include <cstdint> #include <functional> #include <iomanip> #include <numeric> #include <assert.h> auto& in = std::cin; auto& out = std::cout; int32_t N; int32_t ARR[300000]; int64_t MAX[112345];//[N-1,2N][0,N+1] int64_t MIN[112345];//[N-1,2N] int main() { using std::endl; in.sync_with_stdio(false); out.sync_with_stdio(false); in >> N; for (size_t i = 0; i < 3*N; i++) { in >> ARR[i]; } //std::sort(ARR, ARR + N); //std::sort(ARR+2*N-1, ARR + 3*N); //前を最大化 { int64_t sum = 0; std::priority_queue<int32_t> que; for (int32_t i = 0; i < N; i++) { que.push(-ARR[i]); sum += ARR[i]; } MAX[0] = sum; //[N,2N]を処理 for (int32_t i = 0; i <= N; i++) { que.push(-ARR[N+i]); sum += ARR[N+i]; sum += que.top(); que.pop(); MAX[i+1] = sum; } } //後ろを最小化 { int64_t sum = 0; std::priority_queue<int32_t> que; for (int32_t i = 0; i < N; i++) { que.push(ARR[3*N-1-i]); sum += ARR[3*N-1-i]; } MIN[N+1] = sum; //[N,2N]を処理 for (int32_t i = 0; i <= N; i++) { que.push(ARR[2*N-1 - i]); sum += ARR[2*N-1 - i]; sum -= que.top(); que.pop(); MIN[N-i] = sum; } } //[N-1,2N]を処理 int64_t max_value = (-9223372036854775807i64 - 1); for (int32_t i = 0; i <= N; i++) { max_value = std::max(max_value, MAX[i] - MIN[i+1]); } std::cout << max_value << std::endl; return 0; } #endif
a.cc: In function 'int main()': a.cc:83:31: error: unable to find numeric literal operator 'operator""i64' 83 | int64_t max_value = (-9223372036854775807i64 - 1); | ^~~~~~~~~~~~~~~~~~~~~~
s455241145
p03715
C++
//4パターンの分割方法 //hを全探索して残りを二分割
/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
s596257080
p03715
C++
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<long long, long long>; constexpr char ln = '\n'; constexpr long long MOD = 1000000007LL; constexpr long long INF = 1000000009LL; #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main() { ll h, w; cin >> h >> w; if(h%3==0 || w%3==0) cout << 0 << ln; else{ ll res = INF; ll L = max(h, w), S = min(h, w); for(llogbf64x i=1; i<L; i++){ ll num[3]; num[0] = S * i; num[1] = S/2 * (L-i); num[2] = h*w - (num[0]+num[1]); sort(num, num+3); ll sa = num[2] - num[0]; chmin(res, sa); } L = min(h, w), S = max(h, w); for(ll i=1; i<L; i++){ ll num[3]; num[0] = S * i; num[1] = S/2 * (L-i); num[2] = h*w - (num[0]+num[1]); sort(num, num+3); ll sa = num[2] - num[0]; chmin(res, sa); } cout << res << ln; } }
a.cc: In function 'int main()': a.cc:22:22: error: expected ';' before 'i' 22 | for(llogbf64x i=1; i<L; i++){ | ^~ | ; a.cc:22:28: error: 'i' was not declared in this scope 22 | for(llogbf64x i=1; i<L; i++){ | ^
s932287815
p03715
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <stack> #include <tuple> #include <cmath> #include <iomanip> #include <map> #include <cstring> //memset(dp,0,sizeof(dp)) #include <functional> #define ll long long #define rep(i,n) for(int i=0;i<(n);i++) #define repp(i,n) for(int i=n-1;i>=0;i--) #define fi first #define se second #define pb push_back #define ppb pop_back() #define ALL(a) (a).begin(),(a).end() using namespace std; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} typedef pair<int,int> P; typedef pair<ll,ll> Pll; int main(){ ll h,w; cin >> h >> w; if(h%3==0||w%3==0){ cout << 0 << endl; return 0; } ll ans=1e10; for(ll i=1;i<h;i++){ ll a=i*w; ll b=(h-i)*(w/2); ll c=(h-i)*(w-w/2); ll x=max(a,max(b,c)); ll y=min(a,min(b,c)); chmin(ans,x-y); ll d=(h-i)/2; b=w*d c=w*(h-i-d); x=max(a,max(b,c)); y=min(a,min(b,c)); chmin(ans,x-y); } for(ll i=1;i<w;i++){ ll a=i*h; ll b=(w-i)*(h/2); ll c=(w-i)*(h-h/2); ll x=max(a,max(b,c)); ll y=min(a,min(b,c)); chmin(ans,x-y); ll d=(w-i)/2; b=h*d; c=h*(w-i-d); x=max(a,max(b,c)); y=min(a,min(b,c)); chmin(ans,x-y); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:44:14: error: expected ';' before 'c' 44 | b=w*d | ^ | ; 45 | c=w*(h-i-d); | ~
s982491302
p03715
C++
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ll n; cin>>n; vector<pair<ll,ll> > b; vector<ll> c; for(int i=0;i<n*3;i++) {ll x; cin>>x; if(i<2*n) { b.push_back(make_pair(x,i); } c.push_back(x); } sort(b.begin(),b.end()); ll z1=0,ans=0; for(int i=n;i<2*n;i++) { z1+=b[i].first; ans=max(ans,b[i].second); } vector<ll> d; ++ans; d.assign(c.begin()+ans,c.end()); sort(d.begin(),d.end()); ll j=0,z2=0; vector<ll>::iterator it; for( it=d.begin();it!=d.end();it++) {j++; z2+=*it; if(j==n)break; } cout<<z1-z2; }
a.cc: In function 'int main()': a.cc:15:39: error: expected ')' before ';' token 15 | b.push_back(make_pair(x,i); | ~ ^ | )
s014915668
p03715
C++
#include<bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define pb push_back using namespace std; typedef long long ll; int main(){ ll h,w; cin>>h>>w; if(h%3==0 || w%3==0){ cout<<0<<endl; return 0; } ll ans=10000000000; if(w>2) ans=h; if(h>2) ans=min(ans,w); if(h%2==0) ans=min(ans,h/2); if(w%2==0) ans=min(ans,w/2); if(h%2==1){ for(int i=1;i<w;i++){ int res=max(abs(3*i*h-h*w-w+i)/2,abs(3*i*h-h*w+w-i)/2); res=max(res,w-i); ans=min(ans,res); } } if(w%2==1){ for(int i=1;i<h;i++){ int res=max((3*i*w-h*w-h+i)/2,(3*i*w-h*w+h-i)/2); res=max(res,h-i); ans=min(ans,res); } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:14: error: no matching function for call to 'max(int&, ll)' 22 | res=max(res,w-i); | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:22:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 22 | res=max(res,w-i); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:22:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 22 | res=max(res,w-i); | ~~~^~~~~~~~~ a.cc:23:14: error: no matching function for call to 'min(ll&, int&)' 23 | ans=min(ans,res); | ~~~^~~~~~~~~ /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:23:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 23 | ans=min(ans,res); | ~~~^~~~~~~~~ /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:23:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | ans=min(ans,res); | ~~~^~~~~~~~~ a.cc:29:14: error: no matching function for call to 'max(int&, ll)' 29 | res=max(res,h-i); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:29:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 29 | res=max(res,h-i); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:29:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 29 | res=max(res,h-i); | ~~~^~~~~~~~~ a.cc:30:14: error: no matching function for call to 'min(ll&, int&)' 30 | ans=min(ans,res); | ~~~^~~~~~~~~ /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:30:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 30 | ans=min(ans,res); | ~~~^~~~~~~~~ /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:30:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 30 | ans=min(ans,res); | ~~~^~~~~~~~~
s176472231
p03715
C++
#include<cstdio> #include<iostream> #include<string> #include<set> #include<map> #include<vector> #include<queue> #include<stack> #include<deque> #include<tuple> #include<algorithm> #include<numeric> #include<limits> #include<boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; using namespace std; #define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define END return EXIT_SUCCESS #define up(I,A,B) for(auto I=(A);I<=(B);++I) #define dw(I,A,B) for(auto I=(A);I>=(B);--I) #define rep(I,N) up(I,0,N-1) #define all(C) (C).begin(),(C).end() #define rall(C) (C).rbegin(),(C).rend() #define ft first #define sd second #define mp make_pair #define mt make_tuple #define pf push_front #define pb push_back #define lb lower_bound #define ub upper_bound #define rs resize typedef long long ll; typedef long double ld; typedef unsigned long long ull; template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>inline void in(T &p){cin>>p;} template<class T1,class T2>inline void in(T1 &p1,T2 &p2){cin>>p1>>p2;} template<class T1,class T2,class T3>inline void in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;} template<class T1,class T2,class T3,class T4>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;} template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;} template<class T>inline void ins(T &p){for_each(all(p),in<decltype(p[0])>);} template<class T>inline void out(T p){cout<<p<<"\n";} template<class T1,class T2>inline void out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<"\n";} template<class T1,class T2,class T3>inline void out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<"\n";} template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<"\n";} inline void out(ld p){printf("%.12Lf\n",p);} template<class T>inline void outml(T p){for_each(all(p),out<decltype(p[0])>);}//ml=multi line template<class T>inline void outol(T V){auto n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}//ol=one line inline void solve(void){ ll H,W; in(H,W); if(H%3==0||W%3==0){ out(0); return; } ll ans=1L<<60; up(w,1,W-1){ ll a=H*w; ll b=H/2*(W-w); ll c=(H/2+H%2)*(W-w); chmin(ans,max({a,b,c})-min({a,b,c})); } up(h,1,H-1){ ll a=W*h; ll b=W/2*(H-h)); ll c=(W/2+W%2)*(H-h); chmin(ans,max({a,b,c})-min({a,b,c})); } up(w,1,W-2){ ll a=H*w; ll b=(W-w)/2*H; ll c=((W-w)/2+(W-w)%2)*H; chmin(ans,max({a,b,c})-min({a,b,c})); } up(h,1,H-2){ ll a=h*W; ll b=(H-h)/2*W; ll c=((H-h)/2+(H-h)%2)*W; chmin(ans,max({a,b,c})-min({a,b,c})); } out(ans); } int main(void){ BEGIN; solve(); END; }
a.cc:14:9: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory 14 | #include<boost/multiprecision/cpp_int.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s705596738
p03715
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; ll mod = 1000000007; int main(){ ll h,w; cin >> h >> w; ll ans,ans1,ans2,ans3,ans4; ll hemain=h%3,wemain=w%3; ll hart1=(h-hemain)/3,wart1=(w-wemain)/3; ll hart2=h/2,wart2=w/2; ll hact,wact; if(hemain==0 || wemein==0){ cout << 0 << endl; return 0; } ans1=w; ans2=h; ans=min(ans1,ans2); if(hemain==2){ hact=hart1+1; ans3=w*hact-wart2*(h-hact); } else{ hact=hart1; ans3=w*hact-(w-wart2)*(h-hact); } if(ans3<0)ans3*=-1; ans=min(ans,ans3); if(wemain==2){ wact=wart1+1; ans4=h*wact-hart2*(w-wact); } else{ wact=wart1; ans4=h*wact-(h-hart2)*(w-wact); } if(ans4<0)ans4*=-1; ans=min(ans,ans4); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:19: error: 'wemein' was not declared in this scope; did you mean 'wemain'? 16 | if(hemain==0 || wemein==0){ | ^~~~~~ | wemain
s678606140
p03715
C++
#include <bits/stdc++.h> #define mod 1000000007 using namespace std; int main(){ long x,y,i; long long a1,a2,a3,mn; cin>>x>>y; mn=x*y; if(x>y) swap(x,y); for(i=1;i<y;i++){ a1=x*i; a2=x/2*(y-i); a3=(x-x/2)*(y-i); mn=min(mn,max(a1,a2,a3)-min(a1,a2,a3)); } cout<<mn; }
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: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:14:22: required from here 14 | mn=min(mn,max(a1,a2,a3)-min(a1,a2,a3)); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /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:14:36: required from here 14 | mn=min(mn,max(a1,a2,a3)-min(a1,a2,a3)); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s780167670
p03715
C++
#include <algorithm> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unordered_map> #include <vector> int main() { long long H, W; scanf("%lld", &H); scanf("%lld", &W); long long ans = 1e15; for (int i = 0; i < 2; i++) { //横に2回切る if (H % 3 == 0) { ans = std::min(0, ans); } else { ans = std::min(W, ans); } // 横に切った残りを縦に切る if (W % 2 == 0) { if (H % 3 == 0) { ans = std::min(0, ans); } else { ans = std::min(W/2, ans); } } else { ans = std::min(ans, ((W + 1) / 2 * H) % ((3 * W + 1) / 2)); ans = std::min(ans, (W * H) % ((3 * W - 1) / 2)); } std::swap(H, W); } std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:24:21: error: no matching function for call to 'min(int, long long int&)' 24 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, 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:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 24 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~ /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:24:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~ a.cc:31:23: error: no matching function for call to 'min(int, long long int&)' 31 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~ /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:31:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 31 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~ /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:31:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 31 | ans = std::min(0, ans); | ~~~~~~~~^~~~~~~~
s889174642
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define N 666666 #define inf 999999999999 int ans; signed main(){ int n,m; cin>>n>>m; ans=inf; if(n%3==0||m%3==0){ cout<<"0";return 0; } ans=min(n,m); for(int i=1;i<n;i++){ int s1=i*m,s2,s3; if(m%2){ s2=(m/2)*(n-i); s3=(m/2+1)*(n-i); }else{ s2=(m/2)*(n-i); s3=(m/2)*(n-i); } ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } for(int i=1;i<m;i++){ int s1=i*n,s2,s3; if(n%2){ s2=(n/2)*(m-i); s3=(n/2+1)*(m-i); }else{ s2=()n/2)*(m-i); s3=(n/2)*(m-i); } ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } cout<<ans; return 0; } /* 4 2 1 -1 -2 */
a.cc: In function 'int main()': a.cc:34:29: error: expected primary-expression before ')' token 34 | s2=()n/2)*(m-i); | ^
s926215229
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define N 666666 #define inf 999999999999 int ans; signed main(){ int n,m; cin>>n>>m; ans=inf; if(n%3==0||m%3==0){ cout<<"0";return 0; } ans=min(n*(m/3+1),m*(n/3+1)); for(int i=1;i<n;i++){ int s1=i*m,s2,s3; if(m%2){ s2=(m/2)*(n-i); s3=(m/2+1)*(n-i); }else{ s2=(m/2)*(n-i); s3=(m/2)*(n-i); } ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } for(int i=1;i<m;i++){ int s1=i*n,s2,s3; if(n%2){ s2=(n/2)*(m-i); s3=(n/2+1)*(m-i); }else{ s2=()n/2)*(m-i); s3=(n/2)*(m-i); } ans=min(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } cout<<ans; return 0; } /* 4 2 1 -1 -2 */
a.cc: In function 'int main()': a.cc:34:29: error: expected primary-expression before ')' token 34 | s2=()n/2)*(m-i); | ^
s091903341
p03715
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll H,W; cin >> H >> W; ll ans; if(H%3==0||W%3==0)ans=0;else ans=min(H,W); ll h,w; ll a,b,c; ll t; for(h=1;h<=H-1;h++){ w=W/2; a=h*W; b=(H-h)*w; c=(H-h)*(W-w); t=max(abs(a-b),max(abs(b-c),abs(c-a))); ans=min(ans,t; } for(w=1;w<=W-1;w++){ h=H/2; a=w*H; b=(W-w)*h; c=(H-h)*(W-w); t=max(abs(a-b),max(abs(b-c),abs(c-a))); ans=min(ans,t); } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:29:22: error: expected ')' before ';' token 29 | ans=min(ans,t; | ~ ^ | )
s419621871
p03715
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll H,W; cin >> H >> W; ll ans; if(H%3==0||W%3==0)ans=0;else ans=min(H,W); ll a,b; a=H/3;b=W/2; for(i=0;i<=1;i++){ for(j=0;j<=1;j++){ min(ans,min(H-a-i,abs((a+i)*W-(H-a-i)*b)); } } a=W/3;b=H/2; for(i=0;i<=1;i++){ for(j=0;j<=1;j++){ min(ans,min(W-a-i,abs((a+i)*H-(W-a-i)*b)); } } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:22:9: error: 'i' was not declared in this scope 22 | for(i=0;i<=1;i++){ | ^ a.cc:23:13: error: 'j' was not declared in this scope 23 | for(j=0;j<=1;j++){ | ^ a.cc:28:9: error: 'i' was not declared in this scope 28 | for(i=0;i<=1;i++){ | ^ a.cc:29:13: error: 'j' was not declared in this scope 29 | for(j=0;j<=1;j++){ | ^
s382865651
p03715
C++
#include<bits/stdc++.h> using namespace std; int main() { printf( }
a.cc: In function 'int main()': a.cc:6:1: error: expected primary-expression before '}' token 6 | } | ^
s559099658
p03715
C++
#include <iostream> #include <iomanip> #include <algorithm> #include <utility> #include <cmath> #include <string> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <deque> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main() { ll w, h; cin >> w >> h; if (w % 3 == 0 || h % 3 == 0) { cout << 0 << endl; return 0; } if (w < h) { swap( h, w); } ll ans = 200000000000; for(int cw = max(w / 3 - 10 ,0); cw <= min(w / 3 + 10, w); cw++) { ll a = cw * h; ll w0 = w - cw; for (int ch = max(h / 2 - 10, 0) ; ch <= min(h / 2 + 10, h); ch++) { ll b = ch * w0; ll c = (h - ch) * w0; ll cur = max(abs(a - b), abs(b - c)); cur = max(cur, abs(c - a)); ans = min(ans, cur); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:33:25: error: no matching function for call to 'max(ll, int)' 33 | for(int cw = max(w / 3 - 10 ,0); cw <= min(w / 3 + 10, w); cw++) { | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:33:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 33 | for(int cw = max(w / 3 - 10 ,0); cw <= min(w / 3 + 10, w); cw++) { | ~~~^~~~~~~~~~~~~~~ /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, from a.cc:3: /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:33:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | for(int cw = max(w / 3 - 10 ,0); cw <= min(w / 3 + 10, w); cw++) { | ~~~^~~~~~~~~~~~~~~ a.cc:37:34: error: no matching function for call to 'max(ll, int)' 37 | for (int ch = max(h / 2 - 10, 0) ; ch <= min(h / 2 + 10, h); ch++) { | ~~~^~~~~~~~~~~~~~~ /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:37:34: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 37 | for (int ch = max(h / 2 - 10, 0) ; ch <= min(h / 2 + 10, h); ch++) { | ~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:37:34: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 37 | for (int ch = max(h / 2 - 10, 0) ; ch <= min(h / 2 + 10, h); ch++) { | ~~~^~~~~~~~~~~~~~~
s678549247
p03715
C++
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;} #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(vec) vec.begin(),vec.end() typedef long long ll; typedef pair<ll,ll> pll; typedef pair<int,int> pii; const ll mod=1e9+7; const int inf=1<<30; int main(){ ll h,w; cin >> h >> w; if(h%3==0||w%3==0){ cout << 0 << endl; return 0; } ll a=h*2/3; ll b=w/2; ll ans=inf; for(int i=a;i<=a+1;i++){ ll s1=i*b; ll s2=i*(w-b); ll s3=(h-i)*w; chmin(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } ll s1=h*(w/3); ll s2=h*((w-w/3)/2); ll s3=h*w-s1-s2; chmin(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); //cout << ans << endl; swap(h,w); a=h*2/3; b=w/2; for(int i=a;i<=a+1;i++){ ll s1=i*b; ll s2=i*(w-b); ll s3=(h-i)*w; chmin(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); } ll s1=h*(w/3); ll s2=h*((w-w/3)/2); ll s3=h*w-s1-s2; chmin(ans,max(s1,max(s2,s3))-min(s1,min(s2,s3))); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:43:6: error: redeclaration of 'll s1' 43 | ll s1=h*(w/3); | ^~ a.cc:29:6: note: 'll s1' previously declared here 29 | ll s1=h*(w/3); | ^~ a.cc:44:6: error: redeclaration of 'll s2' 44 | ll s2=h*((w-w/3)/2); | ^~ a.cc:30:6: note: 'll s2' previously declared here 30 | ll s2=h*((w-w/3)/2); | ^~ a.cc:45:6: error: redeclaration of 'll s3' 45 | ll s3=h*w-s1-s2; | ^~ a.cc:31:6: note: 'll s3' previously declared here 31 | ll s3=h*w-s1-s2; | ^~
s820785600
p03715
C++
#include<bits/stdc++.h> #include <iostream> #include <string> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; int main(){ ll n,m; cin>>n>>m; ll j=n; ll k=m; if(n%3==0||m%3==0) COUT(0); else if(n%2==0||m%2==0){ if(n%2==0){ ll ans=INF; for(int i=0;i<=m;i++){ ans=min(abs(n*(m-i)-(n/2*i)),ans); } } else{ ll ans=INF; for(int i=0;i<=n;i++){ ans=min(abs(m*(n-i)-(m/2*i)),ans); } } } else{ ll ans=INF; if(n>m){ ll k=n/2; for(int i=0;i<=m;i++){ ans=min(abs(i*k-n*(m-i)),ans); } } else{ ll k=m/2; for(int i=0;i<=n;i++){ ans=min(ans,abs(i*k-m*(n-i))); } } } COUT(ans); }
a.cc: In function 'int main()': a.cc:68:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 68 | COUT(ans); | ^~~ a.cc:16:24: note: in definition of macro 'COUT' 16 | #define COUT(x) cout<<(x)<<endl | ^
s060041917
p03715
C++
H,W=[int(c) for c in input().split()]; a=[H*(W//3),(H//2)*(W-W//3),(H-H//2)*(W-W//3)]; b=[W*(H//3),(W//2)*(H-H//3),(W-W//2)*(H-H//3)]; c=[W*((H+2)//3),(W//2)*(H*2//3),(W-W//2)*(H*2//3)]; d=[H*((W+2)//3),(H//2)*(W*2//3),(H-H//2)*(W*2//3)]; print(min((H%3!=0)*W,(W*3!=0)*H, max(a)-min(a),max(b)-min(b),max(c)-min(c),max(d)-min(d)));
a.cc:1:1: error: 'H' does not name a type 1 | H,W=[int(c) for c in input().split()]; | ^ a.cc:2:1: error: 'a' does not name a type 2 | a=[H*(W//3),(H//2)*(W-W//3),(H-H//2)*(W-W//3)]; | ^
s448243392
p03715
Java
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); long hh = sc.nextLong(); //縦 long ww = sc.nextLong(); //横 long aH = 0; long cH = 0; long aW = 0; long bW = 0; long x = 0; long H = 0; long W = 0; if( hh%2==0 && ww%2==0 hh<ww ){ W = hh; H = ww; } if( hh%3==2 && hh%2==0 && ww%2!=0 ){ W = hh; H = ww; } if( hh%3==1 && ww%3==2 && ww%2!=1 ){ W = hh; H = ww; } if( H%3==0 || W%3==0 ){ x = 0; }else{ if( H%3==1 ){ aH = H/3; cH = H - H/3; } if( H%3==2 ){ aH = H/3+1; cH = H - (H/3+1); } if( W%2==0 ){ aW = W/2; bW = W/2; } if( W%2==1 ){ aW = W/2+1; bW = W - (W/2+1); } } long[] ans = new long[3]; ans[0]=aH * W; ans[1]=cH * aW; ans[2]=cH * bW; Arrays.sort(ans); x = ans[2]-ans[0]; System.out.println(x); } }
Main.java:16: error: ')' expected if( hh%2==0 && ww%2==0 hh<ww ){ ^ Main.java:16: error: > or ',' expected if( hh%2==0 && ww%2==0 hh<ww ){ ^ Main.java:16: error: not a statement if( hh%2==0 && ww%2==0 hh<ww ){ ^ 3 errors
s959360387
p03715
Java
import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); long hh = sc.nextLong(); //縦 long ww = sc.nextLong(); //横 long aH = 0; long cH = 0; long aW = 0; long bW = 0; long x = 0; long H = 0; long W = 0; if( hh%2==0 && ww%2!=0 ){ W = hh; H = ww; }else{ H = hh; W = ww; } if( H%3==0 || W%3==0 ){ x = 0; }else{ if( H%3==1 ){ aH = H/3; cH = H - H/3; } if( H%3==2 ){ aH = H/3+1; cH = H - (H/3+1); } if( W%2==0 ){ aW = W/2; bW = W/2; } if( W%2==1 ){ aW = W/2+1; bW = W - (W/2+1); } } long[] ans = new ans[3]; ans[0]=aH * W; ans[1]=cH * aW; ans[2]=cH * bW; Arrays.sort(ans); x = ans[2]-ans[0]; System.out.println(x); } }
Main.java:43: error: cannot find symbol long[] ans = new ans[3]; ^ symbol: class ans location: class Main 1 error
s636372538
p03715
C++
h, w= gets.strip.split.map(&:to_i) ans = [] ans << 0 if h%3==0 || w%3==0 (1 .. h-1).each do |i| tmp = [w*i, (w/2)*(h-i)].min tmp2 = [w*i, ((w+1)/2)*(h-i)].max ans << tmp2 -tmp end (1 .. w-1).each do |i| tmp = [h*i, (h/2)*(w-i)].min tmp2 = [h*i, ((h+1)/2)*(w-i)].max ans << tmp2-tmp end puts ans.min
a.cc:1:1: error: 'h' does not name a type 1 | h, w= gets.strip.split.map(&:to_i) | ^
s757771835
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,c,d; cin>>a>>b; if(a*b%3==0) cout<<0<<endl; else{ int a1,b1,c1,a2,b2,c2; a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; c=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2),abs<int>(c2-a2))); swap(a,b); a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; d=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); cout<<min<int>(c,d)<<endl; } }
a.cc: In function 'int main()': a.cc:96:52: error: no matching function for call to 'min<long long int>(long long int)' 96 | d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); | ~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:31: note: no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>' 5686 | min(initializer_list<_Tp> __l) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s839298259
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,c,d; cin>>a>>b; if(a*b%3==0) cout<<0<<endl; else{ int a1,b1,c1,a2,b2,c2; a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; c=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); swap(a,b); a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; d=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); cout<<min<int>(c,d)<<endl; } }
a.cc: In function 'int main()': a.cc:87:52: error: no matching function for call to 'min<long long int>(long long int)' 87 | c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); | ~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:31: note: no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>' 5686 | min(initializer_list<_Tp> __l) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:96:52: error: no matching function for call to 'min<long long int>(long long int)' 96 | d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); | ~~~~~~~~^~~~~~~~~~~~~~~~~ /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 /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:31: note: no known conversion for argument 1 from 'long long int' to 'std::initializer_list<long long int>' 5686 | min(initializer_list<_Tp> __l) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s912879732
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,c,d; cin>>a>>b; if(a*b%3==0) cout<<0<<endl; else{ int a1,b1,c1,a2,b2,c3; a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; c=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); c=min<int>(min<int>(c,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); swap(a,b); a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; d=min<int>(min<int>(abs<int>(a1-b1),abs<int>(b1-c1)),abs<int>(c1-a1)); d=min<int>(min<int>(d,abs<int>(a2-b2)),min<int>(abs<int>(b2-c2)),abs<int>(c2-a2))); cout<<min<int>(c,d)<<endl; } }
a.cc: In function 'int main()': a.cc:85:5: error: 'c2' was not declared in this scope; did you mean 'c3'? 85 | c2=a*b-a1-b1; | ^~ | c3
s839929903
p03715
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int lcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return d*e/f; } int gcm(int a,int b){ int d=a,e=b,f; if(a<b) swap(a,b); int c,m=1; while(m){ c=a%b; if(c==0){ f=b; m--; } else{ a=b; b=c; } } return f; } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; double b=sqrt(a); for(int i=3;i<=b;i+=2){ if(a%i==0){ return false; } } return true; } signed main(){ int a,b,c,d; cin>>a>>b; if(a*b%3==0) cout<<0<<endl; else{ int a1,b1,c1,a2,b2,c3; a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; c=min<int>({abs(a1-b1),abs(b1-c1),abs(c1-a1)}); c=min<int>({c,abs(a2-b2),abs(b2-c2),abs(c2-a2)}); swap(a,b); a1=a/2*(b*2/3); b1=a*(b*2/3)-a1; c1=a*b-a1-b1; a2=a/2*(b*2/3+1); b2=a*(b*2/3+1)-a1; c2=a*b-a1-b1; d=min<int>({abs(a1-b1),abs(b1-c1),abs(c1-a1)}); d=min<int>({d,abs(a2-b2),abs(b2-c2),abs(c2-a2)}); cout<<min<int>(c,d)<<endl; } }
a.cc: In function 'int main()': a.cc:85:5: error: 'c2' was not declared in this scope; did you mean 'c3'? 85 | c2=a*b-a1-b1; | ^~ | c3 a.cc:87:15: error: no matching function for call to 'min<long long int>(<brace-enclosed initializer list>)' 87 | c=min<int>({c,abs(a2-b2),abs(b2-c2),abs(c2-a2)}); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<long long int>' 5686 | min(initializer_list<_Tp> __l) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:96:15: error: no matching function for call to 'min<long long int>(<brace-enclosed initializer list>)' 96 | d=min<int>({d,abs(a2-b2),abs(b2-c2),abs(c2-a2)}); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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 /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'constexpr _Tp std::min(initializer_list<_Tp>) [with _Tp = long long int]' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<long long int>' 5686 | min(initializer_list<_Tp> __l) | ~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s067866590
p03715
C++
#include <bits/stdc++.h> using namespace std; #define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--) #define forsn(i,s,n) for(int i=int(s);i<int(n);i++) #define dforn(i,n) dforsn(i,0,n) #define forn(i,n) forsn(i,0,n) #define all(a) a.begin(),a.end() #define si(a) int((a).size()) #define pb emplace_back #define mp make_pair #define snd second #define fst first #define endl '\n' using pii = pair<int,int>; using vi = vector<int>; using ll = long long; using vii = vector<pii>; const int N = 300+1, M = 1e9+7, C = 3; int n, m, memo[N][N][N]; vii conditions[N]; int add(int a, int b) { return a + b >= M ? a + b - M : a + b; } bool valid(int pos, int last0, int last1, int last2) { for (auto lx : conditions[pos]) { int l, x; tie(l, x) = lx; int cant = (last0 >= l) + (last1 >= l) + (last2 >= l); if (cant != x) return false; } return true; } int dp(int last0 = 0, int last1 = 0, int last2 = 0) { int pos = max({last0, last1, last2})+1; if (pos == n+1) return 1; int &res = memo[last0][last1][last2]; if (res != -1) return res; res = 0; if (valid(pos, pos, last1, last2)) res = add(res, dp(pos, last1, last2)); if (valid(pos, last0, pos, last2)) res = add(res, dp(last0, pos, last2)); if (valid(pos, last0, last1, pos)) res = add(res, dp(last0, last1, pos)); return res; } int main() { ios_base::sync_with_stdio(0); cin.tie(0) cin >> n >> m; while (m--) { int l, r, x; cin >> l >> r >> x; conditions[r].pb(l, x); } fill(memo[0][0], memo[N][0], -1); cout << dp() << endl; }
a.cc: In function 'int main()': a.cc:58:41: error: expected ';' before 'cin' 58 | ios_base::sync_with_stdio(0); cin.tie(0) | ^ | ; 59 | 60 | cin >> n >> m; | ~~~
s642075142
p03715
C++
#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[3*n],b[n],c[n]; int i,j; for(i=0;i<3*n;i++) cin>>arr[i]; sort(arr,arr+(3*n)/2); for(i=0;i<n;i++) { b[i]=arr[(n/2)+i]; } int sum=0,sum1=0; for(i=0;i<n;i++) { sum=sum+b[i]; } sort(arr+(3*n)/2,arr+3*n); for(i=0;i<n;i++) { c[i]=arr[(3*n/2)+i]; } for(i=0;i<n;i++) { sum1=sum1+c[i]; } cout<<sum-sum1; }#include<iostream> #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int arr[3*n],b[n],c[n]; int i,j; for(i=0;i<3*n;i++) cin>>arr[i]; sort(arr,arr+(3*n)/2); for(i=0;i<n;i++) { b[i]=arr[(n/2)+i]; } int sum=0,sum1=0; for(i=0;i<n;i++) { sum=sum+b[i]; } sort(arr+(3*n)/2,arr+3*n); for(i=0;i<n;i++) { c[i]=arr[(3*n/2)+i]; } for(i=0;i<n;i++) { sum1=sum1+c[i]; } cout<<sum-sum1; }
a.cc:32:2: error: stray '#' in program 32 | }#include<iostream> | ^ a.cc:32:3: error: 'include' does not name a type 32 | }#include<iostream> | ^~~~~~~ a.cc:35:5: error: redefinition of 'int main()' 35 | int main() | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() | ^~~~
s927056681
p03715
C++
100000 100000 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; typedef vector<ll> V; typedef complex<double> Point; #define PI acos(-1.0) #define EPS 1e-10 const ll INF = 1e16; const ll MOD = 1e9 + 7; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define rep(i,N) for(int i=0;i<(N);i++) #define ALL(s) (s).begin(),(s).end() #define EQ(a,b) (abs((a)-(b))<EPS) #define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) ) #define fi first #define se second #define N_SIZE (1LL << 20) #define NIL -1 ll h,w; int main(){ cin >> h >> w; if(h % 3 == 0 || w % 3 == 0){ cout << 0 << endl; return 0; } ll ans = INF; rep(i,w){ ll MA = max(h*i,(w-i)*h/2); ll MI = min(h*i,(w-i)*h/2); ans = min(ans,MA-MI); } cout << ans << endl; }
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 100000 100000 | ^~~~~~ 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__)); |
s125046780
p03715
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> using namespace std; int main() { long long h,w,p,i,a,b,c,b1,c1,m,m1; cin >> h >> w; p=10000000000; for(i=h/3; i<=h/3+3; i++) { if(i!=0 && i<h) { a=i*w; b=(h-i)/2*w; c=(h*w-a-b); b1=(w/2)*(h-i); c1=h*w-a-b1; m=max(a,b,c)-min(a,b,c); m1=max(a,b1,c1)-min(a,b1,c1); p=min(m,m1,p); } } for(i=w/3; i<=w/3+3; i++) { if(i!=0 && i<w) { a=i*h; b=(w-i)/2*h; c=(h*w-a-b); b1=(h/2)*(w-i); c1=h*w-a-b1; m=max(a,b,c)-min(a,b,c); m1=max(a,b1,c1)-min(a,b1,c1); p=min(m,m1,p); } } cout << p; }
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::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:22:9: required from here 22 | m=max(a,b,c)-min(a,b,c); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /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:22:20: required from here 22 | m=max(a,b,c)-min(a,b,c); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s328863694
p03715
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> using namespace std; int main() { long long h,w,p,i,a,b,c,b1,c1,m,m1; cin >> h >> w; p=10000000000; for(i=h/3; i<=h/3+3; i++) { if(i!=0 && i<h) { a=i*w; b=(h-i)/2*w; c=(h*w-a-b); b1=(w/2)*(h-i); c1=h*w-a-b1; m=max(a,b,c)-min(a,b,c); m1=max(a,b1,c1)-min(a,b1,c1); p=min(m,m1,p); } } for(i=w/3; i<=w/3+3; i++) { if(i!=0 && i<w) { a=i*h; b=(w-i)/2*h; c=(h*w-a-b); b1=(h/2)*(w-i); c1=h*w-a-b1; m=max(a,b,c)-min(a,b,c); m1=max(a,b1,c1)-min(a,b1,c1); p=min(m,m1,p); } } cout << p; }
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::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:22:9: required from here 22 | m=max(a,b,c)-min(a,b,c); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /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:22:20: required from here 22 | m=max(a,b,c)-min(a,b,c); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s254735117
p03715
C++
#include <bits/stdc++.h> using namespace std; long long int h, w; long long int ans=100000000000000; int main() { cin >> h >> w; if (h%3==0 || w%3==0) ans = 0; for (int i = 1; i < w; ++i) ans = min({ans, max(abs(h*i - (w-i)*(h/2)), abs(h*i - (w-i)*(h/2+h%2)), h%2 ? w-i : 0)}); for (int i = 1; i < h; ++i) ans = min({ans, max(abs(w*i - (h-i)*(w/2)), abs(w*i - (h-i)*(w/2+w%2)), w%2 ? h-i : 0)}); cout << min({ans, h, w}) << endl; }
In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:12:49: required from here 12 | for (int i = 1; i < w; ++i) ans = min({ans, max(abs(h*i - (w-i)*(h/2)), abs(h*i - (w-i)*(h/2+h%2)), h%2 ? w-i : 0)}); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~
s050930035
p03715
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define ll long long #define pb(a) push_back(a) #define INF 1000000000000000000LL #define MOD 1000000007 #define writeln(n) cout<<n<<endl using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; //vector<tuple<long long, long long, long long>>vec; template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } int dy[] = {0, 0, 1, -1, 0}; int dx[] = {1, -1, 0, 0, 0}; int main() { ll h,w; cin>>h>>w; ll ans=INF; if(h%3==0||w%3==0)ans=0; else{ ans=min(h,w); ll t=h/2; for(ll i=1;i<=w-1;i++){ ll a=t*(w-i); ll b=(h-t)*(w-i); ll c=h*i; ans=min(ans,max({a,b,c})-min({a,b,c})); } t=w/2; for(ll i=1;i<=h-1;i++){ ll a=t*(h-i); ll b=(w-t)*(h-i); ll c=w*i; ans=min(ans,max({a,b,c})-min({a,b,c})); } } cout<<ans<<endl; }
a.cc:16:14: error: 'llong' was not declared in this scope; did you mean 'ulong'? 16 | typedef pair<llong, llong> LP; | ^~~~~ | ulong a.cc:16:21: error: 'llong' was not declared in this scope; did you mean 'ulong'? 16 | typedef pair<llong, llong> LP; | ^~~~~ | ulong a.cc:16:26: error: template argument 1 is invalid 16 | typedef pair<llong, llong> LP; | ^ a.cc:16:26: error: template argument 2 is invalid a.cc:18:14: error: 'llong' was not declared in this scope; did you mean 'ulong'? 18 | typedef pair<llong, LP> LPP; | ^~~~~ | ulong a.cc:18:23: error: template argument 1 is invalid 18 | typedef pair<llong, LP> LPP; | ^
s958033167
p03715
C++
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <numeric> using namespace std; int main(){ long long H, W; cin >> H >> W; if(H % 3 == 0 || W % 3 == 0){ cout << 0 << endl; } else{ long long minA = min(H, W); for(int w1 = 1; w1 < W; w1++){ vector<long long> area(3); long long h1 = H / 2; area[0] = H * w1; area[1] = h1 * (W - w1); area[2] = (H-h1) * (W - w1); sort(area.begin(), area.end()); minA = min( minA, area[2] - area[0]); h1 = H / 2 + 1; area[0] = H * w1; area[1] = h1 * (W - w1); area[2] = (H-h1) * (W - w1); sort(area.begin(), area.end()); minA = min( minA, area[2] - area[0]); } cout << minA << end; } }
a.cc: In function 'int main()': a.cc:35:26: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 35 | cout << minA << end; | ~~~~~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to
s720400499
p03715
C++
##include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) int main(){ int w,h; cin>>w>>h; if(w%3==0||h%3==0) cout<<0; else{ if(w<h) swap(w,h); cout<<max(abs(h*((w+1)/3)-(w-(w+1)/3)*(h/2)),abs(h*((w+1)/3)-((w-(w+1)/3)*((h+1)/2)))); } }
a.cc:1:1: error: stray '##' in program 1 | ##include<bits/stdc++.h> | ^~ a.cc:1:3: error: 'include' does not name a type 1 | ##include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin>>w>>h; | ^~~ a.cc:7:24: error: 'cout' was not declared in this scope 7 | if(w%3==0||h%3==0) cout<<0; | ^~~~ a.cc:9:17: error: 'swap' was not declared in this scope 9 | if(w<h) swap(w,h); | ^~~~ a.cc:10:9: error: 'cout' was not declared in this scope 10 | cout<<max(abs(h*((w+1)/3)-(w-(w+1)/3)*(h/2)),abs(h*((w+1)/3)-((w-(w+1)/3)*((h+1)/2)))); | ^~~~ a.cc:10:19: error: 'abs' was not declared in this scope 10 | cout<<max(abs(h*((w+1)/3)-(w-(w+1)/3)*(h/2)),abs(h*((w+1)/3)-((w-(w+1)/3)*((h+1)/2)))); | ^~~ a.cc:10:15: error: 'max' was not declared in this scope 10 | cout<<max(abs(h*((w+1)/3)-(w-(w+1)/3)*(h/2)),abs(h*((w+1)/3)-((w-(w+1)/3)*((h+1)/2)))); | ^~~
s173896360
p03715
C++
#include <iostream> #include <cstdio> #include <queue> #include <vector> #include <stack> #include <string> #include <tuple> #include <random> #include <map> #include <set> #include <complex> #include <algorithm> #include <cassert> #include <iterator> #include <numeric> #include <cmath> #include <stdio.h> #include <functional> #define REP(i,a) for(int (i)=0;(i)<(a);i++) #define RREP(i,a,b) for(int (i)=(a);(i)<(b);i++) #define all(c) (c).begin(),(c).end() #define sz(v) (int)(v).size() #define vi vector<int> typedef long long ll; using namespace std; int main(void){ ll H,W; cin>>H>>W; ll ans=99999999; if(H%3==0 || W%3==0){ cout<<"0"; }else{ ll S1=0,S2=0,S3=0; ll H2=(int)H/2; ll W2=(int)W/2; ll tmp; RREP(i,1,W){ S1=H2*i; S2=(H-H2)*i; S3=(W-i)*H; tmp=max({S1,S2,S3})-min({S1,S2,S3}); ans=min(ans,tmp); } RREP(i,1,H){ S1=W2*i; S2=(W-W2)*i; S3=(H-i)*W; tmp=max({S1,S2,S3})-min({S1,S2,S3}); ans=min(ans,tmp); } ll I1= (ll)H/3,I2=(ll)(H-I1)/2,I3=H-I1-I2; S1=I1*W; S2=I2*W; S3=I3*W; tmp=max({S1,S2,S3})-min({S1,S2,S3}); ans=min(ans,tmp); ll X1= (ll)W/3,X2=(ll)(W-X1)/2,I3=W-X1-X2; S1=X1*H; S2=X2*H; S3=X3*H; tmp=max({S1,S2,S3})-min({S1,S2,S3}); ans=min(ans,tmp); cout<<ans; } return 0; }
a.cc: In function 'int main()': a.cc:59:40: error: redeclaration of 'll I3' 59 | ll X1= (ll)W/3,X2=(ll)(W-X1)/2,I3=W-X1-X2; | ^~ a.cc:53:40: note: 'll I3' previously declared here 53 | ll I1= (ll)H/3,I2=(ll)(H-I1)/2,I3=H-I1-I2; | ^~ a.cc:62:12: error: 'X3' was not declared in this scope; did you mean 'X2'? 62 | S3=X3*H; | ^~ | X2
s565821919
p03715
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long H = sc.nextLong(); long W = sc.nextLong(); long ans = Integer.MAX_VALUE; if(H % 3 == 0 || W % 3 == 0) ans = 0; int a, b, c; for(int i = 0; i <= 1; i++) { a = (W/3+i)*H; b = (W-i-W/3)*(H/2); ans = Math.min(ans, Math.abs(a-b)); a = (H/3+i)*W; b = (H-i-H/3)*(W/2); ans = Math.min(ans, Math.abs(a-b)); } System.out.println(ans); } }
Main.java:13: error: incompatible types: possible lossy conversion from long to int a = (W/3+i)*H; ^ Main.java:14: error: incompatible types: possible lossy conversion from long to int b = (W-i-W/3)*(H/2); ^ Main.java:16: error: incompatible types: possible lossy conversion from long to int a = (H/3+i)*W; ^ Main.java:17: error: incompatible types: possible lossy conversion from long to int b = (H-i-H/3)*(W/2); ^ 4 errors
s008784496
p03715
C++
#include <bits/stdc++.h> #include <cstdio> #include <cstdlib> using namespace std; typedef long long ll; #define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++) int main() { int N; cin >> N; ll a[300100]; FOR(i, 0, 3 * N) cin >> a[i]; priority_queue<ll, vector<ll>, greater<ll>> pque_front; priority_queue<ll> pque_back; ll sum1i= 0, sum2i = 0; FOR(j, 0, N) { sum1i += a[j]; pque_front.push(a[j]); } FOR(j, 2 * N , 3 * N) { sum2i += a[j]; pque_back.push(a[j]); } ll sum1[300100], sum2[300100]; sum1[N - 1] = sum1i; sum2[2 * N] = sum2i; ll ans = sum1 - sum2; FOR(j, N , 2 * N ){ sum1[j] = sum1[j - 1] + a[j]; pque_front.push(a[j]); sum1[j] = sum[j - 1] - pque_front.top(); pque_front.pop(); sum2[3 * N - 1 - j] = sum2[3 * N - j] + a[3 * N - 1 - j]; pque_back.push(a[j]); sum2[3 * N - 1 - j] = sum2[3 * N - j] - pque_back.top(); pque_back.pop(); } FOR(j, N , 2 * N ){ ll sum = sum1[j] - sum2[3 * N - 1 - j]; ans = max(ans, sum); } printf("%lld\n", ans); }
a.cc: In function 'int main()': a.cc:39:19: error: 'sum' was not declared in this scope; did you mean 'sum2'? 39 | sum1[j] = sum[j - 1] - pque_front.top(); | ^~~ | sum2
s612951306
p03715
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 = 1e9 + 7; const int MAX_N = 5e5 + 5; int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL }; 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 = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; } inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * 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 + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; 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, -1LL); } 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() { int h,w; cin >> h >> w; //from left int ans = 1919810114514; for (int i = 1;i <= w;i++) { int mi = min({h * i,(w-i)/2 * h,(w-(w-1)/2) * h}); int ma = max({h * i,(w-i)/2 * h,(w-(w-1)/2) * h}); ans = min(ans,ma-mi); int mi = min({h * i,h/2*(w-i),(h-h/2)*(w-i)}); int ma = max({h * i,h/2*(w-i),(h-h/2)*(w-i)}); ans = min(ans,ma-mi); } for (int i = 1;i <= h;i++) { int mi = min({w * i,(h-i)/2 * w,(h-(h-1)/2) * w}); int ma = max({w * i,(h-i)/2 * w,(h-(h-1)/2) * w}); ans = min(ans,ma-mi); int mi = min({w * i,w/2*(h-i),(w-w/2)*(h-i)}); int ma = max({w * i,w/2*(h-i),(w-w/2)*(h-i)}); ans = min(ans,ma-mi); } }
a.cc: In function 'int main()': a.cc:134:21: error: redeclaration of 'long long int mi' 134 | int mi = min({h * i,h/2*(w-i),(h-h/2)*(w-i)}); | ^~ a.cc:131:21: note: 'long long int mi' previously declared here 131 | int mi = min({h * i,(w-i)/2 * h,(w-(w-1)/2) * h}); | ^~ a.cc:135:21: error: redeclaration of 'long long int ma' 135 | int ma = max({h * i,h/2*(w-i),(h-h/2)*(w-i)}); | ^~ a.cc:132:21: note: 'long long int ma' previously declared here 132 | int ma = max({h * i,(w-i)/2 * h,(w-(w-1)/2) * h}); | ^~ a.cc:142:21: error: redeclaration of 'long long int mi' 142 | int mi = min({w * i,w/2*(h-i),(w-w/2)*(h-i)}); | ^~ a.cc:139:21: note: 'long long int mi' previously declared here 139 | int mi = min({w * i,(h-i)/2 * w,(h-(h-1)/2) * w}); | ^~ a.cc:143:21: error: redeclaration of 'long long int ma' 143 | int ma = max({w * i,w/2*(h-i),(w-w/2)*(h-i)}); | ^~ a.cc:140:21: note: 'long long int ma' previously declared here 140 | int ma = max({w * i,(h-i)/2 * w,(h-(h-1)/2) * w}); | ^~
s604363026
p03715
C++
#include <bits/stdc++.h> using namespace std; #define llong long long int #define ldouble long double #define rep(i, n) for (int i = 0; i < n; ++i) #define all(x) x.begin(), x.end() #define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr) const static int MOD = 1000000000 + 7; const static llong INF = 1LL << 60; const static int dy[] = {0, 1, 0, -1}; const static int dx[] = {1, 0, -1, 0}; signed main (int argc, char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); llong H, W; cin >> H >> W; llong ans = INF; for (llong w = 1; w < W; ++w) { if (W == 2) { // 横 if (H % 2 == 0) { ans = min(ans, max(w * H, (W - w) * H / 2) - min(w * H, (W - w) * H / 2)); } else { ans = min(ans, max(w * H, (W - w) * ((H / 2 + 1))) - min(w * H, (W - w) * H / 2)); } } else { // 横 if (H % 2 == 0) { ans = min(ans, max(w * H, (W - w) * (H / 2)) - min(w * H, (W - w) * (H / 2))); } else { ans = min(ans, max(w * H, (W - w) * (H / 2 + 1)) - min(w * H, (W - w) * (H / 2))); } // 縦 if ((W - w) % 2 == 1) {s if ((W - w) != 1) ans = min(ans, max(w * H, H * ((W - w) / 2 + 1)) - min(w * H, H * ((W - w) / 2))); } else { if ((W - w) != 1) ans = min(ans, max(w * H, H * ((W - w) / 2)) - min(w * H, H * (W - w) / 2)); } } // cout << w << " " << ans << " " << "縦終わり" << endl; } for (llong h = 1; h < H; ++h) { if (H == 2) { //縦 if (W % 2 == 0) { ans = min(ans, max(h * W, (H - h) * W / 2) - min(h * W, (H - h) * W / 2)); } else { ans = min(ans, max(h * W, (H - h) * (W / 2 + 1)) - min(h * W, (H - h) * W / 2)); } } else { // 縦 if (W % 2 == 0) { ans = min(ans, max(h * W, (H - h) * W / 2) - min(h * W, (H - h) * W / 2)); } else { ans = min(ans, max(h * W, (H - h) * (W / 2 + 1)) - min(h * W, (H - h) * (W / 2))); } // 横 if ((H - h) % 2 == 1) { if ((H - h) != 1) ans = min(ans, max(h * W, W * (((H - h) / 2) + 1)) - min(h * W, W * ((H - h) / 2))); } else { if ((H - h) != 1) ans = min(ans, max(h * W, W * (H - h) / 2) - min(h * W, W * ((H - h) / 2))); } } //cout << h << " " << ans << endl; } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, char**)': a.cc:40:36: error: 's' was not declared in this scope 40 | if ((W - w) % 2 == 1) {s | ^
s488771938
p03715
C++
#include<iostream> #include<cmath> #include<algorithm> using namespace std; int Case1(int h, int w) { if (h % 3 == 0) { return 0; } else { return w; } } /*long long min(long long a, long long b) { if (a > b) { return b; } else { return a; } }*/ long long Case2(int h, int w) { long long block[3]; long long mindiff = 1e10; for (int i = 1; i < h; ++i) { block[0] = i * w; block[1] = (w / 2 + w % 2) * (h - i); // () is important! block[2] = w / 2 * (h - i); mindiff = min(mindiff, max(block[0], block[1]) - min(block[0] - block[2])); } return mindiff; } int main() { int h, w; cin >> h >> w; cout << min({Case1(h, w), Case1(w, h), Case2(h, w), Case2(w, h)}) << endl; return 0; }
a.cc: In function 'long long int Case2(int, int)': a.cc:26:61: error: no matching function for call to 'min(long long int)' 26 | mindiff = min(mindiff, max(block[0], block[1]) - min(block[0] - block[2])); | ~~~^~~~~~~~~~~~~~~~~~~~~ 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 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: template argument deduction/substitution failed: a.cc:26:61: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 26 | mindiff = min(mindiff, max(block[0], block[1]) - min(block[0] - block[2])); | ~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc: In function 'int main()': a.cc:32:16: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 32 | cout << min({Case1(h, w), Case1(w, h), Case2(h, w), Case2(w, h)}) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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 /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:32:16: note: deduced conflicting types for parameter '_Tp' ('int' and 'long long int') 32 | cout << min({Case1(h, w), Case1(w, h), Case2(h, w), Case2(w, h)}) << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s171186365
p03715
C++
#include<iostream> #include<cmath> using namespace std; int Case1(int h, int w) { switch (h % 3) { case 0: return 0; default: return w; } } long long Case2(int h, int w) { long long block[3]; long long mindiff = 1e10; //int j = 0; for (int i = 1; i < h; ++i) { block[0] = i * w; if (w % 2 == 0) { block[1] = block[2] = (h - i) * (w / 2); } else { block[1] = (h - i) * (w / 2); // () is important! block[2] = (h - i) * (w / 2 + 1); } sort(block, block + 3); if (mindiff > block[2] - block[0]) { mindiff = block[2] - block[0]; //j = i; } } //cout << j << endl; return mindiff; } int main() { int h, w; cin >> h >> w; long long min = 1e10; long long c[4]; c[0] = Case1(h, w); c[1] = Case1(w, h); c[2] = Case2(h, w); c[3] = Case2(w, h); /*for (int i = 0; i < 4; ++i) { cout << c[i] << " "; if (i == 3) cout << endl; }*/ sort(c, c + 4); min = c[0]; cout << min << endl; return 0; }
a.cc: In function 'long long int Case2(int, int)': a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 24 | sort(block, block + 3); | ^~~~ | sqrt a.cc: In function 'int main()': a.cc:45:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 45 | sort(c, c + 4); | ^~~~ | sqrt
s619428648
p03715
C++
#include<iostream> #include<cmath> using namespace std; int Case1(int h, int w) { switch (h % 3) { case 0: return 0; default: return w; } } long long Case2(int h, int w) { long long block[3]; long long mindiff = 1e10; //int j = 0; for (int i = 1; i < h; ++i) { block[0] = i * w; if (w % 2 == 0) { block[1] = block[2] = (h - i) * (w / 2); } else { block[1] = (h - i) * (w / 2); // () is important! block[2] = (h - i) * (w / 2 + 1); } sort(block, block + 3); if (mindiff > block[2] - block[0]) { mindiff = block[2] - block[0]; //j = i; } } //cout << j << endl; return mindiff; } int main() { int h, w; cin >> h >> w; long long min = 1e10; long long c[4]; c[0] = Case1(h, w); c[1] = Case1(w, h); c[2] = Case2(h, w); c[3] = Case2(w, h); for (int i = 0; i < 4; ++i) { cout << c[i] << " "; if (i == 3) cout << endl; } sort(c, c + 4); min = c[0]; cout << min << endl; return 0; }
a.cc: In function 'long long int Case2(int, int)': a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 24 | sort(block, block + 3); | ^~~~ | sqrt a.cc: In function 'int main()': a.cc:45:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 45 | sort(c, c + 4); | ^~~~ | sqrt
s314058055
p03715
C++
#include "bits/stdc++.h" using namespace std; #define ll long long int #define rep(i,n) for( int i = 0; i < n; i++ ) #define rrep(i,n) for( int i = n; i >= 0; i-- ) #define REP(i,s,t) for( int i = s; i <= t; i++ ) #define RREP(i,s,t) for( int i = s; i >= t; i-- ) #define dump(x) cerr << #x << " = " << (x) << endl; #define INF 2000000000 #define mod 1000000007 #define INF2 1000000000000000000 #define int long long signed main(void) { cin.tie(0); ios::sync_with_stdio(false); int H, W; cin >> H >> W; cout << min(H % 3, W % 3) * max(2, min(H - H % 2, W - W % 2)) / 2 << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:40: error: no matching function for call to 'max(int, const long long int&)' 19 | cout << min(H % 3, W % 3) * max(2, min(H - H % 2, W - W % 2)) / 2 << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: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:19:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 19 | cout << min(H % 3, W % 3) * max(2, min(H - H % 2, W - W % 2)) / 2 << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:19:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 19 | cout << min(H % 3, W % 3) * max(2, min(H - H % 2, W - W % 2)) / 2 << endl; | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s138328089
p03715
C++
#include<stdio.h> int main(){ long h,w,d,ans=1000000000,i,keep; scanf("%ld%ld",&h,&w); for(i=1,i<h;i++){ d=(w*i)-(((h-i)/2)*w); if(d<0){ if((h-i)%2==1) d-=w; d=-d; } if(d<ans) ans=d; d=(w*i)-(h-i)*(w/2); if(d<0){ if(w%2==1) d-=(h-i); d=-d; } if(d<ans) ans=d; } keep=h; h=w; w=keep; for(i=1,i<h;i++){ d=(w*i)-(((h-i)/2)*w); if(d<0){ if((h-i)%2==1) d-=w; d=-d; } if(d<ans) ans=d; d=(w*i)-(h-i)*(w/2); if(d<0){ if(w%2==1) d-=(h-i); d=-d; } if(d<ans) ans=d; } printf("%ld\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:5:16: error: expected ';' before ')' token 5 | for(i=1,i<h;i++){ | ^ | ; a.cc:26:16: error: expected ';' before ')' token 26 | for(i=1,i<h;i++){ | ^ | ;
s993084205
p03715
C++
#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #include <random> #include <unordered_map> #include <unordered_set> using namespace std; //呪文 #define DUMPOUT cerr #define dump(...) DUMPOUT<<" ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;DUMPOUT<<" ";dump_func(__VA_ARGS__) typedef unsigned uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef pair<string, string> pss; template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { ostr << "{" << m.first << ", " << m.second << "}"; return ostr; } template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const unordered_map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const unordered_set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const stack<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } stack<_Ty> t(s); ostr << "{" << t.top(); t.pop(); while (!t.empty()) { ostr << ", " << t.top(); t.pop(); } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const list<_Ty>& l) { if (l.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << l.front(); for (auto itr = ++l.begin(); itr != l.end(); ++itr) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { istr >> m.first >> m.second; return istr; } template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) istr >> v[i]; return istr; } namespace aux { // print tuple template<typename Ty, unsigned N, unsigned L> struct tp { static void print(ostream& os, const Ty& v) { os << get<N>(v) << ", "; tp<Ty, N + 1, L>::print(os, v); } }; template<typename Ty, unsigned N> struct tp<Ty, N, N> { static void print(ostream& os, const Ty& value) { os << get<N>(value); } }; } template<typename... Tys> ostream& operator<<(ostream& os, const tuple<Tys...>& t) { os << "{"; aux::tp<tuple<Tys...>, 0, sizeof...(Tys)-1>::print(os, t); os << "}"; return os; } template<typename A, size_t N, typename T> inline void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } void dump_func() { DUMPOUT << endl; } template <class Head, class... Tail> void dump_func(Head&& head, Tail&&... tail) { DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #define PI 3.14159265358979323846 #define EPS 1e-8 #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define fake false int main() { cin.tie(0); ios::sync_with_stdio(false); ll H, W; cin >> H >> W; ll ans = INT64_MAX; if (H % 3 == 0) { cout << 0 << endl; return 0; } else ans = min(ans, W); if (W % 3 == 0) { cout << 0 << endl; return 0; } else ans = min(ans, H); for (int i = 0; i <= H; i++) { ll w = W / 2; ll s0 = W * i; ll s1 = w * (H - i); ll s2 = (W - w) * (H - i); ll dif = max(s0, max(s1, s2)) - min(s0, min(s1, s2)); ans = min(ans, dif); } for (int i = 0; i <= W; i++) { ll h = H / 2; ll s0 = H * i; ll s1 = h * (W - i); ll s2 = (H - h) * (W - i); ll dif = max(s0, max(s1, s2)) - min(s0, min(s1, s2)); ans = min(ans, dif); } cout << ans << endl; return 0; }#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #include <random> #include <unordered_map> #include <unordered_set> using namespace std; //呪文 #define DUMPOUT cerr #define dump(...) DUMPOUT<<" ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;DUMPOUT<<" ";dump_func(__VA_ARGS__) typedef unsigned uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, double> pdd; typedef pair<string, string> pss; template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { ostr << "{" << m.first << ", " << m.second << "}"; return ostr; } template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const unordered_map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const unordered_set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const stack<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } stack<_Ty> t(s); ostr << "{" << t.top(); t.pop(); while (!t.empty()) { ostr << ", " << t.top(); t.pop(); } ostr << "}"; return ostr; } template <typename _Ty> ostream& operator << (ostream& ostr, const list<_Ty>& l) { if (l.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << l.front(); for (auto itr = ++l.begin(); itr != l.end(); ++itr) { ostr << ", " << *itr; } ostr << "}"; return ostr; } template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { istr >> m.first >> m.second; return istr; } template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) istr >> v[i]; return istr; } namespace aux { // print tuple template<typename Ty, unsigned N, unsigned L> struct tp { static void print(ostream& os, const Ty& v) { os << get<N>(v) << ", "; tp<Ty, N + 1, L>::print(os, v); } }; template<typename Ty, unsigned N> struct tp<Ty, N, N> { static void print(ostream& os, const Ty& value) { os << get<N>(value); } }; } template<typename... Tys> ostream& operator<<(ostream& os, const tuple<Tys...>& t) { os << "{"; aux::tp<tuple<Tys...>, 0, sizeof...(Tys)-1>::print(os, t); os << "}"; return os; } template<typename A, size_t N, typename T> inline void Fill(A(&array)[N], const T &val) { std::fill((T*)array, (T*)(array + N), val); } void dump_func() { DUMPOUT << endl; } template <class Head, class... Tail> void dump_func(Head&& head, Tail&&... tail) { DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...); } #define PI 3.14159265358979323846 #define EPS 1e-8 #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define all(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define fake false int main() { cin.tie(0); ios::sync_with_stdio(false); ll H, W; cin >> H >> W; ll ans = INT64_MAX; if (H % 3 == 0) { cout << 0 << endl; return 0; } else ans = min(ans, W); if (W % 3 == 0) { cout << 0 << endl; return 0; } else ans = min(ans, H); for (int i = 0; i <= H; i++) { ll w = W / 2; ll s0 = W * i; ll s1 = w * (H - i); ll s2 = (W - w) * (H - i); ll dif = max(s0, max(s1, s2)) - min(s0, min(s1, s2)); ans = min(ans, dif); } for (int i = 0; i <= W; i++) { ll h = H / 2; ll s0 = H * i; ll s1 = h * (W - i); ll s2 = (H - h) * (W - i); ll dif = max(s0, max(s1, s2)) - min(s0, min(s1, s2)); ans = min(ans, dif); } cout << ans << endl; return 0; }
a.cc:90:2: error: stray '#' in program 90 | }#define _CRT_SECURE_NO_WARNINGS | ^ a.cc:90:3: error: 'define' does not name a type 90 | }#define _CRT_SECURE_NO_WARNINGS | ^~~~~~ a.cc:103:49: error: redefinition of 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)' 103 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { ostr << "{" << m.first << ", " << m.second << "}"; return ostr; } | ^~~~~~~~ a.cc:14:49: note: 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)' previously declared here 14 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { ostr << "{" << m.first << ", " << m.second << "}"; return ostr; } | ^~~~~~~~ a.cc:104:49: error: redefinition of 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::map<_KTy, _Ty>&)' 104 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:15:49: note: 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::map<_KTy, _Ty>&)' previously declared here 15 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:105:49: error: redefinition of 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::unordered_map<_KTy, _Ty>&)' 105 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const unordered_map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:16:49: note: 'template<class _KTy, class _Ty> std::ostream& operator<<(std::ostream&, const std::unordered_map<_KTy, _Ty>&)' previously declared here 16 | template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const unordered_map<_KTy, _Ty>& m) { if (m.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:106:34: error: redefinition of 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' 106 | template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:17:34: note: 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' previously declared here 17 | template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:107:34: error: redefinition of 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::set<_Ty>&)' 107 | template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:18:34: note: 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::set<_Ty>&)' previously declared here 18 | template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:108:34: error: redefinition of 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::unordered_set<_Ty>&)' 108 | template <typename _Ty> ostream& operator << (ostream& ostr, const unordered_set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:19:34: note: 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::unordered_set<_Ty>&)' previously declared here 19 | template <typename _Ty> ostream& operator << (ostream& ostr, const unordered_set<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:109:34: error: redefinition of 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::stack<_Ty>&)' 109 | template <typename _Ty> ostream& operator << (ostream& ostr, const stack<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } stack<_Ty> t(s); ostr << "{" << t.top(); t.pop(); while (!t.empty()) { ostr << ", " << t.top(); t.pop(); } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:20:34: note: 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::stack<_Ty>&)' previously declared here 20 | template <typename _Ty> ostream& operator << (ostream& ostr, const stack<_Ty>& s) { if (s.empty()) { ostr << "{ }"; return ostr; } stack<_Ty> t(s); ostr << "{" << t.top(); t.pop(); while (!t.empty()) { ostr << ", " << t.top(); t.pop(); } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:110:34: error: redefinition of 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::__cxx11::list<_Ty>&)' 110 | template <typename _Ty> ostream& operator << (ostream& ostr, const list<_Ty>& l) { if (l.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << l.front(); for (auto itr = ++l.begin(); itr != l.end(); ++itr) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:21:34: note: 'template<class _Ty> std::ostream& operator<<(std::ostream&, const std::__cxx11::list<_Ty>&)' previously declared here 21 | template <typename _Ty> ostream& operator << (ostream& ostr, const list<_Ty>& l) { if (l.empty()) { ostr << "{ }"; return ostr; } ostr << "{" << l.front(); for (auto itr = ++l.begin(); itr != l.end(); ++itr) { ostr << ", " << *itr; } ostr << "}"; return ostr; } | ^~~~~~~~ a.cc:111:49: error: redefinition of 'template<class _KTy, class _Ty> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' 111 | template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { istr >> m.first >> m.second; return istr; } | ^~~~~~~~ a.cc:22:49: note: 'template<class _KTy, class _Ty> std::istream& operator>>(std::istream&, std::pair<_T1, _T2>&)' previously declared here 22 | template <typename _KTy, typename _Ty> istream& operator >> (istream& istr, pair<_KTy, _Ty>& m) { istr >> m.first >> m.second; return istr; } | ^~~~~~~~ a.cc:112:34: error: redefinition of 'template<class _Ty> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' 112 | template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) istr >> v[i]; return istr; } | ^~~~~~~~ a.cc:23:34: note: 'template<class _Ty> std::istream& operator>>(std::istream&, std::vector<_Tp>&)' previously declared here 23 | template <typename _Ty> istream& operator >> (istream& istr, vector<_Ty>& v) { for (size_t i = 0; i < v.size(); i++) istr >> v[i]; return istr; } | ^~~~~~~~ a.cc:114:62: error: redefinition of 'struct aux::tp<Ty, N, L>' 114 | template<typename Ty, unsigned N, unsigned L> struct tp { static void print(ostream& os, const Ty& v) { os << get<N>(v) << ", "; tp<Ty, N + 1, L>::print(os, v); } }; | ^~ a.cc:25:62: note: previous definition of 'struct aux::tp<Ty, N, L>' 25 | template<typename Ty, unsigned N, unsigned L> struct tp { static void print(ostream& os, const Ty& v) { os << get<N>(v) << ", "; tp<Ty, N + 1, L>::print(os, v); } }; | ^~ a.cc:115:50: error: redefinition of 'struct aux::tp<Ty, N, N>' 115 | template<typename Ty, unsigned N> struct tp<Ty, N, N> { static void print(ostream& os, const Ty& value) { os << get<N>(value); } }; | ^~~~~~~~~~~~ a.cc:26:50: note: previous definition of 'struct aux::tp<Ty, N, N>' 26 | template<typename Ty, unsigned N> struct tp<Ty, N, N> { static void print(ostream& os, const Ty& value) { os << get<N>(value); } }; | ^~~~~~~~~~~~ a.cc:117:36: error: redefinition of 'template<class ... Tys> std::ostream& operator<<(std::ostream&, const std::tuple<_UTypes ...>&)'
s013998462
p03715
C++
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9+7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int main(){ ll h,w;cin>>h>>w; ll ans=llINF; if(h%3==0||w%3==0){ cout<<0<<endl; }else{ if(h%2&&w%2){ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2&&w%2==0){ ans=min(ans,h*(w/2)-((h/2)+1)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2==0&&w%2){ ans=min(ans,h*(w/2)-(h/2)*((w/2)+1)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else{ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-
a.cc: In function 'int main()': a.cc:37:25: error: expected primary-expression at end of input 37 | ans=min(ans,(h/2)*w- | ^ a.cc:37:25: error: expected '}' at end of input a.cc:33:10: note: to match this '{' 33 | }else{ | ^ a.cc:37:25: error: expected '}' at end of input 37 | ans=min(ans,(h/2)*w- | ^ a.cc:17:8: note: to match this '{' 17 | }else{ | ^ a.cc:37:25: error: expected '}' at end of input 37 | ans=min(ans,(h/2)*w- | ^ a.cc:12:11: note: to match this '{' 12 | int main(){ | ^
s509967683
p03715
C++
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9+7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int main(){ int h,w;cin>>h>>w; ll ans=llINF; if(h%3==0||w%3==0){ cout<<0<<endl; }else{ if(h%2&&w%2){ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2&&w%2==0){ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else if(h%2==0&&w%2){ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); }else{ ans=min(ans,h*(w/2)-(h/2)*(w/2)); ans=min(ans,(h/3)*w); ans=min(ans,h*(w/3)); ans=min(ans,(h/2)*w-(h/2)*(w/2)); } cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:14: error: no matching function for call to 'min(long long int&, int)' 19 | ans=min(ans,h*(w/2)-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ 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:19:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 19 | ans=min(ans,h*(w/2)-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /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:19:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 19 | ans=min(ans,h*(w/2)-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:20:14: error: no matching function for call to 'min(long long int&, int)' 20 | ans=min(ans,(h/3)*w); | ~~~^~~~~~~~~~~~~ /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:20:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 20 | ans=min(ans,(h/3)*w); | ~~~^~~~~~~~~~~~~ /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:20:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | ans=min(ans,(h/3)*w); | ~~~^~~~~~~~~~~~~ a.cc:21:14: error: no matching function for call to 'min(long long int&, int)' 21 | ans=min(ans,h*(w/3)); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:21:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 21 | ans=min(ans,h*(w/3)); | ~~~^~~~~~~~~~~~~ /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:21:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 21 | ans=min(ans,h*(w/3)); | ~~~^~~~~~~~~~~~~ a.cc:22:14: error: no matching function for call to 'min(long long int&, int)' 22 | ans=min(ans,(h/2)*w-(h/2)*(w/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:22:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 22 | ans=min(ans,(h/2)*w-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /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:22:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | ans=min(ans,(h/2)*w-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:24:14: error: no matching function for call to 'min(long long int&, int)' 24 | ans=min(ans,h*(w/2)-(h/2)*(w/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:24:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 24 | ans=min(ans,h*(w/2)-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /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:24:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 24 | ans=min(ans,h*(w/2)-(h/2)*(w/2)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:25:14: error: no matching function for call to 'min(long long int&, int)' 25 | ans=min(ans,(h/3)*w); | ~~~^~~~~~~~~~~~~ /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:25:14: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 25 | ans=min(ans,(h/3)*w); | ~~~^~~~~~~~~~~~~ /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> cons
s037391060
p03715
C++
#include <bits/stdc++.h> using namespace std; #define int long long; int f(int x, int y, int z) { return max({x,y,z})-min({x,y,z}); } int gs(int x,int y){ if(x*y%2==0)return x*y/2; if(x<y)swap(x,y); return x/2*y; } int gl(int x,int y){ if(x*y%2==0)return x*y/2; if(x<y)swap(x,y); return (x/2+1)*y; } signed main(){ int h, w; cin >> h >> w; int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w))); swap(h,w); res=min(res,f(h/3*w,gs(h-h/3,w),gl(h-h/3,w))); res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w))); cout << res << endl; return 0; }
a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:4:1: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:4:7: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:4:6: note: to match this '(' 4 | int f(int x, int y, int z) { | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:4:7: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:4:11: error: 'x' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:4:18: error: 'y' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:4:25: error: 'z' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:7:1: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:7:8: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:7:7: note: to match this '(' 7 | int gs(int x,int y){ | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:7:8: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:7:12: error: 'x' does not name a type 7 | int gs(int x,int y){ | ^ a.cc:7:18: error: 'y' does not name a type 7 | int gs(int x,int y){ | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:12:1: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:12:8: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:12:7: note: to match this '(' 12 | int gl(int x,int y){ | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:12:8: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:12:12: error: 'x' does not name a type 12 | int gl(int x,int y){ | ^ a.cc:12:18: error: 'y' does not name a type 12 | int gl(int x,int y){ | ^ a.cc: In function 'int main()': a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:18:3: note: in expansion of macro 'int' 18 | int h, w; | ^~~ a.cc:18:7: error: 'h' was not declared in this scope 18 | int h, w; | ^ a.cc:18:10: error: 'w' was not declared in this scope 18 | int h, w; | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:20:3: note: in expansion of macro 'int' 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~~ a.cc:20:7: error: 'res' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~~ a.cc:20:19: error: 'gs' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~ a.cc:20:31: error: 'gl' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~ a.cc:20:11: error: 'f' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^
s469755073
p03715
C++
#include <bits/stdc++.h> using namespace std; #define int long long; int f(int x, int y, int z) { return max({x,y,z})-min({x,y,z}); } int gs(int x,int y){ if(x*y%2==0)return x*y/2; if(x<y)swap(x,y); return x/2*y; } int gl(int x,int y){ if(x*y%2==0)return x*y/2; if(x<y)swap(x,y); return (x/2+1)*y; } main(){ int h, w; cin >> h >> w; int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w))); swap(h,w); res=min(res,f(h/3*w,gs(h-h/3,w),gl(h-h/3,w))); res=min(res,f((h/3+1)*w,gs(h-h/3-1,w),gl(h-h/3-1,w))); cout << res << endl; return 0; }
a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:4:1: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:4:7: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:4:6: note: to match this '(' 4 | int f(int x, int y, int z) { | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:4:7: note: in expansion of macro 'int' 4 | int f(int x, int y, int z) { | ^~~ a.cc:4:11: error: 'x' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:4:18: error: 'y' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:4:25: error: 'z' does not name a type 4 | int f(int x, int y, int z) { | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:7:1: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:7:8: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:7:7: note: to match this '(' 7 | int gs(int x,int y){ | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:7:8: note: in expansion of macro 'int' 7 | int gs(int x,int y){ | ^~~ a.cc:7:12: error: 'x' does not name a type 7 | int gs(int x,int y){ | ^ a.cc:7:18: error: 'y' does not name a type 7 | int gs(int x,int y){ | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:12:1: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:3:22: error: expected ')' before ';' token 3 | #define int long long; | ^ a.cc:12:8: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:12:7: note: to match this '(' 12 | int gl(int x,int y){ | ^ a.cc:3:22: error: expected constructor, destructor, or type conversion before ';' token 3 | #define int long long; | ^ a.cc:12:8: note: in expansion of macro 'int' 12 | int gl(int x,int y){ | ^~~ a.cc:12:12: error: 'x' does not name a type 12 | int gl(int x,int y){ | ^ a.cc:12:18: error: 'y' does not name a type 12 | int gl(int x,int y){ | ^ a.cc:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 17 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:18:3: note: in expansion of macro 'int' 18 | int h, w; | ^~~ a.cc:18:7: error: 'h' was not declared in this scope 18 | int h, w; | ^ a.cc:18:10: error: 'w' was not declared in this scope 18 | int h, w; | ^ a.cc:3:18: error: declaration does not declare anything [-fpermissive] 3 | #define int long long; | ^~~~ a.cc:20:3: note: in expansion of macro 'int' 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~~ a.cc:20:7: error: 'res' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~~ a.cc:20:19: error: 'gs' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~ a.cc:20:31: error: 'gl' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^~ a.cc:20:11: error: 'f' was not declared in this scope 20 | int res=f(h/3*w,gs(h-h/3,w),gl(h-h/3,w)); | ^
s061338232
p03715
C++
#include <algorithm> #include <cstring> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <vector> using namespace std; using ll = long long; ll diff(ll a, ll b, ll c) { return max({a, b, c}) - min({a, b, c}); } int main() { ll H, W; cin >> H >> W; ll res = H * W; for (ll h = 1; h <= H; h++) { ll rem = H - h; if (rem >= 2) { ll h1 = rem / 2; ll h2 = rem - h1; res = min(res, diff(h * W, h1 * W, h2 * W)); } if (rem >= 1) { ll w1 = W / 2; ll w2 = W - w1; res = min(res, diff(h * W, w1 * rem, w2 * rem)); } } for (ll w = 1; w <= W; w++) { if (rem >= 2) { ll rem = W - w; ll w1 = rem / 2; ll w2 = rem - w1; res = min(res, diff(w * H, w1 * H, w2 * H)); } if (rem >= 1) { ll h1 = H / 2; ll h2 = H - h1; res = min(res, diff(w * H, h1 * rem, h2 * rem)); } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:33:9: error: 'rem' was not declared in this scope; did you mean 'res'? 33 | if (rem >= 2) { | ^~~ | res a.cc:34:10: error: redeclaration of 'll rem' 34 | ll rem = W - w; | ^~~ a.cc:33:9: note: '<typeprefixerror>rem' previously declared here 33 | if (rem >= 2) { | ^~~ a.cc:39:9: error: 'rem' was not declared in this scope; did you mean 'res'? 39 | if (rem >= 1) { | ^~~ | res
s035241634
p03715
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll solve(int h, int w) { ll Sa, Sb, Sc; for(int i=1; i<h; i++) { } } int main(void) { ll h, w, ans; cin >> h >> w; ans = h * w; for(int k=0;k<2;k++){ for(int i=1;i<h;i++){ int s1=i*w; int s2=(h-i)*(w/2); int s3=h*w-s1-s2; int tmp=max(max(s1,s2),s3)-min(min(s1,s2),s3); ans=min(ans,tmp); } swap(h,w); } ans = min(ans, h); ans = min(ans, w); if(h%3==0||w%3==0) ans=0; cout<<ans<<endl; return 0; }
a.cc: In function 'll solve(int, int)': a.cc:11:1: warning: no return statement in function returning non-void [-Wreturn-type] 11 | } | ^ a.cc: In function 'int main()': a.cc:23:18: error: no matching function for call to 'min(ll&, int&)' 23 | ans=min(ans,tmp); | ~~~^~~~~~~~~ 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:23:18: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 23 | ans=min(ans,tmp); | ~~~^~~~~~~~~ /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:23:18: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 23 | ans=min(ans,tmp); | ~~~^~~~~~~~~
s906124206
p03715
C
#include<iostream> #include<cstdio> #include<queue> using namespace std; const int MAXN = 1e5+10; int n , a[MAXN]; long long ans = -1e18 , f[MAXN] , r[MAXN]; int main() { //freopen("B.inp" , "r" , stdin); //freopen("B.out" , "w" , stdout); scanf("%d",&n); for(int i = 1 ; i<=3*n ; i++) scanf("%d",&a[i]); priority_queue<int , vector<int> , greater<int> > q; for(int i = 1 ; i<=n ; i++) { q.push(a[i]); f[n] += a[i]; } for(int i = n+1 ; i<=2*n ; i++) { if(a[i] <= q.top()) f[i] = f[i-1]; else { f[i]= f[i-1] + a[i] - q.top(); q.pop(); q.push(a[i]); } } priority_queue<int> qq; for(int i = 3*n ; i>=2*n+1 ; i--) { r[2*n+1] += a[i]; qq.push(a[i]); } for(int i = 2*n ; i>=n+1 ; i--) { if(a[i] >= qq.top()) r[i] = r[i+1]; else { r[i] = r[i+1] + a[i] - qq.top(); qq.pop(); qq.push(a[i]); } } for(int i = n ; i <= 2*n ; i++) ans = max(ans , f[i] - r[i+1]); printf("%lld",ans); return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s988511431
p03715
C++
#include <iostream> #include <algorithm> #include <utility> using namespace std; int H, W; long long res = 1000000000; int solve() { for (int i = 1; i <= H - 1; ++i) { long long min_val, max_val; min_val = (long long) i * W; max_val = (long long) i * W; int separated_width; if (W % 2) { separated_width = W / 2 + 1; min_val = min(min_val, (long long) (H - i) * separated_width); max_val = max(max_val, (long long) (H - i) * separated_width); min_val = min(min_val, (long long) (H - i) * (W - separated_width)); max_val = max(max_val, (long long) (H - i) * (W - separated_width)); res = min(res, max_val - min_val); min_val = i * W; max_val = i * W; } separated_width = W / 2; min_val = min(min_val, (long long) (H - i) * separated_width); max_val = max(max_val, (long long) (H - i) * separated_width); min_val = min(min_val, (long long) (H - i) * (W - separated_width)); max_val = max(max_val, (long long) (H - i) * (W - separated_width)); res = min(res, max_val - min_val); } } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> H >> W; solve(); swap(&H, &W); solve(); cout << res << endl; }
a.cc: In function 'int solve()': a.cc:39:1: warning: no return statement in function returning non-void [-Wreturn-type] 39 | } | ^ a.cc: In function 'int main()': a.cc:49:9: error: no matching function for call to 'swap(int*, int*)' 49 | swap(&H, &W); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:49:14: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*' 49 | swap(&H, &W); | ^~ /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types '_Tp [_Nm]' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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: /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' 2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) | ^~~~ /usr/include/c++/14/tuple:2805:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~ /usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted) 2823 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete; | ^~~~ /usr/include/c++/14/tuple:2823:5: note: template argument deduction/substitution failed: a.cc:49:9: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*' 49 | swap(&H, &W); | ~~~~^~~~~~~~
s218592030
p03715
C++
#include<iostream> #include<algorithm> using namespace std; int check(int a,int b){ int c[3]; int s[2]; c[0]=(a/3)*b; c[1]=(a-a/3)*(b/2); c[2]=a*b-c[0]-c[1]; s[0]=max(c[0],c[1],c[2])-min(c[0],c[1],c[2]); c[0]=(a/3+1)*b; c[1]=(a-a/3-1)*(b/2); c[2]=a*b-c[0]-c[1]; s[1]=max(c[0],c[1],c[2])-min(c[0],c[1],c[2]); s[0]=min(s[0],s[1]); return s[0]; } int main(){ int a,b; int s; cin>>a>>b; if(a%3==0 || b%3==0)s=0; else s=min(a,b); s=min(s,check(a,b),check(b,a)); cout<<s<<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:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]': a.cc:11:10: required from here 11 | s[0]=max(c[0],c[1],c[2])-min(c[0],c[1],c[2]); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /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:11:30: required from here 11 | s[0]=max(c[0],c[1],c[2])-min(c[0],c[1],c[2]); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s598013519
p03715
C++
#include <iostream> #include <algorithm> #include <vector> long long int mymax(long long int a1, long long int a2, long long int a3) { if (abs(a1 - a2) > abs(a2 - a3)) { if (abs(a1 - a2) > abs(a1 - a3)) return (a1 - a2); else return abs(a1 - a3); } else { if (abs(a2 - a3) > abs(a1 - a3)) return abs(a2 - a3); else return abs(a1 - a3); } } using namespace std; int main() { int h, w; long long int a1, a2, a3, a0, h0, w0; cin >> h0 >> w0; a0 = h0*w0; w = w0; if (!(h0 % 3) || !(w0 % 3)) cout << "0" << endl; else { if (h0 >= w0) { h = ceil(h0 / 3.0); a1 = h*w; if (!((h0 - h) % 2) || !(w % 2)) cout << abs(a1 - (h0 - h)*w/2) << endl; else { if ((h0 - h) >= w) { h = (h0 - h) / 2; a2 = h*w; a3 = a0 - a1 - a2; long long int list[3] = {a1,a2,a3}; cout << mymax(list[0],list[1],list[2]) << endl; } else { int temp = h0 - h; h = w0 / 2; a2 = h*temp; a3 = a0 - a1 - a2; long long int list[3] = { a1,a2,a3 }; cout << mymax(list[0], list[1], list[2]) << endl; } } } else { int temp = h0; h0 = w0; w0 = temp; h = ceil( h0 / 3.0); a1 = h*w0; if (!((h0 - h) % 2) || !(w0 % 2)) cout << abs(a1 - (h0 - h)*w0 / 2) << endl; else { if ((h0 - h) >= w0) { h = (h0 - h) / 2; a2 = h*w0; a3 = a0 - a1 - a2; long long int list[3] = { a1,a2,a3 }; cout << mymax(list[0], list[1], list[2]) << endl; } else { int temp = h0 - h; h = w0 / 2; a2 = h*temp; a3 = a0 - a1 - a2; long long int list[3] = { a1,a2,a3 }; cout << mymax(list[0], list[1], list[2]) << endl; } } } } return 0; }
a.cc: In function 'int main()': a.cc:36:29: error: 'ceil' was not declared in this scope 36 | h = ceil(h0 / 3.0); | ^~~~ a.cc:66:37: error: 'ceil' was not declared in this scope 66 | h = ceil( h0 / 3.0); | ^~~~
s751540054
p03715
C
#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 <iomanip> #include <iterator> #include <sstream> #define FOR(i,a,b) for (long long i=(a);i<(b);i++) #define RFOR(i,a,b) for (long long i=(b)-1;i>=(a);i--) #define REP(i,n) for (long long i=0;i<(n);i++) #define RREP(i,n) for (long long i=(n)-1;i>=0;i--) #define inf INT_MAX/3 #define INF INT_MAX/3 #define llinf LLONG_MAX/3 #define LLINF LLONG_MAX/3 #define PB push_back #define pb push_back #define MP make_pair #define mp make_pair #define ALL(a) (a).begin(),(a).end() #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 PLL pair<long long,long long> #define pcc pair<char,char> #define pic pair<int,char> #define pci pair<char,int> #define VS vector<string> #define VLL vector<long long> #define VULL vector<unsigned long long> #define debug(x) cout<<#x<<": "<<x<<endl #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 printf #define LL long long #define ll long long #define ULL unsigned long long #define ull unsigned long long #define eps 1e-14 #define FST first #define SCD second using namespace std; const LL ANS_MAX = 1000000007; // ARC074C int main() { LL ret; LL H; LL W; cin >> H >> W; if (H % 3 == 0 || W % 3 == 0) { ret = 0; } else { LL h = (H > W) ? H : W; LL w = (H < W) ? H : W; { LL h0 = ceil((double)h / 3); LL h1 = h - h0; LL w1 = w / 2; ret = abs(h0 * w - h1 * w1); } { LL h0 = floor((double)h / 3); LL h1 = h - h0; LL w1 = w / 2; ret = MIN(ret, abs(h0 * w - h1 * w1)); } } cout << ret << endl; cin >> ret; return 0; }
main.c:1:10: fatal error: vector: No such file or directory 1 | #include <vector> | ^~~~~~~~ compilation terminated.
s496002435
p03715
C++
#include <stdio.h> #include <algorithm> #include <memory.h> #include <iostream> #include <vector> #include <map> #include <deque> // Shabdan Batyrkulov using namespace std; #define pb push_back #define fr first #define sc second #define mk make_pair #define ll long long #define ld long double #define vi vector <int> #define pii pair <int, int> #define OK puts("OK"); const int N = (int)1e5 + 7; const int inf = (int)1e9 + 7; const int MAX = (int)1e3+ 7; int main () { unsigned ll a, b; cin >> a >> b; unsigned ll mn = 0; if (a % 3 == 0 || b % 3 == 0) { puts("0"); } else { mn = a * b * 2; for (int i = 1; i <= b; i++) { unsigned ll mxx = 0, mnn = inf; mxx = max(i * a, max((b - i) * (a / 2), (b - i) * ((a + 1) / 2))); mnn = min(i * a, min((b - i) * (a / 2), (b - i) * ((a + 1) / 2))); mn = min(mn, abs(mxx - mnn)); } for (int i = 1; i <= a; i++) { unsigned ll mxx = 0, mnn = inf; mxx = max(i * b, max((a - i) * (b / 2), (a - i) * ((b + 1) / 2))); mnn = min(i * b, min((a - i) * (b / 2), (a - i) * ((b + 1) / 2))); mn = min(mn, abs(mxx - mnn)); } cout << mn << endl; } }
a.cc: In function 'int main()': a.cc:38:41: error: call of overloaded 'abs(long long unsigned int)' is ambiguous 38 | mn = min(mn, abs(mxx - mnn)); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/bits/stl_algo.h:71, from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:44:41: error: call of overloaded 'abs(long long unsigned int)' is ambiguous 44 | mn = min(mn, abs(mxx - mnn)); | ~~~^~~~~~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~
s921077790
p03715
C++
#include<iostream> #include<cstdio> #include<cmath> #include<vector> #include<queue> #include<map> #include<algorithm> #include<set> #include<complex> #include<string> #include<cstring> using namespace std; #define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++) #define rep(x,to) rep2(x,0,to) #define INF 100000000 #define debug(x) cout<<#x<<": "<<x<<endl #define MAX 10000000000 #define all(x) x.begin(),x.end() typedef pair<long long,long long> P; typedef pair<long long,P> PP; long long a,b; long long m; long long del(long long x,long long y,long long z) { long long M=max(x,max(y,z)); long long m=min(x,min(y,z)); return M-m; } int main() { m=MAX;// cin>>a>>b; if(a%3==0) { m=min(m,0); } else m=min(m,b); //cout<<m<<endl; rep(i,a-1) { if(b%2==0) { m=min(m,abs((i+1)*b-(a-i-1)*b/2)); } else m=min(m,del((i+1)*b,(a-i-1)*(b-1)/2,(a-i-1)*(b+1)/2)); } long long c=a; a=b; b=c; if(a%3==0) { m=min(m,0); } else m=min(m,b); rep(i,a-1) { if(b%2==0) { m=min(m,abs((i+1)*b-(a-i-1)*b/2)); } else m=min(m,del((i+1)*b,(a-i-1)*(b-1)/2,(a-i-1)*(b+1)/2)); } cout<<m<<endl; return 0; }
a.cc: In function 'int main()': a.cc:35:22: error: no matching function for call to 'min(long long int&, int)' 35 | m=min(m,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: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:35:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 35 | m=min(m,0); | ~~~^~~~~ /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:7: /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:35:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 35 | m=min(m,0); | ~~~^~~~~ a.cc:52:22: error: no matching function for call to 'min(long long int&, int)' 52 | m=min(m,0); | ~~~^~~~~ /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:52:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 52 | m=min(m,0); | ~~~^~~~~ /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:52:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 52 | m=min(m,0); | ~~~^~~~~
s123144949
p03715
C++
h,w=gets.split.map(&:to_i) ans=Array.new(6) if h%3==0 || w%3==0 answer=0 else k=h#とする mul=h*w trip=mul/3 #6 for i in 0..2 green=(trip/h+i)*h blue=(w-(trip/h+i))*(h/2) red=mul-green-blue if green==0 || blue==0 || red==0 next end num= (green-blue).abs > (green-red).abs ? blue : red ans[i]=(green-num).abs end for i in 0..2 green=(trip/w+i)*w blue=(h-(trip/w+i))*(w/2) red=mul-green-blue if green==0 || blue==0 || red==0 next end num= (green-blue).abs > (green-red).abs ? blue : red ans[3+i]=(green-num).abs end ans.compact! answer=ans.min end puts answer
a.cc:6:12: error: stray '#' in program 6 | k=h#とする | ^ a.cc:8:20: error: stray '#' in program 8 | trip=mul/3 #6 | ^ a.cc:9:18: error: too many decimal points in number 9 | for i in 0..2 | ^~~~ a.cc:22:18: error: too many decimal points in number 22 | for i in 0..2 | ^~~~ a.cc:1:1: error: 'h' does not name a type 1 | h,w=gets.split.map(&:to_i) | ^
s043491540
p03715
Java
import java.util.*; public class C { public static int bunkatsu(int h, int w){ int smin = Integer.MAX_VALUE; for (int ha = 1; ha < h; ha++){ // yoko int[] s = new int[3]; s[0] = ha * w; int wb = w/2; s[1] = (h-ha)*wb; s[2] = (h-ha)*(w-wb); Arrays.sort(s); int tmp = s[2] - s[0]; if (tmp < smin) { smin = tmp; } //tate // int[] s = new int[3]; s[0] = ha * w; int hb = (h-ha)/2; s[1] = hb * w; s[2] = (h-ha-hb) * w; Arrays.sort(s); tmp = s[2] - s[0]; if (tmp < smin) { smin = tmp; } } return smin; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int h = Integer.parseInt(sc.next()); int w = Integer.parseInt(sc.next()); int t1 = bunkatsu(h, w); int t2 = bunkatsu(w, h); System.out.println(t1 > t2 ? t2 : t1); } }
Main.java:3: error: class C is public, should be declared in a file named C.java public class C { ^ 1 error
s601005239
p03715
C++
#include<iostream> #include<math.h> #include<set> #include<algorithm> #include<vector> #include<iomanip> using namespace std; int ans = INT_MAX; static long parseans(long j, long l) { string k = ""; long cur = 0; for (int i = (int) j; i <= l; ++i) { cur *= 10; cur += k[i] - '0'; } return cur; } static long gcd(long a, long b) { if (b == 0) { return a; } else { return gcd(b, a % b); } } static bool pri(int k) { if (k == 1) return false; for (int i = 2; i * i <= k; i++) { if (k % i == 0) return false; } return true; } int main() { double h , w; cin >> h >> w; int ans = 1000000000; for(int i = 1; i < h; i++) { int A = w * i; int B = w * floor(((h - i)/2)); int C = w * ceil(((h - i) /2 )); if(A && B && C) ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B)))); // cout << A << " " << B << " " << C << "\n"; // cout << ans << "\n"; } // return 0; for(int i = 1; i < h; i++) { int A = w * i; int B = (h - i) * floor((w)/2); int C = (h - i) * ceil((w)/2); if(A && B && C) ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B)))); } // cout << ans << "\n"; for(int i = 1; i < w; i++) { int A = h * i; int B = h * floor((w-i)/2); int C = h * ceil((w-i)/2); if(A && B && C) ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B)))); } // cout << ans << "\n"; for(int i = 1; i < w; i++) { int A = h * i; int B = (w - i) * floor((h)/2); int C = (w - i) * ceil((h)/2); if(A && B && C) ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B)))); } cout << ans << "\n"; return 0; }
a.cc:10:11: error: 'INT_MAX' was not declared in this scope 10 | int ans = INT_MAX; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include<iomanip> +++ |+#include <climits> 7 | using namespace std;
s548997016
p03715
C++
#include <iostream> #include <algorithm> using namespace std; int test(int h,int w,int ans){ int a[3]; a[0]=x*w; a[1]=(h-x)*(w/2); a[2]=(h-x)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } a[0]=(x+1)*w; a[1]=(h-x-1)*(w/2); a[2]=(h-x-1)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } return ans; } main(){ int h,w; int x,y; int ans=10000000; cin >> h >> w; if(h%3==0 || w%3==0){ cout << 0 <<endl; }else{ if(h<w){ ans=h; }else{ ans=w; } ans=test(h,w,ans); ans=test(w,h,ans); cout << ans <<endl; } }
a.cc: In function 'int test(int, int, int)': a.cc:7:8: error: 'x' was not declared in this scope 7 | a[0]=x*w; | ^ a.cc: At global scope: a.cc:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 27 | main(){ | ^~~~
s491643651
p03715
C++
#include <iostream> #include <algorithm> using namespace std; int test(int h,int w,int ans){ a[0]=x*w; a[1]=(h-x)*(w/2); a[2]=(h-x)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } a[0]=(x+1)*w; a[1]=(h-x-1)*(w/2); a[2]=(h-x-1)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } return ans; } main(){ int h,w; int x,y,a[3]; int ans=10000000; cin >> h >> w; if(h%3==0 || w%3==0){ cout << 0 <<endl; }else{ if(h<w){ ans=h; }else{ ans=w; } ans=test(h,w,ans); ans=test(w,h,ans); cout << ans <<endl; } }
a.cc: In function 'int test(int, int, int)': a.cc:6:3: error: 'a' was not declared in this scope 6 | a[0]=x*w; | ^ a.cc:6:8: error: 'x' was not declared in this scope 6 | a[0]=x*w; | ^ a.cc: At global scope: a.cc:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 26 | main(){ | ^~~~
s787317173
p03715
C++
#include <iostream> #include <algorithm> using namespace std; int test(int h,int w,int ans){ a[0]=x*w; a[1]=(h-x)*(w/2); a[2]=(h-x)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } a[0]=(x+1)*w; a[1]=(h-x-1)*(w/2); a[2]=(h-x-1)*(w-(w/2)); sort(a,a+3); if((a[2]-a[0])<ans){ ans=a[2]-a[0]; } return ans; } main(){ int h,w; int x,y,a[3]; int ans=10000000; cin >> h >> w; if(h%3==0 || w%3==0){ cout << 0 <<endl; }else{ if(h<w){ ans=h; }else{ ans=w; } ans=test(h,w,ans); ans=test(w,h,ans); cout << ans <<endl; } }
a.cc: In function 'int test(int, int, int)': a.cc:6:3: error: 'a' was not declared in this scope 6 | a[0]=x*w; | ^ a.cc:6:8: error: 'x' was not declared in this scope 6 | a[0]=x*w; | ^ a.cc: At global scope: a.cc:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 26 | main(){ | ^~~~
s098131715
p03715
C++
#include <bits/stdc++.h> using namespace std; typedef long l; l h,w,n,i; k(l a,l b){for(i=0;i<a;i++)n=min(n,max(i*b,(b/2+(b%2?1:0))*(a-i))-min(i*b,(b/2)*(a-i)));} main(){scanf("%d%d",%h,%w),n=h%3&&w%3?min(h,w):0,k(h,w),k(w,h),cout<<n;}
a.cc:5:1: error: ISO C++ forbids declaration of 'k' with no type [-fpermissive] 5 | k(l a,l b){for(i=0;i<a;i++)n=min(n,max(i*b,(b/2+(b%2?1:0))*(a-i))-min(i*b,(b/2)*(a-i)));} | ^ a.cc: In function 'int k(l, l)': a.cc:5:89: warning: no return statement in function returning non-void [-Wreturn-type] 5 | k(l a,l b){for(i=0;i<a;i++)n=min(n,max(i*b,(b/2+(b%2?1:0))*(a-i))-min(i*b,(b/2)*(a-i)));} | ^ a.cc: At global scope: a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main(){scanf("%d%d",%h,%w),n=h%3&&w%3?min(h,w):0,k(h,w),k(w,h),cout<<n;} | ^~~~ a.cc: In function 'int main()': a.cc:6:21: error: expected primary-expression before '%' token 6 | main(){scanf("%d%d",%h,%w),n=h%3&&w%3?min(h,w):0,k(h,w),k(w,h),cout<<n;} | ^ a.cc:6:24: error: expected primary-expression before '%' token 6 | main(){scanf("%d%d",%h,%w),n=h%3&&w%3?min(h,w):0,k(h,w),k(w,h),cout<<n;} | ^
s046236604
p03715
Java
package test; import java.util.Scanner; public class ChocolateBar { public static double CutBar(int H, int W) { if (H*W%3==0) return 0; else if(H<W) return H*Math.floor(W/2)-(W-Math.floor(W/2))*Math.floor(H/2); else return W*Math.floor(H/2)-(H-Math.floor(H/2))*Math.floor(W/2); } public static void main(String[] args){ System.out.println("input H:"); int H=new Scanner(System.in).nextInt(); System.out.println("input W:"); int W=new Scanner(System.in).nextInt(); System.out.println("result:"+(int)CutBar(H,W)); } }
Main.java:5: error: class ChocolateBar is public, should be declared in a file named ChocolateBar.java public class ChocolateBar { ^ 1 error
s334183434
p03715
Java
int x=H; int y=W; if(H*W%3==0) return 0; else if(H<<W) return H*[W/2]-(W-[W/2])*[H/2]; else return [H/2]*W-(H-[H/2])*[W/2];
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. int x=H; ^ (use --enable-preview to enable unnamed classes) Main.java:3: error: class, interface, enum, or record expected if(H*W%3==0) return 0; ^ Main.java:4: error: class, interface, enum, or record expected else if(H<<W) return H*[W/2]-(W-[W/2])*[H/2]; ^ Main.java:5: error: class, interface, enum, or record expected else return [H/2]*W-(H-[H/2])*[W/2]; ^ 4 errors
s115561338
p03715
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <iostream> #include <sstream> #include <algorithm> #include <string> #include <string.h> #include <utility> #include <vector> #include <map> #include <set> #include <queue> #include <stack> using namespace std; typedef long long ll; #ifndef INT_MAX # define INT_MAX std::numeric_limits<int>().max() #endif #ifndef INT_MIN # define INT_MIN std::numeric_limits<int>().min() #endif #define LL_MAX std::numeric_limits<ll>().max() #define LL_MIN std::numeric_limits<ll>().min() #define INF LL_MAX #define REP(i,n) for(int i=0;i<n;++i) #define SORT(name) sort(name.begin(), name.end()) ll H, W; ll search(ll longer, ll shorter) { ll cur_l = longer / 2; ll s1 = (shorter / 2) * (longer - cur_l); ll s2 = shorter * cur_l; ll s3 = W * H - s1 - s2; ll min_s = min(min(s1, s2), s3); ll max_s = max(max(s1, s2), s3); ll ans = abs(max_s - min_s); if(ans == 0) { return 0; } ll cur_ans = ans; REP(i, 50000) { //if(s1 > s2) { cur_l++; } //else { cur_l--;} cur_l--; s1 = (shorter / 2) * (longer - cur_l); s2 = shorter * cur_l; s3 = W * H - s1 - s2; min_s = min(min(s1, s2), s3); max_s = max(max(s1, s2), s3); cur_ans = abs(max_s - min_s); if(cur_ans > ans) { break; } ans = cur_ans; } return ans; } int main() { cin >> H >> W; if(H % 3 == 0 || W % 3 == 0) { printf("0\n"); return 0; } if((H % 2 == 0 && W % 2 == 0) || (H % 2 != 0 && W % 2 != 0)) { ll longer = (H > W) ? H : W; ll shorter = (H < W) ? H : W; printf("%lld\n", min(search(longer, shorter), search(shorter, longer)); return 0; } if(H % 2 == 0 || W % 2 ==0) { ll even = (H % 2 ==0) ? H : W; ll odd = (H % 2 ==0) ? W : H; printf("%lld\n", search(odd, even)); return 0; } return 0; }
a.cc: In function 'int main()': a.cc:75:79: error: expected ')' before ';' token 75 | printf("%lld\n", min(search(longer, shorter), search(shorter, longer)); | ~ ^ | )
s034015244
p03715
C++
#include <iostream> using namespace std; long minsub(long a, long b, long c) { long min, max; if (a < b) { min = a; max = b; } else { min = b; max = a; } if (c < min) { min = c; } if (max < c) { max = c; } return max - min; } int main() { long H, W; cin >> H >> W; if (0 == H % 3 || 0 == W % 3) { cout << 0 << endl; } else if (0 == H % 2 || 0 == W % 2) { long mins = LONG_MAX; if (0 == H % 2) { mins = min( abs(H * (W / 3) - (H / 2) * (W - W / 3)), abs(H * (W / 3 + 1) - (H / 2) * (W - W / 3 - 1))); } if (0 == W % 2) { mins = min(mins, min( abs(W * (H / 3) - (W / 2) * (H - H / 3)), abs(W * (H / 3 + 1) - (W / 2) * (H - H / 3 - 1)))); } cout << mins << endl; } else { long a1 = H * (W / 3), a2 = (H / 2) * (W - W / 3), a3 = (H / 2 + 1) * (W - W / 3); long a4 = H * (W / 3 + 1), a5 = (H / 2) * (W - W / 3 - 1), a6 = (H / 2 + 1) * (W - W / 3 - 1); long b1 = W * (H / 3), b2 = (W / 2) * (H - H / 3), b3 = (W / 2 + 1) * (H - H / 3); long b4 = W * (H / 3 + 1), b5 = (W / 2) * (H - H / 3 - 1), b6 = (W / 2 + 1) * (H - H / 3 - 1); cout << min( min( minsub(a1, a2, a3), minsub(a4, a5, a6)), min( minsub(b1, b2, b3), minsub(b4, b5, b6))) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:42:21: error: 'LONG_MAX' was not declared in this scope 42 | long mins = LONG_MAX; | ^~~~~~~~ a.cc:2:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std;
s859572116
p03715
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; #define int ll signed main(void) { int i,j; int h,w; cin>>h>>w; int ans=INF; loop(i,1,w){ vi v(3); v[0]=i*h; v[1]=((w+i)/2-i)*h; v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); v[0]=i*h; v[1]=(w-i)*(h/2); v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); } swap(w,h); loop(i,1,w){ vi v(3); v[0]=i*h; v[1]=((w+i)/2-i)*h; v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); v[0]=i*h; v[1]=(w-i)*(h/2); v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:45:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 45 | ans=min(ans,v[2]-v[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: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:45:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 45 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:45:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 45 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:50:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 50 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:50:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 50 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:50:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 50 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:59:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 59 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:59:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 59 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:59:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 59 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:64:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 64 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:64:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 64 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:64:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 64 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~
s803213618
p03715
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(i=0;i<n;i++) #define loop(i,a,n) for(i=a;i<n;i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) typedef vector<int> vi; typedef pair<int,int> pii; #define int ll int main(void) { int i,j; int h,w; cin>>h>>w; int ans=INF; loop(i,1,w){ vi v(3); v[0]=i*h; v[1]=((w+i)/2-i)*h; v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); v[0]=i*h; v[1]=(w-i)*(h/2); v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); } swap(w,h); loop(i,1,w){ vi v(3); v[0]=i*h; v[1]=((w+i)/2-i)*h; v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); v[0]=i*h; v[1]=(w-i)*(h/2); v[2]=h*w-v[0]-v[1]; sort(all(v)); ans=min(ans,v[2]-v[0]); } cout<<ans<<endl; }
cc1plus: error: '::main' must return 'int' a.cc: In function 'int main()': a.cc:46:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 46 | ans=min(ans,v[2]-v[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: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:46:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 46 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:46:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 46 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:51:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 51 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:51:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 51 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:51:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:60:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 60 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:60:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 60 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:60:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 60 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ a.cc:65:12: error: no matching function for call to 'min(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)' 65 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:65:12: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 65 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~ /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:65:12: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 65 | ans=min(ans,v[2]-v[0]); | ~~~^~~~~~~~~~~~~~~
s529037997
p03715
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> ii; const int N=3e2+5; const ll inf=2e15; const ll mod=1e9+7; //题意:n*m地图 n,m<=100,起点S,终点T 'o'表示叶子,每次可以跳到同行或者同列的'o'上,问最少删掉多少个'o'使得S无法到达T? //最小割模型,先把图变为二分图,每行每列加上源点和汇点,两边点分别为1~n,1~m //对叶子'o'(x,y):x-y连接一条边 表示第x行的叶子可以跳到第y列 容量为1:表示删除(x,y)这一个点 //加上边 S->SX S-SY TX->T,TY->T 容量为inf 不能删除 //现在只要求出从S->T的最大流即可,因为最大流时的图,无增广路即,S->T不存在路径,对应的s-t割为最小割,容量最小. char s[N][N]; ll n,m,g[N][N]; ll path[N],flow[N],start,end; queue<int> q; void init() { memset(g,0,sizeof(g)); for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(s[i][j]=='S') { g[0][i]=inf; g[0][n+j]=inf; } if(s[i][j]=='T') { g[i][n+m+1]=inf; g[n+j][n+m+1]=inf; } if(s[i][j]=='o') g[i][n+j]=1,g[n+j][i]=1; } } } ll bfs() { while(!q.empty()) q.pop(); memset(path,-1,sizeof(path)); path[start]=0,flow[start]=inf; q.push(start); while(!q.empty()) { int t=q.front(); q.pop(); if(t==end) break; for(int i=1;i<=n+m+1;i++) { if(i!=start && path[i]==-1 && g[t][i]) { flow[i]=min(flow[t],g[t][i]); q.push(i); path[i]=t; } } } if(path[end]==-1) return -1; return flow[end]; } ll Edmonds_Karp() { ll mx_flow=0,step,now,pre; while((step=bfs())!=-1)//找不到增广路退出 { mx_flow+=step; now=end; while(now!=start) { pre=path[now]; g[pre][now]-=step;//更新正向边容量 g[now][pre]+=step;//更新反向边(Gf走反向边 相当于在G中减小该边流量) now=pre; } } return mx_flow; } int main() { while(cin>>n>>m) { for(int i=1;i<=n;i++) scanf("%s",s[i]+1); init();//建图 start=0,end=n+m+1; ll ans=Edmonds_Karp(); if(ans>=inf) puts("-1"); else cout<<ans<<endl; } return 0; }
a.cc: In function 'll bfs()': a.cc:52:23: error: reference to 'end' is ambiguous 52 | if(t==end) | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:16:26: note: 'll end' 16 | ll path[N],flow[N],start,end; | ^~~ a.cc:64:17: error: reference to 'end' is ambiguous 64 | if(path[end]==-1) | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:16:26: note: 'll end' 16 | ll path[N],flow[N],start,end; | ^~~ a.cc:66:21: error: reference to 'end' is ambiguous 66 | return flow[end]; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:16:26: note: 'll end' 16 | ll path[N],flow[N],start,end; | ^~~ a.cc: In function 'll Edmonds_Karp()': a.cc:74:21: error: reference to 'end' is ambiguous 74 | now=end; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:16:26: note: 'll end' 16 | ll path[N],flow[N],start,end; | ^~~ a.cc: In function 'int main()': a.cc:92:25: error: reference to 'end' is ambiguous 92 | start=0,end=n+m+1; | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ a.cc:16:26: note: 'll end' 16 | ll path[N],flow[N],start,end; | ^~~
s654432302
p03715
C++
import java.util.*; public class Main { /* * default function * */ int ni() { return cin.nextInt(); } long nl() { return cin.nextLong(); } String line() { return cin.nextLine(); } void println(String str) { System.out.println(str); } void print(String str) { System.out.print(str); } /* * default variable */ static final int MOD = 1000000007; Scanner cin = new Scanner(System.in); String output; public static void main(String[] args) { new Main().run(); } /* default above */ public void run() { input(); /* * start */ int res = solve(); /* * finish */ output = res +""; println(output); } /* * define variable */ int H, W; void input() { H = ni(); W = ni(); if (W > H) { W = H + W; H = W - H; W = W - H; } } int solve() { if (H % 3 == 0 || W % 3 == 0) { return 0; } if (W == 2) { return 1; } return cal(H, W); } int cal(long h, long w) { long res = Long.MAX_VALUE; long a[] = new long[3]; a[0] = (h / 2) * w; a[1] = (h - h/2) * (w / 2); a[2] = (h - h/2) * (w - w/2); Arrays.sort(a); res = Math.min(res, a[2] - a[0]); a[0] = (h/3) * w; a[1] = (h - h/3) * (w/2); a[2] = (h - h/3) * (w - w/2); Arrays.sort(a); res = Math.min(res, a[2] - a[0]); return (int)res; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s946636441
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=1000000000; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} for(int i = 1; i < W; ++i) { s1 = i * H; s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2)); s3 = (W - i) * H - s2; minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); } swap(H, W); for(int i = 1; i < W; ++i) { s1 = i * H; s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2)); s3 = (W - i) * H - s2; minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); } cout<<minn<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 19 | minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc:19:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 19 | minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); | ~~~^~~~~~~~~~~~~~ /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 a.cc:30:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 30 | minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc:30:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 30 | minn = min(minn, max({s1, s2, s3}) - min({s1, s2, s3})); | ~~~^~~~~~~~~~~~~~ /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
s418577244
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=1000000000; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} for(int i = 1; i < W; ++i) { s1 = i * H; s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2)); s3 = (W - i) * H - s2; minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); } swap(H, W); for(int i = 1; i < W; ++i) { s1 = i * H; s2 = max(((W - i) / 2) * H, (W - i) * (H/ 2)); s3 = (W - i) * H - s2; minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); } cout<<minn<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:39: error: 'a1' was not declared in this scope; did you mean 's1'? 19 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s1 a.cc:19:43: error: 'a2' was not declared in this scope; did you mean 's2'? 19 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s2 a.cc:19:47: error: 'a3' was not declared in this scope; did you mean 's3'? 19 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s3 a.cc:19:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 19 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc:19:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 19 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ~~~^~~~~~~~~~~~~~ /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 a.cc:30:39: error: 'a1' was not declared in this scope; did you mean 's1'? 30 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s1 a.cc:30:43: error: 'a2' was not declared in this scope; did you mean 's2'? 30 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s2 a.cc:30:47: error: 'a3' was not declared in this scope; did you mean 's3'? 30 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ^~ | s3 a.cc:30:37: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 30 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc:30:57: error: no matching function for call to 'min(<brace-enclosed initializer list>)' 30 | minn = min(minn, max({a1, a2, a3}) - min({a1, a2, a3})); | ~~~^~~~~~~~~~~~~~ /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
s595458833
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=1000000000; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} //divide W for(long int i=1;i<H;i++){ s1=W*i; s3=max((H-i)*(W/2),W*(H-i)/2); s2=W*(H-i)-s3; long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } long int tmp; tmp=H; H=W; W=tmp; for(long int i=1;i<H;i++){ s1=W*i; s3=max((H-i)*(W/2),W*(H-i)/2); s2=W*(H-i)-s3; long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } cout<<minn<<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:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:18:22: required from here 18 | long int maxs=max(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:19:22: required from here 19 | long int mins=min(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s323866937
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=1000000000; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} //divide W for(long int i=1;i<H;i++){ s1=W*i; s3=max((H-i)*(W/2),W*(H-i)/2); s2=W*(H-i)-s3; long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } swap(H,W); for(long int i=1;i<H;i++){ s1=W*i; s3=max((H-i)*(W/2),W*(H-i)/2); s2=W*(H-i)-s3; long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } cout<<minn<<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:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:18:22: required from here 18 | long int maxs=max(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:19:22: required from here 19 | long int mins=min(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s291265135
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=1000000000; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} //divide W for(long int i=1;i<=H/2;i++){ s1=W*i; s3=max((H-i)*(W/2),W*((H-i)/2)); s2=(H-i)*(W-W/2); long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } swap(H,W); for(long int i=1;i<=H/2;i++){ s1=W*i; s3=max((H-i)*(W/2),W*((H-i)/2)); s2=(H-i)*(W-W/2); long int maxs=max(s1,s2,s3); long int mins=min(s1,s2,s3); minn=min(maxs-mins,minn); } cout<<minn<<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:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:18:22: required from here 18 | long int maxs=max(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]': a.cc:19:22: required from here 19 | long int mins=min(s1,s2,s3); | ~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s424009393
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=INT_MAX; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} //divide W for(long int i=1;i<H;i++){ s1=W*i; s3=(H-i)*(W/2); s2=(H-i)*(W-W/2); long int maxs=max(s1,s2); long int mins=min(s1,s3); minn=min(maxs-mins,minn); } //divide H for(long int i=1;i<W;i++){ s1=H*i; s3=(W-i)*(H/2); s2=(W-i)*(H-H/2); long int maxs=max(s1,s2); long int mins=min(s1,s3); minn=min(maxs-mins,minn); } cout<<minn<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'INT_MAX' was not declared in this scope 9 | long int minn=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;
s398709638
p03715
C++
#include<iostream> using namespace std; int main(){ long int H,W; cin>>H>>W; long int minn=INT_MAX; long int s1,s2,s3; if(H%3==0||W%3==0) {cout<<0<<endl; return 0;} //divide W for(long int i=1;i<=H/2;i++){ s1=W*i; s3=(H-i)*(W/2); s2=(H-i)*(W-W/2); long int maxs=max(s1,s2); long int mins=min(s1,s3); minn=min(maxs-mins,minn); } //divide H for(long int i=1;i<=W/2;i++){ s1=H*i; s3=(W-i)*(H/2); s2=(W-i)*(H-H/2); long int maxs=max(s1,s2); long int mins=min(s1,s3); minn=min(maxs-mins,minn); } cout<<minn<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'INT_MAX' was not declared in this scope 9 | long int minn=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;
s674384304
p03715
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { int chokorateBlock[] = new int[2]; int firstBlock[] = new int[2];; int secondBlock[] = new int[2];; int shirdBlock[] = new int[2];; int secondAndShirdBlock[] = new int[2]; public static void main(String[] args) { Main chokorateBlock= new Main(); } public Main() { InputStreamReader is = new InputStreamReader(System.in); //(1) BufferedReader br = new BufferedReader(is); //(2) // System.out.println("何か入力してください."); String str = null; try { str = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } //(3) String[] divteStr = str.split(" ", 0); chokorateBlock[0] = Integer.parseInt(divteStr[0]); chokorateBlock[1] = Integer.parseInt(divteStr[1]); // System.out.println(chokorateBlock[0]+""+chokorateBlock[1]); double difarence[] = new double[4]; cutHeight(chokorateBlock, firstBlock, secondAndShirdBlock, 3); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock, 2); difarence[0] = biggerBestDifarence(); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock, 2); difarence[1] = biggerBestDifarence(); cutWidth(chokorateBlock, firstBlock, secondAndShirdBlock, 3); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock, 2); difarence[2] = biggerBestDifarence(); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock, 2); difarence[3] = biggerBestDifarence(); System.out.println((int)lessBestNumber(difarence)); } //縦に切る private void cutHeight(int[] block, int[] cuttingBlock1, int[] cuttingBlock2, int cuttingNumber) { int cuttingHeightNumber = (int)Math.round(block[1]/cuttingNumber-0.1); cuttingBlock1[0] = block[0]; cuttingBlock1[1] = cuttingHeightNumber; cuttingBlock2[0] = block[0]; cuttingBlock2[1] = block[1] - cuttingHeightNumber; } //横に切る private void cutWidth(int[] block, int[] cuttingBlock1, int[] cuttingBlock2, int cuttingNumber) { int cuttingWidthNumber = (int)Math.round(block[0]/cuttingNumber-0.1); // System.out.println("block[0]/cutNumber:"+block[0]/cuttingNumber); // System.out.println("cutWidthNumber:"+cuttingWidthNumber); cuttingBlock1[0] = cuttingWidthNumber; cuttingBlock1[1] = block[1]; cuttingBlock2[0] = block[0] - cuttingWidthNumber; cuttingBlock2[1] = block[1]; } private double biggerBestDifarence() { double firstBlockArea = (double)firstBlock[0] * firstBlock[1]; double secondBlockArea = (double)secondBlock[0] * secondBlock[1]; double shirdBlockArea = (double)shirdBlock[0] * shirdBlock[1]; // System.out.println(firstBlock[0]+", "+firstBlock[1]); // System.out.println(secondBlock[0]+", "+secondBlock[1]); // System.out.println(shirdBlock[0]+", "+shirdBlock[1]); // System.out.println("firstBlockArea:"+firstBlockArea); // System.out.println("secondBlockArea:"+secondBlockArea); // System.out.println("shirdBlockArea:"+shirdBlockArea); double difarenceArray[] = new double[3]; difarenceArray[0] = (int)Math.abs(firstBlockArea - secondBlockArea) ; difarenceArray[1] = (int)Math.abs(firstBlockArea - shirdBlockArea); difarenceArray[2] = (int)Math.abs(secondBlockArea - shirdBlockArea); return bigerBestNumber(difarenceArray); } private double bigerBestNumber(double[] array) { double max = -1000000000; for (int i = 0; i < array.length; i++) { // System.out.println(array[i]); boolean flagMax = max < array[i]; if(flagMax) max = array[i]; } return max; } private double lessBestNumber(double[] array) { double min = 100000000; for (int i = 0; i < array.length; i++) { if(min > array[i]) min = array[i]; } return min; }
Main.java:122: error: reached end of file while parsing } ^ 1 error
s786426017
p03715
C++
a;f(H,W){for(long i=H,x,y,z,t;i--;a=t<a?t:a)x=(H-i)*W,y=W/2*i,z=(W+1)/2*i,t=x>z?x-y:x<y?z-x:i;}main(H,W){scanf("%d%d",&H,&W);printf("%d\n",H%3&&W%3?a=H<W?H:W,f(H,W),f(W,H),a:0);}
a.cc:1:1: error: 'a' does not name a type 1 | a;f(H,W){for(long i=H,x,y,z,t;i--;a=t<a?t:a)x=(H-i)*W,y=W/2*i,z=(W+1)/2*i,t=x>z?x-y:x<y?z-x:i;}main(H,W){scanf("%d%d",&H,&W);printf("%d\n",H%3&&W%3?a=H<W?H:W,f(H,W),f(W,H),a:0);} | ^ a.cc:1:4: error: expected constructor, destructor, or type conversion before '(' token 1 | a;f(H,W){for(long i=H,x,y,z,t;i--;a=t<a?t:a)x=(H-i)*W,y=W/2*i,z=(W+1)/2*i,t=x>z?x-y:x<y?z-x:i;}main(H,W){scanf("%d%d",&H,&W);printf("%d\n",H%3&&W%3?a=H<W?H:W,f(H,W),f(W,H),a:0);} | ^ a.cc:1:100: error: expected constructor, destructor, or type conversion before '(' token 1 | a;f(H,W){for(long i=H,x,y,z,t;i--;a=t<a?t:a)x=(H-i)*W,y=W/2*i,z=(W+1)/2*i,t=x>z?x-y:x<y?z-x:i;}main(H,W){scanf("%d%d",&H,&W);printf("%d\n",H%3&&W%3?a=H<W?H:W,f(H,W),f(W,H),a:0);} | ^
s445400770
p03715
C++
#include <vector> #include <stack> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> using namespace std; #define INF 1000000 int main() { long H, W; long ans = INF; cin >> H >> W; if ( H % 3 == 0 || W % 3 == 0) { cout << 0 << endl; return 0; } for ( int i = 1; i < H; i++ ) { long w = W / 2; long h = (H - i) / 2; if ( h == 0 || w == 0) break; ans = min(max(i * W, (H - i) * (W - w)) - min(i * W, (H - i) * w), ans); ans = min(max(i * W, (H - i - h) * W) - min(i * W, h * W), ans); } for ( int i = 1; i < W; i++ ) { long h = H / 2; long w = (W - i) / 2; if ( w == 0 || h == 0) break; ans = min(max(i * H, (W - i) * (H - h)) - min(i * H, (W - i) * h), ans); ans = min(max(i * H, (W - i - w) * H) - min(i * H, w * H), ans); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'cin' was not declared in this scope 14 | cin >> H >> W; | ^~~ a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 6 | #include <cstring> +++ |+#include <iostream> 7 | using namespace std; a.cc:17:9: error: 'cout' was not declared in this scope 17 | cout << 0 << endl; | ^~~~ a.cc:17:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:22: error: 'endl' was not declared in this scope 17 | cout << 0 << endl; | ^~~~ a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 6 | #include <cstring> +++ |+#include <ostream> 7 | using namespace std; a.cc:37:5: error: 'cout' was not declared in this scope 37 | cout << ans << endl; | ^~~~ a.cc:37:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:37:20: error: 'endl' was not declared in this scope 37 | cout << ans << endl; | ^~~~ a.cc:37:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s936274157
p03715
C++
#include <vector> #include <stack> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> using namespace std; #define INF 1000000 int main() { long H, W; long ans = INF; cin >> H >> W; if ( H % 3 == 0 || W % 3 == 0) { cout << 0 << endl; return 0; } for ( int i = 1; i < H; i++ ) { long w = W / 2; long h = (H - i) / 2; if ( h == 0 || w == 0) break; ans = min(max(i * W, (H - i) * (W - w)) - min(i * W, (H - i) * w), ans); ans = min(max(i * W, (H - i - h) * W) - min(i * W, h * W), ans); } for ( int i = 1; i < W; i++ ) { long h = H / 2; long w = (W - i) / 2; if ( w == 0 || h == 0) break; ans = min(max(i * H, (W - i) * (H - h)) - min(i * H, (W - i) * h), ans); ans = min(max(i * H, (W - i - w) * H) - min(i * H, w * H), ans); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'cin' was not declared in this scope 14 | cin >> H >> W; | ^~~ a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 6 | #include <cstring> +++ |+#include <iostream> 7 | using namespace std; a.cc:17:9: error: 'cout' was not declared in this scope 17 | cout << 0 << endl; | ^~~~ a.cc:17:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:22: error: 'endl' was not declared in this scope 17 | cout << 0 << endl; | ^~~~ a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 6 | #include <cstring> +++ |+#include <ostream> 7 | using namespace std; a.cc:37:5: error: 'cout' was not declared in this scope 37 | cout << ans << endl; | ^~~~ a.cc:37:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:37:20: error: 'endl' was not declared in this scope 37 | cout << ans << endl; | ^~~~ a.cc:37:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s857181824
p03715
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ChokorateBar { int chokorateBlock[] = new int[2]; int firstBlock[] = new int[2];; int secondBlock[] = new int[2];; int shirdBlock[] = new int[2];; int secondAndShirdBlock[] = new int[2]; public static void main(String[] args) { ChokorateBar chokorateBlock= new ChokorateBar(); } public ChokorateBar() { InputStreamReader is = new InputStreamReader(System.in); //(1) BufferedReader br = new BufferedReader(is); //(2) // System.out.println("何か入力してください."); String str = null; try { str = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } //(3) String[] divteStr = str.split(" ", 0); chokorateBlock[0] = Integer.parseInt(divteStr[0]); chokorateBlock[1] = Integer.parseInt(divteStr[1]); // System.out.println(chokorateBlock[0]+""+chokorateBlock[1]); int difarence[] = new int[4]; cutHeight(chokorateBlock, firstBlock, secondAndShirdBlock); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock); difarence[0] = bestBigDifarence(); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock); difarence[1] = bestBigDifarence(); cutWidth(chokorateBlock, firstBlock, secondAndShirdBlock); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock); difarence[2] = bestBigDifarence(); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock); difarence[3] = bestBigDifarence(); System.out.println(lessBestNumber(difarence)); } private void cutHeight(int[] block, int[] cutBlock1, int[] cutBlock2) { int cutHeightNumber = (int)Math.floor(block[1]/2); cutBlock1[0] = block[0]; cutBlock1[1] = cutHeightNumber; cutBlock2[0] = block[0]; cutBlock2[1] = block[1] - cutHeightNumber; } private void cutWidth(int[] block, int[] cutBlock1, int[] cutBlock2) { int cutHeightNumber = (int)Math.floor(block[0]/2); cutBlock1[0] = cutHeightNumber; cutBlock1[1] = block[1]; cutBlock2[0] = block[0] - cutHeightNumber; cutBlock2[1] = block[1]; } private int bestBigDifarence() { int firstBlockArea = firstBlock[0] * firstBlock[1]; int secondBlockArea = secondBlock[0] * secondBlock[1]; int shirdBlockArea = shirdBlock[0] * shirdBlock[1]; // System.out.println(firstBlock[0]+""+firstBlock[1]); // System.out.println(secondBlock[0]+""+secondBlock[1]); // System.out.println(shirdBlock[0]+""+shirdBlock[1]); int difarence[] = new int[3]; difarence[0] = Math.abs(firstBlockArea - secondBlockArea) ; difarence[1] = Math.abs(firstBlockArea - shirdBlockArea); difarence[2] = Math.abs(secondBlockArea - shirdBlockArea); return bigerBestNumber(difarence); } private int bigerBestNumber(int[] array) { int max = -100; for (int i = 0; i < array.length; i++) { // System.out.println(array[i]); boolean flagMax = max < array[i]; if(flagMax) max = array[i]; } return max; } private int lessBestNumber(int[] array) { int max = 100; for (int i = 0; i < array.length; i++) { if(max > array[i]) max = array[i]; } return max; } }
Main.java:5: error: class ChokorateBar is public, should be declared in a file named ChokorateBar.java public class ChokorateBar { ^ 1 error
s236723492
p03715
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ChokorateBar { int chokorateBlock[] = new int[2]; int firstBlock[] = new int[2];; int secondBlock[] = new int[2];; int shirdBlock[] = new int[2];; int secondAndShirdBlock[] = new int[2]; public static void main(String[] args) { ChokorateBar chokorateBlock= new ChokorateBar(); } public ChokorateBar() { InputStreamReader is = new InputStreamReader(System.in); //(1) BufferedReader br = new BufferedReader(is); //(2) System.out.println("何か入力してください."); String str = null; try { str = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } //(3) String[] divteStr = str.split(" ", 0); chokorateBlock[0] = Integer.parseInt(divteStr[0]); chokorateBlock[1] = Integer.parseInt(divteStr[1]); // System.out.println(chokorateBlock[0]+""+chokorateBlock[1]); int difarence[] = new int[4]; cutHeight(chokorateBlock, firstBlock, secondAndShirdBlock); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock); difarence[0] = bestBigDifarence(); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock); difarence[1] = bestBigDifarence(); cutWidth(chokorateBlock, firstBlock, secondAndShirdBlock); cutWidth(secondAndShirdBlock, secondBlock, shirdBlock); difarence[2] = bestBigDifarence(); cutHeight(secondAndShirdBlock, secondBlock, shirdBlock); difarence[3] = bestBigDifarence(); System.out.println(lessBestNumber(difarence)); } private void cutHeight(int[] block, int[] cutBlock1, int[] cutBlock2) { int cutHeightNumber = (int)Math.floor(block[1]/2); cutBlock1[0] = block[0]; cutBlock1[1] = cutHeightNumber; cutBlock2[0] = block[0]; cutBlock2[1] = block[1] - cutHeightNumber; } private void cutWidth(int[] block, int[] cutBlock1, int[] cutBlock2) { int cutHeightNumber = (int)Math.floor(block[0]/2); cutBlock1[0] = cutHeightNumber; cutBlock1[1] = block[1]; cutBlock2[0] = block[0] - cutHeightNumber; cutBlock2[1] = block[1]; } private int bestBigDifarence() { int firstBlockArea = firstBlock[0] * firstBlock[1]; int secondBlockArea = secondBlock[0] * secondBlock[1]; int shirdBlockArea = shirdBlock[0] * shirdBlock[1]; // System.out.println(firstBlock[0]+""+firstBlock[1]); // System.out.println(secondBlock[0]+""+secondBlock[1]); // System.out.println(shirdBlock[0]+""+shirdBlock[1]); int difarence[] = new int[3]; difarence[0] = Math.abs(firstBlockArea - secondBlockArea) ; difarence[1] = Math.abs(firstBlockArea - shirdBlockArea); difarence[2] = Math.abs(secondBlockArea - shirdBlockArea); return bigerBestNumber(difarence); } private int bigerBestNumber(int[] array) { int max = -100; for (int i = 0; i < array.length; i++) { // System.out.println(array[i]); boolean flagMax = max < array[i]; if(flagMax) max = array[i]; } return max; } private int lessBestNumber(int[] array) { int max = 100; for (int i = 0; i < array.length; i++) { if(max > array[i]) max = array[i]; } return max; } }
Main.java:5: error: class ChokorateBar is public, should be declared in a file named ChokorateBar.java public class ChokorateBar { ^ 1 error