submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s552298002 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;long long a,b,c,d,e,w,h,ans=1e10;
int main(){
cin>>w>>h;
for(int i=0;i<=h/2;i++)
{
a=w*i,b=w/2*(h-i);
d=w*h-a-b;
ans=min(max(a,max(b,d))-min(a,min(b,d)),ans);
a=w*i,c=(h-i)/2*w;
e=w*h-a-c;
ans=min(max(a,max(c,e))-min(a,min(c,e)),ans);
}
for(int i=0;i<=w/2;i++)
{
a=h*i,b=h/2*(w-i);
d=w*h-a-b;
ans=min(max(a,max(b,d))-min(a,min(b,d)),ans);
a=h*i,c=(w-i)/2*h;
e=w*h-a-c;
ans=min(max(a,max(c,e))-min(a,min(c,e)),ans);
}
cout<<ans | a.cc: In function 'int main()':
a.cc:24:12: error: expected ';' at end of input
24 | cout<<ans
| ^
| ;
a.cc:24:12: error: expected '}' at end of input
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s369480915 | p03713 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
int H[2], ans = (int)1e5;
cin >> H[0] >> H[1];
for (int i = 0; i < 2; i++) {
if (H[i] % 3 == 0) {
cout << 0 << endl;
return;
}
ans = min(ans, H[1 - i]);
int H1 = H[i] / 3;
int S_max = (H1 + 1) * H[1 - i];
int S_min = (H[i] - H1 - 1) * (H[1 - i] / 2);
ans = min(ans, S_max - S_min);
S_min = H1 * H[1 - i];
S_max = (H[i] - H1) * ((H[1 - i] + 1) / 2);
ans = min(ans, S_max - S_min);
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
13 | return;
| ^~~~~~
|
s273515081 | p03713 | C++ | #include <iostream>
using namespace std;
int main(){
int H, W;
cin >> H >> W;
//川の字に割る
int ans;
int tmp = 999999;
if(W % 3 == 0){
ans = 0;
}else{
tmp = H;
}
//三の字に割る
if(H % == 0){
ans = 0;
}else{
tmp = min(W,tmp);
}
//Tの字に割る
for(int i = 1; i <= W-1; i++){
for(int j = 1; j <= H-1; j++){
tmp = min(tmp,min(i*H,j*(W-i)));
}
}
//Eの字に割る
for(int i = 1; i <= H-1; i++){
for(int j = 1; j <= W-1; j++){
tmp = min(tmp,min(i*W,j*(H-i)));
}
}
cout << min(ans, tmp);
}
| a.cc: In function 'int main()':
a.cc:17:10: error: expected primary-expression before '==' token
17 | if(H % == 0){
| ^~
|
s530994490 | p03713 | C++ | #include <iostream>
using namespace std;
int main(){
int H, W;
cin >> H >> W;
//川の字に割る
int ans;
int tmp = 999999;
if(W % 3 == 0){
ans = 0;
}else(W % 3 != 0){
tmp = H;
}
//三の字に割る
if(H % == 0){
ans = 0;
}else{
int t = W;
tmp = min(t,tmp);
}
//Tの字に割る
for(int i = 1; i <= W-1; i++){
for(int j = 1; j <= H-1; j++){
tmp = min(tmp,min(i*H,j*(W-i)));
}
}
//Eの字に割る
for(int i = 1; i <= H-1; i++){
for(int j = 1; j <= W-1; j++){
tmp = min(tmp,min(i*W,j*(H-i)));
}
}
cout << min(ans, tmp);
}
| a.cc: In function 'int main()':
a.cc:13:20: error: expected ';' before '{' token
13 | }else(W % 3 != 0){
| ^
| ;
a.cc:17:10: error: expected primary-expression before '==' token
17 | if(H % == 0){
| ^~
|
s378494639 | p03713 | C++ | #include <iostream>
using namespace std;
int main(){
int H, W;
cin >> H >> W;
//川の字に割る
int ans;
int tmp = 999999;
if(W % 3 == 0) ans = 0;
else(W % 3 != 0){
tmp = H;
}
//三の字に割る
if(H % == 0) ans = 0;
else{
int t = W;
tmp = min(t,tmp);
}
//Tの字に割る
for(int i = 1; i <= W-1; i++){
for(int j = 1; j <= H-1; j++){
tmp = min(tmp,min(i*H,j*(W-i)));
}
}
//Eの字に割る
for(int i = 1; i <= H-1; i++){
for(int j = 1; j <= W-1; j++){
tmp = min(tmp,min(i*W,j*(H-i)));
}
}
cout << min(ans, tmp);
} | a.cc: In function 'int main()':
a.cc:12:19: error: expected ';' before '{' token
12 | else(W % 3 != 0){
| ^
| ;
a.cc:16:10: error: expected primary-expression before '==' token
16 | if(H % == 0) ans = 0;
| ^~
|
s419460722 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long h, w;
cin >> h >> w;
if (h % 3 == 0 || w % 3 == 0) {
cout << 0 << endl;
return 0;
}
if (h > w) swap(h, w);
long w1 = (w + 1) / 3, s1 = h * w1;
w -= w1;
if (h > w) swap(h, w);
if (h % 2 == 0 || w % 2 == 0) {
long s = h * w / 2;
cout << abs(s - s1) << endl;
return 0;
}
int w2 = w / 2, s2 = h * w2, w3 = w - w2, s3 = h * w3;
cout << max(max(abs(s1 - s2), abs(s1 - s3)), abs(s2 - s3)) << endl;
}
| a.cc: In function 'int main()':
a.cc:21:14: error: no matching function for call to 'max(const long int&, int)'
21 | cout << max(max(abs(s1 - s2), abs(s1 - s3)), abs(s2 - s3)) << 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:21:14: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
21 | cout << max(max(abs(s1 - s2), abs(s1 - s3)), abs(s2 - s3)) << 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:21:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
21 | cout << max(max(abs(s1 - s2), abs(s1 - s3)), abs(s2 - s3)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s000288024 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long h, w;
cin >> h >> w;
if (h % 3 == 0 || w % 3 == 0) {
cout << 0 << endl;
return 0;
}
if (h > w) swap(h, w);
long w1 = (w + 1) / 3, s1 = h * w1;
w -= w1;
if (h > w) swap(h, w);
if (h % 2 == 0 || w % 2 == 0) {
long s = h * w / 2;
cout << abs(s - s1) << endl;
return 0;
}
int w2 = w / 2, s2 = h * w2, w3 = w - w2, s3 = h * w3;
cout << max(abs(s1 - s2), abs(s1 - s3), abs(s2 - s3)) << 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 int; _Compare = int]':
a.cc:21:14: required from here
21 | cout << max(abs(s1 - s2), abs(s1 - s3), abs(s2 - s3)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
306 | if (__comp(__a, __b))
| ~~~~~~^~~~~~~~~~
|
s450234703 | p03713 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long
ll hoge(ll x, ll y, ll z) {
return max({abs(x - y), abs(y - z), abs(z - x)});
}
void solve() {
ll h, w, ans = INF; cin >> h >> w;
for(ll i = 1; i < h; i++) {
ll res = hoge(i * w, (h - i) * (ll)(w / 2), (h - i) * (w - w / 2));
ans = min(ans, res;)
}
for(ll i = 1; i < w; i++) {
ll res = hoge(i * h, (w - i) * (ll)(h / 2), (w - i) * (h - h / 2));
ans = min(ans, res);
}
cout << ans << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
//cout << fixed << setprecision(10);
//init();
solve();
//cout << "finish" << endl;
return 0;
} | a.cc: In function 'void solve()':
a.cc:57:27: error: expected ')' before ';' token
57 | ans = min(ans, res;)
| ~ ^
| )
a.cc:57:28: error: expected primary-expression before ')' token
57 | ans = min(ans, res;)
| ^
|
s067781411 | p03713 | C++ | using ll = long long ;
ll solve(ll h, ll w) {
ll mw = w/2;
ll ans = 1 << 30;
for(int hi = 1; hi <= h; ++hi) {
ll s1 = hi * w;
ll mh = (h - hi)/2;
ll s2, s3;
for(int f = 0; f<2; ++f) {
if(f==0) {
// vertical
s2 = (h - hi) * mw;
s3 = (h - hi) * (w - mw);
} else {
// horizontal
s2 = mh * w;
s3 = (h- hi - mh) * w;
}
ll smax = std::max({s1, s2, s3});
ll smin = std::min({s1, s2, s3});
ans = std::min({ans, smax-smin});
}
// ll tans = std::min({std::max({s1, s2_v, s3_v}) - std::min({s1, s2_v, s3_v}),
// std::max({s1, s2_h, s3_h}) - std::min({s1, s2_h, s3_h})});
// if (ans > tans) {
// ans = tans;
// if(ans<52000){
// std::cout<<
// std::cout << ans << std::endl;
// }
// }
}
return ans;
// std::cout << ans << std::endl;
}
int main(void) {
int h,w;
std::cin >> h >> w;
std::cout << std::min({solve(h,w), solve(w,h)}) << std::endl;
} | a.cc: In function 'll solve(ll, ll)':
a.cc:26:30: error: 'max' is not a member of 'std'
26 | ll smax = std::max({s1, s2, s3});
| ^~~
a.cc:27:30: error: 'min' is not a member of 'std'
27 | ll smin = std::min({s1, s2, s3});
| ^~~
a.cc:29:24: error: 'min' is not a member of 'std'
29 | ans = std::min({ans, smax-smin});
| ^~~
a.cc: In function 'int main()':
a.cc:49:10: error: 'cin' is not a member of 'std'
49 | std::cin >> h >> w;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using ll = long long ;
a.cc:51:10: error: 'cout' is not a member of 'std'
51 | std::cout << std::min({solve(h,w), solve(w,h)}) << std::endl;
| ^~~~
a.cc:51:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:51:23: error: 'min' is not a member of 'std'
51 | std::cout << std::min({solve(h,w), solve(w,h)}) << std::endl;
| ^~~
a.cc:51:61: error: 'endl' is not a member of 'std'
51 | std::cout << std::min({solve(h,w), solve(w,h)}) << std::endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using ll = long long ;
|
s532119692 | p03713 | C++ | #include "bits/stdc++.h"
using namespace std;
long long main() {
long long H, W;
cin >> H >> W;
if (H % 3 == 0 || W % 3 == 0) cout << 0 << endl;
else {
long long ans = 1e9;
for (long long i = 1; i <= H / 2; i++) {
long long S1 = i * W;
long long S2 = (H - i) * (W / 2);
long long S3 = (H - i) * (W - W / 2);
ans = min(ans, max(S1, max(S2, S3)) - min(S1, min(S2, S3)));
}
for (long long i = 1; i <= W / 2; i++) {
long long S1 = i * H;
long long S2 = (W - i) * (H / 2);
long long S3 = (W - i) * (H - H / 2);
ans = min(ans, max(S1, max(S2, S3)) - min(S1, min(S2, S3)));
}
ans = min(ans, ((H + 2) / 3) * W - (H / 3) * W);
ans = min(ans, ((W + 2) / 3) * H - (W / 3) * H);
cout << ans << endl;
}
} | cc1plus: error: '::main' must return 'int'
|
s624836638 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
//template
int H,W;
int ans=INF,a,b;
void f(int a,int b){
int c=H*W-a-b;if(a<=0||b<=0||c<=0)return;
ans=min(ans,max({a,b,c})-min({a,b,c}));
}
//main
signed main(){
cin>>H>>W;
for(int i=0;i<2;i++){
//横線2本
a=b=(H+1)/3*W;
f(a,b);
//縦1本->横1本
for(int j=1;j<W;j++){//縦をどこで入れるか全探索
a=j*H;b=H/2*(W-j);
f(a,b);
}
swap(H,W);
}
cout<<ans<<endl;
}
| a.cc:5:9: error: 'INF' was not declared in this scope
5 | int ans=INF,a,b;
| ^~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'a' was not declared in this scope
15 | a=b=(H+1)/3*W;
| ^
a.cc:15:7: error: 'b' was not declared in this scope
15 | a=b=(H+1)/3*W;
| ^
|
s298610791 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
int main() {
ll h,w; cin >> h >> w;
if(h%3==0 || w%3==0){
cout << 0 << endl;
} else {
ll min_val = mod;
for(ll i=1;i<h;++i){
vector<ll> v1,v2;
ll s1a = i*w;
ll s1b = (h-i)*(w/2);
ll s1c = h*w - s1a - s1b;
v1.push_back(s1a);
v1.push_back(s1b);
v1.push_back(s1c);
sort(all(v1));
min_val = min(min_val, v1[2]-v1[0]);
if(i!=h-1){
ll s2a = i*w;
ll s2b = ()(h-i)/2)*w;
ll s2c = h*w - s2a - s2b;
v2.push_back(s2a);
v2.push_back(s2b);
v2.push_back(s2c);
sort(all(v2));
min_val = min(min_val, v2[2]-v2[0]);
}
}
for(ll i=1;i<w;++i){
vector<ll> v1,v2;
ll s1a = h*i;
ll s1b = h/2*(w-i);
ll s1c = h*w - s1a - s1b;
v1.push_back(s1a);
v1.push_back(s1b);
v1.push_back(s1c);
sort(all(v1));
min_val = min(min_val, v1[2]-v1[0]);
if(i!=w-1){
ll s2a = h*i;
ll s2b = h*((w-i)/2);
ll s2c = h*w - s2a - s2b;
v2.push_back(s2a);
v2.push_back(s2b);
v2.push_back(s2c);
sort(all(v2));
min_val = min(min_val, v2[2]-v2[0]);
}
}
cout << min_val << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:19: error: expected primary-expression before ')' token
25 | ll s2b = ()(h-i)/2)*w;
| ^
|
s279512961 | p03713 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
long h,w,ans=0x7fffffffffffffff,a,b,c;
int main(){
cin>>h>>w;
if(h%3==0||w%3==0){cout<<0<<endl;return 0;}
for(long i=1;i<=h/2;i++){
a=w*i;
b=w/2*(h-i);
c=h*w-a-b;
ans=min(ans,max({a,b,c})-min({a,b,c}));
}
for(long i=1;i<=h/2;i++){
a=w*i;
b=(h-i)/2*w;
c=h*w-a-b;
ans=min(ans,max({a,b,c})-min({a,b,c}));
}
for(long i=1;i<=w/2;i++){
a=h*i;
b=h/2*(w-i);
c=h*w-a-b;
ans=min(ans,max({a,b,c})-min({a,b,c}));
}
for(long i=1;i<=w/2;i++){
a=h*i;
b=(w-i)/2*h;
c=h*w-a-b;
ans=min(ans,max({a,b,c})-min({a,b,c}));
}
cout<<ans<<endl;
return | a.cc: In function 'int main()':
a.cc:33:15: error: expected primary-expression at end of input
33 | return
| ^
a.cc:33:15: error: expected ';' at end of input
33 | return
| ^
| ;
a.cc:33:15: error: expected '}' at end of input
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s827840628 | p03713 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
const ll INF = 1000000000000;
ll H, W, hA, hB, hC, hBC, wA, wB, wC, wBC, SA, SB, SC, t;
ll ans1 = INF, ans2 = INF, ans3 = INF, ans4 = INF, anser;
ll S[3];
cin >> H >> W;
for(hA = 1; hA <= H-2; hA++) {
hB = (H - hA)/2;
hC = H - (hA + hB);
SA = hA*W; SB = hB*W; SC = hC*W;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans1 = min(ans1, t);
}
for(hA = 1; hA <= H-1; hA++) {
hBC = H - hA;
wB = W/2;
wC = W - wB;
SA = hA*W; SB = hBC*wB; SC = hBC*wC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans2 = min(ans2, t);
}
for(wA = 1; wA <= W-2; wA++) {
wB = (W - wA)/2;
wC = W - (wA + wB);
SA = H*wA; SB = H*wB; SC = H*wC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans3 = min(ans3, t);
}
for(wA = 1; wA <= W-1; wA++) {
wBC = W - wA;
hB = H/2;
hC = H - hB;
SA = H*wA; SB = hB*wBC; SC = hC*wBC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans4 = min(ans4, t);
}
anser = min({ans1, ans2, ans3, ans4});
cout << anser;
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:11: error: assigning to an array from an initializer list
22 | S = {SA, SB, SC};
| ~~^~~~~~~~~~~~~~
a.cc:33:11: error: assigning to an array from an initializer list
33 | S = {SA, SB, SC};
| ~~^~~~~~~~~~~~~~
a.cc:43:11: error: assigning to an array from an initializer list
43 | S = {SA, SB, SC};
| ~~^~~~~~~~~~~~~~
a.cc:54:11: error: assigning to an array from an initializer list
54 | S = {SA, SB, SC};
| ~~^~~~~~~~~~~~~~
|
s628084804 | p03713 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main() {
const ll INF = 1 << 50;
ll H, W, hA, hB, hC, hBC, wA, wB, wC, wBC, SA, SB, SC, t;
ll ans1 = INF, ans2 = INF, ans3 = INF, ans4 = INF, anser;
ll S[];
cin >> H >> W;
for(hA = 1; hA <= H-2; hA++) {
hB = (H - hA)/2;
hC = H - (hA + hB);
SA = hA*W; SB = hB*W; SC = hC*W;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans1 = min(ans1, t);
}
for(hA = 1; hA <= H-1; hA++) {
hBC = H - hA;
wB = W/2;
wC = W - wB;
SA = hA*W; SB = hBC*wB; SC = hBC*wC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans2 = min(ans2, t);
}
for(wA = 1; wA <= W-2; wA++) {
wB = (W - wA)/2;
wC = W - (wA + wB);
SA = H*wA; SB = H*wB; SC = H*wC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans3 = min(ans3, t);
}
for(wA = 1; wA <= W-1; wA++) {
wBC = W - wA;
hB = H/2;
hC = H - hB;
SA = H*wA; SB = hB*wBC; SC = hC*wBC;
S = {SA, SB, SC};
sort(S, S+3);
t = S[2] - S[0];
ans4 = min(ans4, t);
}
anser = min({ans1, ans2, ans3, ans4});
cout << anser;
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:22: warning: left shift count >= width of type [-Wshift-count-overflow]
12 | const ll INF = 1 << 50;
| ~~^~~~~
a.cc:15:8: error: storage size of 'S' isn't known
15 | ll S[];
| ^
|
s668850535 | p03713 | C++ | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
using namespace std;
int main(){
long long ans = 999999999999999;
for(int i = 1; i < n; i++){
a = i * m;
b = m/2;
c = t - a - b;
if(c > 0 && b > 0){
ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
//cout << a << "," << b << "," << c << endl;
}
}
for(int i = 1; i < n; i++){
a = i * m;
b = m/2 * (n-i);
c = t - a - b;
if(c > 0 && b > 0){
ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
//cout << a << "," << b << "," << c << endl;
}
}
swap(n,m);
for(int i = 1; i < n; i++){
a = i * m;
b = m/2;
c = t - a - b;
if(c > 0 && b > 0){
ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
//cout << a << "," << b << "," << c << endl;
}
}
for(int i = 1; i < n; i++){
a = i * m;
b = m/2 * (n-i);
c = t - a - b;
if(c > 0 && b > 0){
ans = min(ans, max(a,max(b,c)) - min(a,min(b,c)));
//cout << a << "," << b << "," << c << endl;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:22: error: 'n' was not declared in this scope
15 | for(int i = 1; i < n; i++){
| ^
a.cc:16:5: error: 'a' was not declared in this scope
16 | a = i * m;
| ^
a.cc:16:13: error: 'm' was not declared in this scope
16 | a = i * m;
| ^
a.cc:17:5: error: 'b' was not declared in this scope
17 | b = m/2;
| ^
a.cc:18:5: error: 'c' was not declared in this scope
18 | c = t - a - b;
| ^
a.cc:18:9: error: 't' was not declared in this scope
18 | c = t - a - b;
| ^
a.cc:25:22: error: 'n' was not declared in this scope
25 | for(int i = 1; i < n; i++){
| ^
a.cc:26:5: error: 'a' was not declared in this scope
26 | a = i * m;
| ^
a.cc:26:13: error: 'm' was not declared in this scope
26 | a = i * m;
| ^
a.cc:27:5: error: 'b' was not declared in this scope
27 | b = m/2 * (n-i);
| ^
a.cc:28:5: error: 'c' was not declared in this scope
28 | c = t - a - b;
| ^
a.cc:28:9: error: 't' was not declared in this scope
28 | c = t - a - b;
| ^
a.cc:35:8: error: 'n' was not declared in this scope; did you mean 'yn'?
35 | swap(n,m);
| ^
| yn
a.cc:35:10: error: 'm' was not declared in this scope; did you mean 'tm'?
35 | swap(n,m);
| ^
| tm
a.cc:37:5: error: 'a' was not declared in this scope
37 | a = i * m;
| ^
a.cc:38:5: error: 'b' was not declared in this scope
38 | b = m/2;
| ^
a.cc:39:5: error: 'c' was not declared in this scope
39 | c = t - a - b;
| ^
a.cc:39:9: error: 't' was not declared in this scope
39 | c = t - a - b;
| ^
a.cc:47:5: error: 'a' was not declared in this scope
47 | a = i * m;
| ^
a.cc:48:5: error: 'b' was not declared in this scope
48 | b = m/2 * (n-i);
| ^
a.cc:49:5: error: 'c' was not declared in this scope
49 | c = t - a - b;
| ^
a.cc:49:9: error: 't' was not declared in this scope
49 | c = t - a - b;
| ^
|
s478666148 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll h,w; cin>>h >>w;
int ans=INT_MAX;
for(int i=1;i<h;i++){
ll sa=i*w;
ll s=h*w-sa;
ans=min(ans,max(sa,s/2)-min(sa,s/2));
}
for(int i=1;i<w;i++){
ll sa=i*h;
ll s=h*w-sa;
ans=min(ans,max(sa,s/2)-min(sa,s/2));
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:10:12: error: no matching function for call to 'min(int&, long long int)'
10 | ans=min(ans,max(sa,s/2)-min(sa,s/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:10:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
10 | ans=min(ans,max(sa,s/2)-min(sa,s/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:10:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
10 | ans=min(ans,max(sa,s/2)-min(sa,s/2));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:12: error: no matching function for call to 'min(int&, long long int)'
15 | ans=min(ans,max(sa,s/2)-min(sa,s/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:15:12: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
15 | ans=min(ans,max(sa,s/2)-min(sa,s/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:15:12: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
15 | ans=min(ans,max(sa,s/2)-min(sa,s/2));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s819792468 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int H,W;
cin >> H >> W;
long long ans;
int hei,wid;
long long S1,S2,mini;
if(H%3==0||W%3==0){
ans=0;
}else if(H%2==0){
hei=H/2;
wid=W/3;
mini = hei*(W-3*wid);
wid++;
S1=hei*wid*2;
S2=hei*(W-wid);
while(abs(S2-S1)<mini){
mini=abs(S2-S1);
wid++;
S1=hei*wid*2;
S2=hei*(W-wid);
}
ans=mini;
}else if(W%2==0){
hei=H/3;
wid=W/2;
mini=wid*(H-hei*3);
hei++;
S1=wid*hei*2;
S2=wid*(H-hei);
while(abs(S2-S1)<mini){
mini=abs(S2-S1);
hei++;
S1=wid*hei*2;
S2=wid*(H-hei);
}
ans=mini;
}else{
hei=H/2;
wid=W/2;
mini=H*(W-wid)-hei*wid;
wid++;
S1=hei*wid;
S2=H*(W-wid);
while(min(abs(S2-S1),wid)<mini){
mini=min(abs(S2-S1),wid);
wid++;
S1=hei*wid;
S2=H*(W-wid);
}
ans=mini;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:47:26: error: no matching function for call to 'min(long long int, int&)'
47 | while(min(abs(S2-S1),wid)<mini){
| ~~~^~~~~~~~~~~~~~~~
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:47:26: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
47 | while(min(abs(S2-S1),wid)<mini){
| ~~~^~~~~~~~~~~~~~~~
/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:47:26: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
47 | while(min(abs(S2-S1),wid)<mini){
| ~~~^~~~~~~~~~~~~~~~
a.cc:48:33: error: no matching function for call to 'min(long long int, int&)'
48 | mini=min(abs(S2-S1),wid);
| ~~~^~~~~~~~~~~~~~~~
/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:48:33: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
48 | mini=min(abs(S2-S1),wid);
| ~~~^~~~~~~~~~~~~~~~
/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:48:33: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
48 | mini=min(abs(S2-S1),wid);
| ~~~^~~~~~~~~~~~~~~~
|
s728185363 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ll h,w;
cin >> h >> w;//h>=Wとしてよい
if(w>h){
swap(h,w);
}//hが長辺
if((h*w)%3 == 0){
cout << 0 << endl;
}else{
ll ans1=10000000002,ans2=10000000002,ans3=10000000002;
for(ll i=h/3;i <= (h+3)/3;i++){
for(ll j=max((2*h/3)-1,one);j <= (2*h+3)/3;j++){
ans1= min(ans1,max(w*i,max(w*(j-i),w*(h-j)))-min(w*i,min(w*(j-i),w*(h-j))));
}
}//長辺側から3分割する場合
for(ll i=h/3;i <= (h+3)/3;i++){
for(ll j=max((w/2)-1,one);j <= (2+w)/2 ;j++){
ans2=min(ans2,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
}
}//まず長辺側で切り、次に短辺側で切る
swap(h,w);
for(ll i=h/3;i <= (h+3)/3;i++){
for(ll j=max((w/2)-1,one);j <= (w+2)/2;j++){
ans3=min(ans3,max(w*i,max((h-i)*(w-j),(h-i)*j))-min(w*i,min((h-i)*(w-j),(h-i)*j)));
}
}//まず短辺側で切り、次に長辺側で切る
cout << min(ans1,min(ans2,ans3)) << endl;
}
} | a.cc: In function 'int main()':
a.cc:17:36: error: 'one' was not declared in this scope
17 | for(ll j=max((2*h/3)-1,one);j <= (2*h+3)/3;j++){
| ^~~
a.cc:23:34: error: 'one' was not declared in this scope
23 | for(ll j=max((w/2)-1,one);j <= (2+w)/2 ;j++){
| ^~~
a.cc:31:34: error: 'one' was not declared in this scope
31 | for(ll j=max((w/2)-1,one);j <= (w+2)/2;j++){
| ^~~
|
s024589672 | p03713 | Java |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) throws IOException {
new Main().solve();
}
private void solve() throws IOException {
try {
// solveA();
// solveB();
solveC();
// solveD();
// solveE();
// solveF();
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.flush();
out.close();
}
}
}
private void solveA() {
int numX = nextInt();
int numY = nextInt();
Map<Integer, Integer> wk = new HashMap<Integer, Integer>();
wk.put(1, 1);
wk.put(3, 1);
wk.put(5, 1);
wk.put(7, 1);
wk.put(8, 1);
wk.put(10, 1);
wk.put(12, 1);
wk.put(4, 2);
wk.put(6, 2);
wk.put(9, 2);
wk.put(11, 2);
wk.put(2, 3);
out.println(wk.get(numX) == wk.get(numY) ? "Yes" : "No");
}
private void solveB() {
int numH = nextInt();
int numW = nextInt();
IntStream.range(0, numH + 2).forEach(i -> {
StringBuilder builder = new StringBuilder();
char[] wk = new char[numW];
if (i != 0 && i != numH + 1) {
wk = next().toCharArray();
}
for (int j = 0; j < numW + 2; j++) {
if (i == 0 || i == numH + 1) {
builder.append("#");
continue;
}
if (j == 0 || j == numW + 1) {
builder.append("#");
} else {
builder.append(wk[j - 1]);
}
}
out.println(builder.toString());
});
// char[][] wk = new char[numH][numW];
//
// for (int i = 0; i < numH; i++) {
// wk[i] = next().toCharArray();
// }
//
// for (int i = 0; i < numH + 2; i++) {
// StringBuilder builder = new StringBuilder();
//
// for (int j = 0; j < numW + 2; j++) {
// if (i == 0 || i == numH + 1) {
// builder.append("#");
// continue;
// }
// if (j == 0 || j == numW + 1) {
// builder.append("#");
// } else {
// builder.append(wk[i - 1][j - 1]);
// }
// }
//
// out.println(builder.toString());
// }
}
long answer = Long.MAX_VALUE;
private void solveC() {
// System.out.println((long) (100000 * (100000 - 1)));
// System.out.println((long) 100000 * (99999));
// System.out.println((long) 99999 * 100000);
// System.out.println(w);
// System.out.println((h - i));
// System.out.println(w * (h - i));
int numH = nextInt();
int numW = nextInt();
out.println(chkSolvceC(numH, numW));
}
/**
*
* HWWWWWWW
* HWWWWWWW
* HWWWWWWW
* HWWWWWWW
*
*/
private long chkSolvceC(long numH, long numW) {
long res = Long.MAX_VALUE;
long pHW = Long.MAX_VALUE;
if (numH % 3 == 0 || numW % 3 == 0) {
//このパターンにおいては均等に3分割可能なため、差分が0になる
return 0;
}
/*
* 最小値の初期化
*
* 以下の形のチョコの場合、A=1列目、B=2列目、C=3と4列目が最も簡単にわかる分割方法
* つまり、最低この形をクリアするのは必須
* 1234
* PPPP
* PPPP
* PPPP
* PPPP
*
*/
/*
* 縦
* 最小パターンのためにnum%3の余りを分配
* 単純に(numH -numH/3)をHとして扱ってしまうと、mod3=2の時に問題が出る
*
* これは困る
* H/3 * W
* H/3 * W
* H/3+2 * W
*
* こうしたい
* H/3 * W
* H/3+1 * W
* H/3+1 * W
*/
long m1 = 0;
long m2 = 0;
long m3 = 0;
switch ((int) numH % 3) {
case 0:
break;
case 1:
m3 = 1;
break;
case 2:
m2 = 1;
m3 = 1;
break;
}
long pA1 = (numH / 3 + m1) * numW;
long pA2 = (numH / 3 + m2) * numW;
long pA3 = (numH / 3 + m3) * numW;
pHW = pA3 - pA1;
res = Math.min(res, pHW);
//横 最小パターンのためにnum%3の余りを分配
switch ((int) numW % 3) {
case 0:
break;
case 1:
m3 = 1;
break;
case 2:
m2 = 1;
m3 = 1;
break;
}
long pB1 = (long) (numW / 3 + m1) * numH;
long pB2 = (long) (numW / 3 + m2) * numH;
long pB3 = (long) (numW / 3 + m3) * numH;
pHW = pB3 - pB1;
res = Math.min(res, pHW);
for (int i = 0; i < 2; i++) {
int wkH = 0;
int wkW = 0;
if (i == 0) {
wkH = numH;
wkW = numW;
} else {
wkH = numW;
wkW = numH;
}
long wkH1 = (wkH / 2);
long wkH2 = (wkH - wkH / 2);
for (int j = 1; j < wkW; j++) {
long wkW1 = (wkW - j);
long p1 = (long) wkH * j;
long p2 = (long) wkH1 * wkW1;
long p3 = (long) wkH2 * wkW1;
long max = Math.max(Math.max(p1, p2), p3);
long min = Math.min(Math.min(p1, p2), p3);
res = Math.min(res, max - min);
}
}
//三分割(再帰で書いたらstackoveflowした)
// pHW = saikiC(1, numH, numW);
// res = Math.min(res, pHW);
//
// pHW = saikiC(1, numW, numH);
// res = Math.min(res, pHW);
return res;
}
private long saikiC(int currentWI, int numH, int numW) {
if (currentWI > numW) {
return Long.MAX_VALUE;
}
long res = Long.MAX_VALUE;
long p1 = numH * currentWI;
long p2 = (numH / 2) * (numW - currentWI);
long p3 = (numH / 2 + numH % 2) * (numW - currentWI);
long max = Math.max(Math.max(p1, p2), p3);
long min = Math.min(Math.min(p1, p2), p3);
res = Math.abs(max - min);
return Math.min(res, saikiC(currentWI + 1, numH, numW));
}
private void solveD() {
int numN = nextInt();
out.println("");
}
private void solveE() {
int numN = nextInt();
out.println("");
}
private void solveF() {
int numN = nextInt();
out.println("");
}
private final PrintWriter out = new PrintWriter(System.out);
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
private void skipUnprintable() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
}
public boolean hasNext() {
skipUnprintable();
return hasNextByte();
}
public int nextInt() {
return Integer.parseInt(next());
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
} | Main.java:212: error: incompatible types: possible lossy conversion from long to int
wkH = numH;
^
Main.java:213: error: incompatible types: possible lossy conversion from long to int
wkW = numW;
^
Main.java:215: error: incompatible types: possible lossy conversion from long to int
wkH = numW;
^
Main.java:216: error: incompatible types: possible lossy conversion from long to int
wkW = numH;
^
4 errors
|
s567808942 | p03713 | Java |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) throws IOException {
new Main().solve();
}
private void solve() throws IOException {
try {
// solveA();
// solveB();
solveC();
// solveD();
// solveE();
// solveF();
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.flush();
out.close();
}
}
}
private void solveA() {
int numX = nextInt();
int numY = nextInt();
Map<Integer, Integer> wk = new HashMap<Integer, Integer>();
wk.put(1, 1);
wk.put(3, 1);
wk.put(5, 1);
wk.put(7, 1);
wk.put(8, 1);
wk.put(10, 1);
wk.put(12, 1);
wk.put(4, 2);
wk.put(6, 2);
wk.put(9, 2);
wk.put(11, 2);
wk.put(2, 3);
out.println(wk.get(numX) == wk.get(numY) ? "Yes" : "No");
}
private void solveB() {
int numH = nextInt();
int numW = nextInt();
IntStream.range(0, numH + 2).forEach(i -> {
StringBuilder builder = new StringBuilder();
char[] wk = new char[numW];
if (i != 0 && i != numH + 1) {
wk = next().toCharArray();
}
for (int j = 0; j < numW + 2; j++) {
if (i == 0 || i == numH + 1) {
builder.append("#");
continue;
}
if (j == 0 || j == numW + 1) {
builder.append("#");
} else {
builder.append(wk[j - 1]);
}
}
out.println(builder.toString());
});
// char[][] wk = new char[numH][numW];
//
// for (int i = 0; i < numH; i++) {
// wk[i] = next().toCharArray();
// }
//
// for (int i = 0; i < numH + 2; i++) {
// StringBuilder builder = new StringBuilder();
//
// for (int j = 0; j < numW + 2; j++) {
// if (i == 0 || i == numH + 1) {
// builder.append("#");
// continue;
// }
// if (j == 0 || j == numW + 1) {
// builder.append("#");
// } else {
// builder.append(wk[i - 1][j - 1]);
// }
// }
//
// out.println(builder.toString());
// }
}
long answer = Long.MAX_VALUE;
private void solveC() {
// System.out.println((long) (100000 * (100000 - 1)));
// System.out.println((long) 100000 * (99999));
// System.out.println((long) 99999 * 100000);
// System.out.println(w);
// System.out.println((h - i));
// System.out.println(w * (h - i));
int numH = nextInt();
int numW = nextInt();
out.println(chkSolvceC(numH, numW));
}
/**
*
* HWWWWWWW
* HWWWWWWW
* HWWWWWWW
* HWWWWWWW
*
*/
private long chkSolvceC(long numH, long numW) {
long res = Long.MAX_VALUE;
long pHW = Long.MAX_VALUE;
if (numH % 3 == 0 || numW % 3 == 0) {
//このパターンにおいては均等に3分割可能なため、差分が0になる
return 0;
}
/*
* 最小値の初期化
*
* 以下の形のチョコの場合、A=1列目、B=2列目、C=3と4列目が最も簡単にわかる分割方法
* つまり、最低この形をクリアするのは必須
* 1234
* PPPP
* PPPP
* PPPP
* PPPP
*
*/
/*
* 縦
* 最小パターンのためにnum%3の余りを分配
* 単純に(numH -numH/3)をHとして扱ってしまうと、mod3=2の時に問題が出る
*
* これは困る
* H/3 * W
* H/3 * W
* H/3+2 * W
*
* こうしたい
* H/3 * W
* H/3+1 * W
* H/3+1 * W
*/
long m1 = 0;
long m2 = 0;
long m3 = 0;
switch ((int) numH % 3) {
case 0:
break;
case 1:
m3 = 1;
break;
case 2:
m2 = 1;
m3 = 1;
break;
}
long pA1 = (numH / 3 + m1) * numW;
long pA2 = (numH / 3 + m2) * numW;
long pA3 = (numH / 3 + m3) * numW;
pHW = pA3 - pA1;
res = Math.min(res, pHW);
//横 最小パターンのためにnum%3の余りを分配
switch ((int) numW % 3) {
case 0:
break;
case 1:
m3 = 1;
break;
case 2:
m2 = 1;
m3 = 1;
break;
}
long pB1 = (long) (numW / 3 + m1) * numH;
long pB2 = (long) (numW / 3 + m2) * numH;
long pB3 = (long) (numW / 3 + m3) * numH;
pHW = pB3 - pB1;
res = Math.min(res, pHW);
for (int i = 0; i < 2; i++) {
int wkH = 0;
int wkW = 0;
if (i == 0) {
wkH = numH;
wkW = numW;
} else {
wkH = numW;
wkW = numH;
}
long wkH1 = (wkH / 2);
long wkH2 = (wkH - wkH / 2);
for (int j = 1; j < wkW; j++) {
long wkW1 = (wkW - j);
long p1 = (long) wkH * j;
long p2 = (long) wkH1 * wkW1;
long p3 = (long) wkH2 * wkW1;
long max = Math.max(Math.max(p1, p2), p3);
long min = Math.min(Math.min(p1, p2), p3);
res = Math.min(res, max - min);
}
}
//三分割(再帰で書いたらstackoveflowした)
// pHW = saikiC(1, numH, numW);
// res = Math.min(res, pHW);
//
// pHW = saikiC(1, numW, numH);
// res = Math.min(res, pHW);
return res;
}
private long saikiC(int currentWI, int numH, int numW) {
if (currentWI > numW) {
return Long.MAX_VALUE;
}
long res = Long.MAX_VALUE;
long p1 = numH * currentWI;
long p2 = (numH / 2) * (numW - currentWI);
long p3 = (numH / 2 + numH % 2) * (numW - currentWI);
long max = Math.max(Math.max(p1, p2), p3);
long min = Math.min(Math.min(p1, p2), p3);
res = Math.abs(max - min);
return Math.min(res, saikiC(currentWI + 1, numH, numW));
}
private void solveD() {
int numN = nextInt();
out.println("");
}
private void solveE() {
int numN = nextInt();
out.println("");
}
private void solveF() {
int numN = nextInt();
out.println("");
}
private final PrintWriter out = new PrintWriter(System.out);
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte())
return buffer[ptr++];
else
return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
private void skipUnprintable() {
while (hasNextByte() && !isPrintableChar(buffer[ptr]))
ptr++;
}
public boolean hasNext() {
skipUnprintable();
return hasNextByte();
}
public int nextInt() {
return Integer.parseInt(next());
}
public String next() {
if (!hasNext())
throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext())
throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
} | Main.java:212: error: incompatible types: possible lossy conversion from long to int
wkH = numH;
^
Main.java:213: error: incompatible types: possible lossy conversion from long to int
wkW = numW;
^
Main.java:215: error: incompatible types: possible lossy conversion from long to int
wkH = numW;
^
Main.java:216: error: incompatible types: possible lossy conversion from long to int
wkW = numH;
^
4 errors
|
s571680376 | p03713 | C++ | #include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int H, W;
cin >> H >> W;
int ans = LLINF;
REP(k, 2) {
FOR(i,1, H) {
int a = i*W;
int b = (H - i)*(W / 2);
int c = (H - i)*(W - W / 2);
if (i == 2)
//cout << a << " " << b << " " << c << endl;
int cnt = max(a, max(b, c)) - min(a, min(b, c));
ans = min(cnt, ans);
b = (H - i) / 2 * W;
c = (H - i - (H - i)/2)*W;
cnt = max(a, max(b, c)) - min(a, min(b, c));
ans = min(cnt, ans);
}
swap(H, W);
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:47:35: error: 'cnt' was not declared in this scope; did you mean 'int'?
47 | ans = min(cnt, ans);
| ^~~
| int
|
s009237711 | p03713 | C++ | #include <bits/stdc++.h>
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;
}
if(H<W)swap(H,W);
ll case1,case2;
case1=case2=1e12;
for(int i=0;i<2;i++){
if(i)swap(H,W);
if(H<3||W<2) break;
ll S=(H+3-1)/3*W-H/3*W;
ll a1=H/3*W;
ll b1=(H-H/3)*(W/2);
ll c1=(H-H/3)*((W+2-1)/2);
ll s1=max({abs(a1-b1),abs(c1-b1),abs(c2-a2)});
ll a2=(H+3-1)/3*W;
ll b2=(H-(H+3-1)/3)*(W/2);
ll c2=(H-(H+3-1)/3)*((W+2-1)/2);
ll s2=max({abs(a2-b2),abs(c2-b2),abs(c2-a2)});
case1=min(S,case1);
case2=min({s1,s2,case2});
}
cout<<min(case1,case2)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:27:46: error: 'c2' was not declared in this scope; did you mean 'c1'?
27 | ll s1=max({abs(a1-b1),abs(c1-b1),abs(c2-a2)});
| ^~
| c1
a.cc:27:49: error: 'a2' was not declared in this scope; did you mean 'a1'?
27 | ll s1=max({abs(a1-b1),abs(c1-b1),abs(c2-a2)});
| ^~
| a1
a.cc:27:18: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
27 | ll s1=max({abs(a1-b1),abs(c1-b1),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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
a.cc:32:18: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
32 | ll s2=max({abs(a2-b2),abs(c2-b2),abs(c2-a2)});
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 1 provided
|
s827121519 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
int ans = 1e9*1e9;
//
for (int h=1; h<H-1; h++) {
int a = h*W;
// b and c divided by tate
int w = W/2;
int b = (H-h)*w;
int c = (H-h)*(W-w);
int s_max = max(max(a, b), c);
int s_min = min(min(a, b), c);
if(ans > s_max - s_min) ans = s_max - s_min;
//b and c divided by yoko
int h2 = (H-h)/2;
b = h2*W;
c = (H-h-h2)*W;
| a.cc: In function 'int main()':
a.cc:8:16: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
8 | int ans = 1e9*1e9;
| ~~~^~~~
a.cc:24:20: error: expected '}' at end of input
24 | c = (H-h-h2)*W;
| ^
a.cc:11:29: note: to match this '{'
11 | for (int h=1; h<H-1; h++) {
| ^
a.cc:24:20: error: expected '}' at end of input
24 | c = (H-h-h2)*W;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s108326614 | p03713 | C++ | using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }
long H,W,a,b,c,h,hh,w,ww,ans;
inline void solve(){
ans=1LL<<60;
IN2(H,W);
UP(h,2,H){
a=h*W;
hh=(H-h)/2;
b=hh*W;
c=(H-h-hh)*W;
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
ww=W/2;
b=(H-h)*WW;
c=(H-h)*(W-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
UP(w,2,W){
a=H*w;
ww=(W-w)/2;
b=H*ww;
c=H*(W-w-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
hh=H/2;
b=hh*(W-w);
c=(H-hh)*(W-w);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
OUT(ans);
}
int main(int argc,char**argv){
BEGIN;
solve();
END;
}
| a.cc: In function 'void solve()':
a.cc:39:13: error: 'WW' was not declared in this scope; did you mean 'ww'?
39 | b=(H-h)*WW;
| ^~
| ww
|
s591818961 | p03713 | C++ | using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }
long H,W,a,b,c,h,hh,w,ww;
inline void solve(){
IN2(H,W);
UP(h,2,H){
a=h*W;
hh=(H-h)/2;
b=hh*W;
c=(H-h-hh)*W;
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
ww=W/2;
b=(H-h)*WW;
c=(H-h)*(W-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
UP(w,2,W){
a=H*w;
ww=(W-w)/2;
b=H*ww;
c=H*(W-w-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
hh=H/2;
b=hh*(W-w);
c=(H-hh)*(W-w);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
OUT(ans);
}
int main(int argc,char**argv){
BEGIN;
solve();
END;
}
| a.cc: In function 'void solve()':
a.cc:36:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
36 | chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
| ^~~
| abs
a.cc:38:13: error: 'WW' was not declared in this scope; did you mean 'ww'?
38 | b=(H-h)*WW;
| ^~
| ww
a.cc:47:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
47 | chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
| ^~~
| abs
a.cc:53:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
53 | OUT(ans);
| ^~~
a.cc:15:22: note: in definition of macro 'OUT'
15 | #define OUT(P) cout<<P<<endl
| ^
|
s996376035 | p03713 | C++ | using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }
long H,W;
inline void solve(){
IN2(H,W);
UP(h,2,H){
a=h*W;
hh=(H-h)/2;
b=hh*W;
c=(H-h-hh)*W;
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
ww=W/2;
b=(H-h)*WW;
c=(H-h)*(W-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
UP(w,2,W){
a=H*w;
ww=(W-w)/2;
b=H*ww;
c=H*(W-w-ww);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
hh=H/2;
b=hh*(W-w);
c=(H-hh)*(W-w);
chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
}
OUT(ans);
}
int main(int argc,char**argv){
BEGIN;
solve();
END;
}
| a.cc: In function 'void solve()':
a.cc:31:6: error: 'h' was not declared in this scope
31 | UP(h,2,H){
| ^
a.cc:7:24: note: in definition of macro 'UP'
7 | #define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
| ^
a.cc:32:5: error: 'a' was not declared in this scope
32 | a=h*W;
| ^
a.cc:33:5: error: 'hh' was not declared in this scope
33 | hh=(H-h)/2;
| ^~
a.cc:34:5: error: 'b' was not declared in this scope
34 | b=hh*W;
| ^
a.cc:35:5: error: 'c' was not declared in this scope
35 | c=(H-h-hh)*W;
| ^
a.cc:36:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
36 | chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
| ^~~
| abs
a.cc:37:5: error: 'ww' was not declared in this scope
37 | ww=W/2;
| ^~
a.cc:38:13: error: 'WW' was not declared in this scope; did you mean 'W'?
38 | b=(H-h)*WW;
| ^~
| W
a.cc:42:6: error: 'w' was not declared in this scope
42 | UP(w,2,W){
| ^
a.cc:7:24: note: in definition of macro 'UP'
7 | #define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
| ^
a.cc:43:5: error: 'a' was not declared in this scope
43 | a=H*w;
| ^
a.cc:44:5: error: 'ww' was not declared in this scope
44 | ww=(W-w)/2;
| ^~
a.cc:45:5: error: 'b' was not declared in this scope
45 | b=H*ww;
| ^
a.cc:46:5: error: 'c' was not declared in this scope
46 | c=H*(W-w-ww);
| ^
a.cc:47:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
47 | chmin(ans,max(a,max(b,c))-min(a,min(b,c)));
| ^~~
| abs
a.cc:48:5: error: 'hh' was not declared in this scope
48 | hh=H/2;
| ^~
a.cc:53:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
53 | OUT(ans);
| ^~~
a.cc:15:22: note: in definition of macro 'OUT'
15 | #define OUT(P) cout<<P<<endl
| ^
|
s055404109 | p03713 | C++ | using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
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; }
long H,W,a,b,c;
long even(long a, long b){
if(a%2==0)return a;
else return b;
}
inline void solve(){
IN2(H,W);
if(H%3==0||W%3==0){
OUT(0);
}else if((H%2==0&&W%2!=0)||(H%2!=0&&W%2==0)){
a=H*W/3/even(H,W)+1;
b=even(H,W)*a;
c=(odd(H,W)-a)*(even(H,W)/2);
OUT(abs(b-c));
}else{
a=H*W/3/min(H,W)+1;
b=min(H,W)*a;
c=(max(H,W)-a)*(min(H,W)/2);
OUT(b-c);
}
}
int main(int argc,char**argv){
BEGIN;
solve();
END;
}
| a.cc: In function 'void solve()':
a.cc:40:8: error: 'odd' was not declared in this scope
40 | c=(odd(H,W)-a)*(even(H,W)/2);
| ^~~
|
s204488998 | p03713 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int h, w;
cin >> h >> w;
int a_size;
int b_size;
int a, b, c;
//case 1
if (h % 3 == 0) {
a_size = h / 3;
}
else if (h % 3 == 1) {
a_size = (h - 1) / 3;
}
else {
a_size = (h - 2) / 3;
}
a = a_size * w;
//縦向き
if ((h - a_size) % 2 == 0) {
b_size = (h - a_size) / 2;
}
else {
b_size = (h - a_size - 1) / 2;
}
b = b_size * w;
c = h * w - a - b;
int ans = max(a,b,c)-min(a,b,c);
//横向き
if (w % 2 == 0) {
b_size = w / 2;
}
else {
b_size = (w - 1) / 2;
}
b = b_size * (h - a_size);
c = h * w - a - b;
ans = min(ans, max(a, b, c) - min(a, b, c));
cout << ans << 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:31:15: required from here
31 | int ans = 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 = int; _Compare = int]':
a.cc:31:26: required from here
31 | int ans = 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))
| ~~~~~~^~~~~~~~~~
|
s063200233 | p03713 | C++ | include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll n,m,ans=INF,a,b,c,smax,smin;
cin >> n>>m;
if (!(n % 3)|| !(m % 3)) {
cout << 0 << endl;
return 0;
}
else{
ans = min(m,n);
}
for (ll i = 1; i <= n; ++i) {
a = i * m;
b = (n-i)*(m / 2);
c = (n - i)*(m-(m / 2));
smax = max(a, max(b, c));
smin = min(a, min(b, c));
ll temp = smax - smin;
ans = min(ans, temp);
}
for (ll i = 1; i <= m; ++i) {
a = i * n;
b = (m - i)*(n / 2);
c = (m - i)*(n - (n / 2));
smax = max(a, max(b, c));
smin = min(a, min(b, c));
ll temp = smax - smin;
ans = min(ans, temp);
}
cout << ans << endl;
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
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'
164 | __is_null_pointer(std::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:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::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:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/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'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/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'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| |
s851153435 | p03713 | Java | import java.util.Scanner;
public class atcoder {
public static void main(String[] args) {
Scanner stdIn=new Scanner(System.in);
long H=stdIn.nextLong();
long W=stdIn.nextLong();
long min=2147482704;
long z=1;
if(H%3==0||W%3==0)
System.out.println(0);
else{
while(H-1>z){
if(W/2*z<(H-z)*W){
if(min>((H-z)*W)-(W/2*z))
min=((H-z)*W)-(W/2*z);
}
else{
if(min>(W/2*z)-((H-z)*W))
min=(W/2*z)-((H-z)*W);
}
z++;
}z=1;
while(W-1>z){
if(H/2*z<(W-z)*H){
if(min>((W-z)*H)-(H/2*z))
min=((W-z)*H)-(H/2*z);
}
else{
if(min>(H/2*z)-((W-z)*H))
min=(H/2*z)-((W-z)*H);
}
z++;
}
}
System.out.println(min);
}
} | Main.java:2: error: class atcoder is public, should be declared in a file named atcoder.java
public class atcoder {
^
1 error
|
s015378435 | p03713 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int h,w,ans=-1;
cin>>h>>w;
if(h%3==0 || w%3==0)ans=0;
else if(h%2==0 || h==w)ans=h/2;
else if(h%2==1 || h==w)ans=h-1;
if(ans==-1){
if(h>w)swap(h,w);
if(h%2==0){
if(w%2==1 && w<h/2)ans=w;
else ans=h/2;
}else{
if(w%2==0 && w/2<h)ans=w/2;
else ans=h;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
22 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s649573915 | p03713 | C++ | }
long long w = H * W / 3 / H;
long long ans2 = abs( w * H - (W - w) * (H / 2) );
rest = H * W - w * H - (W - w) * (H / 2);
ans2 = max( ans2, max( abs( w * H - rest ), abs( abs( (W - w) * (H / 2) - rest ) ) ) );
while( 1 ) {
w++;
long long nextans = abs( w * H - (W - w) * (H / 2) );
rest = H * W - w * H - (W - w) * (H / 2);
nextans = max( nextans, max( abs( w * H - rest ), abs( abs( (W - w) * (H / 2) - rest ) ) ) );
if( nextans > ans2 ) {
break;
}
ans2 = min( ans2, nextans );
}
h = H / 3;
long long ans3 = abs( h * W - (h + 1) * W );
w = W / 3;
long long ans4 = abs( w * H - (w + 1) * H );
ans = min( ans1, min( ans2, min( ans3, ans4 ) ) );
}
cout << ans << endl;
return 0;
}
| a.cc:1:17: error: expected declaration before '}' token
1 | }
| ^
a.cc:2:31: error: 'H' was not declared in this scope
2 | long long w = H * W / 3 / H;
| ^
a.cc:2:35: error: 'W' was not declared in this scope
2 | long long w = H * W / 3 / H;
| ^
a.cc:2:43: error: 'H' was not declared in this scope
2 | long long w = H * W / 3 / H;
| ^
a.cc:3:43: error: 'H' was not declared in this scope
3 | long long ans2 = abs( w * H - (W - w) * (H / 2) );
| ^
a.cc:3:48: error: 'W' was not declared in this scope
3 | long long ans2 = abs( w * H - (W - w) * (H / 2) );
| ^
a.cc:3:58: error: 'H' was not declared in this scope
3 | long long ans2 = abs( w * H - (W - w) * (H / 2) );
| ^
a.cc:3:34: error: 'abs' was not declared in this scope
3 | long long ans2 = abs( w * H - (W - w) * (H / 2) );
| ^~~
a.cc:4:17: error: 'rest' does not name a type
4 | rest = H * W - w * H - (W - w) * (H / 2);
| ^~~~
a.cc:5:17: error: 'ans2' does not name a type
5 | ans2 = max( ans2, max( abs( w * H - rest ), abs( abs( (W - w) * (H / 2) - rest ) ) ) );
| ^~~~
a.cc:6:17: error: expected unqualified-id before 'while'
6 | while( 1 ) {
| ^~~~~
a.cc:16:17: error: 'h' does not name a type
16 | h = H / 3;
| ^
a.cc:17:39: error: 'h' was not declared in this scope
17 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:17:43: error: 'W' was not declared in this scope
17 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:17:48: error: 'h' was not declared in this scope
17 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:17:57: error: 'W' was not declared in this scope
17 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:17:34: error: 'abs' was not declared in this scope
17 | long long ans3 = abs( h * W - (h + 1) * W );
| ^~~
a.cc:18:17: error: 'w' does not name a type
18 | w = W / 3;
| ^
a.cc:19:43: error: 'H' was not declared in this scope
19 | long long ans4 = abs( w * H - (w + 1) * H );
| ^
a.cc:19:57: error: 'H' was not declared in this scope
19 | long long ans4 = abs( w * H - (w + 1) * H );
| ^
a.cc:19:34: error: 'abs' was not declared in this scope
19 | long long ans4 = abs( w * H - (w + 1) * H );
| ^~~
a.cc:20:17: error: 'ans' does not name a type
20 | ans = min( ans1, min( ans2, min( ans3, ans4 ) ) );
| ^~~
a.cc:21:9: error: expected declaration before '}' token
21 | }
| ^
a.cc:23:9: error: 'cout' does not name a type
23 | cout << ans << endl;
| ^~~~
a.cc:25:9: error: expected unqualified-id before 'return'
25 | return 0;
| ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s249087164 | p03713 | C++ | h = H / 3;
long long ans3 = abs( h * W - (h + 1) * W );
| a.cc:1:17: error: 'h' does not name a type
1 | h = H / 3;
| ^
a.cc:2:39: error: 'h' was not declared in this scope
2 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:2:43: error: 'W' was not declared in this scope
2 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:2:48: error: 'h' was not declared in this scope
2 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:2:57: error: 'W' was not declared in this scope
2 | long long ans3 = abs( h * W - (h + 1) * W );
| ^
a.cc:2:34: error: 'abs' was not declared in this scope
2 | long long ans3 = abs( h * W - (h + 1) * W );
| ^~~
|
s870827873 | p03713 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long
int main () {
ll n, m;
cin >> n >> m;
if (n % 3 == 0 || m % 3 == 0 ) {
cout << 0 << endl;
}
else {
vector<ll> sub(3);
// まずはどの程度やるか決める
ll min = -1;
ll l = n / 3;
ll v[5] = {0, -1, 1, -2, 2, 3, -3};
for (ll i = 0; i < 7; i++) {
ll j = l + v[i];
sub[0] = j * m;
if (j <= 0 || j >= n) {
}
else {
for (ll q = 1; q < m; q++) {
sub[0] = j * m;
sub[1] = q * (n - j);
sub[2] = (n - j) * (m - q);
sort(sub.begin(), sub.end());
if (min == -1 || sub[2] - sub[0] <= min) {
min = sub[2] - sub[0];
}
}
}
}
l = m / 3;
for (ll i = 0; i < 7; i++) {
ll j = l + v[i];
sub[0] = j * n;
if (j <= 0 || j >= m) {
}
else {
for (ll q = 1; q < n; q++ ) {
sub[0] = j * n;
sub[1] = q * (m - j);
sub[2] = (m - j) * (n - q);
sort(sub.begin(), sub.end());
if (min == -1 || sub[2] - sub[0] <= min) {
min = sub[2] - sub[0];
}
}
}
}
cout << min << endl;
}
} | a.cc: In function 'int main()':
a.cc:17:38: error: too many initializers for 'long long int [5]'
17 | ll v[5] = {0, -1, 1, -2, 2, 3, -3};
| ^
|
s837011938 | p03713 | C++ | H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:
print(0)
else:
S_list = []
for i in range(1, H-1):
w = W//2
S_A = i*W
S_B = (H-i)*w
S_C = (H-i)*(W-w)
S_list.append(max(S_A,S_B,S_C) -min(S_A,S_B,S_C))
for i in range(1, W-1):
h = H//2
S_A = i*H
S_B = (W-i)*h
S_C = (W-i)*(H-h)
S_list.append(max(S_A,S_B,S_C) -min(S_A,S_B,S_C))
print(min(S_list)) | a.cc:1:1: error: 'H' does not name a type
1 | H, W = map(int, input().split())
| ^
|
s871883680 | p03713 | C++ | H, W = map(int, input().split())
if H % 3 == 0 or W % 3 == 0:
print(0)
else:
S_list = []
for i in range(1, H-1):
w = W//2
S_A = i*W
S_B = (H-i)*w
S_C = (H-i)*(W-w)
S_list.append(max(S_A,S_B,S_C) -min(S_A,S_B,S_C))
for i in range(1, W-1):
h = H//2
S_A = i*H
S_B = (W-i)*h
S_C = (W-i)*(H-h)
S_list.append(max(S_A,S_B,S_C) -min(S_A,S_B,S_C))
print(min(S_list)) | a.cc:1:1: error: 'H' does not name a type
1 | H, W = map(int, input().split())
| ^
|
s504903706 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
int main(){
int H,W;
cin >> H >> W;
if(H % 3 == 0 || W % 3 == 0){
cout << 0 << endl;
return 0;
}
if(H < 2)
int Smax , Smin;
if(H % 2 == 1){
Smax = (H/2 + 1)* W;
H /= 2;
Smin = W/2 * H;
}else if(W % 2 == 1){
Smax = (W/2 + 1)* H;
W /= 2;
Smin = H/2 * H;
}else{
Smax = H/2 * W;
Smin = H/2 *W/2;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:5: error: 'Smax' was not declared in this scope; did you mean 'fmax'?
19 | Smax = (H/2 + 1)* W;
| ^~~~
| fmax
a.cc:21:5: error: 'Smin' was not declared in this scope; did you mean 'fmin'?
21 | Smin = W/2 * H;
| ^~~~
| fmin
a.cc:23:5: error: 'Smax' was not declared in this scope; did you mean 'fmax'?
23 | Smax = (W/2 + 1)* H;
| ^~~~
| fmax
a.cc:25:5: error: 'Smin' was not declared in this scope; did you mean 'fmin'?
25 | Smin = H/2 * H;
| ^~~~
| fmin
a.cc:27:5: error: 'Smax' was not declared in this scope; did you mean 'fmax'?
27 | Smax = H/2 * W;
| ^~~~
| fmax
a.cc:28:5: error: 'Smin' was not declared in this scope; did you mean 'fmin'?
28 | Smin = H/2 *W/2;
| ^~~~
| fmin
|
s284573694 | p03713 | C++ | include<iostream>
#include<algorithm>
using ll = long long;
using namespace std;
int main() {
int H, W;
cin >> H >> W;
ll ans1=1e10, ans2=1e10, ans3=1e10, ans4=1e10;
if (H % 3 == 0 || W % 3 == 0)
cout << 0 << endl;
else {
for (int i = 1; i < H; ++i) {
int j = W / 2;
ll a1 = W * i;
ll b1 = (H - i)*j;
ll c1 = (H - i)*(W - j);
ll x1 = max(a1, b1);
x1 = max(x1, c1);
ll y1 = min(a1, b1);
y1 = min(c1, y1);
ll z1 = x1 - y1;
ans1 = min(z1, ans1);
}
for (int i = 0; i < H - 1; ++i) {
int j = (H - i) / 2;
ll a1 = W * i;
ll b1 = W * j;
ll c1 = W * (H - i - j);
ll x1 = max(a1, b1);
x1 = max(x1, c1);
ll y1 = min(a1, b1);
y1 = min(y1, c1);
ll z1 = x1 - y1;
ans2 = min(z1, ans2);
}
for (int i = 1; i < W; ++i) {
int j = H / 2;
ll a1 = H * i;
ll b1 = (W - i)*j;
ll c1 = (W - i)*(H - j);
ll x1 = max(a1, b1);
x1 = max(x1, c1);
ll y1 = min(a1, b1);
y1 = min(c1, y1);
ll z1 = x1 - y1;
ans3 = min(z1, ans3);
}
for (int i = 0; i < W - 1; ++i) {
int j = (W - i) / 2;
ll a1 = H * i;
ll b1 = H * j;
ll c1 = H * (W - i - j);
ll x1 = max(a1, b1);
x1 = max(x1, c1);
ll y1 = min(a1, b1);
y1 = min(y1, c1);
ll z1 = x1 - y1;
ans4 = min(z1, ans4);
}
ll ans5 = min(ans1, ans2);
ll ans6 = min(ans3, ans4);
cout << min(ans5, ans6) << endl;
}
return 0;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
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'
164 | __is_null_pointer(std::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:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::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:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/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'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/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'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s821328054 | p03713 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
int main(){
int H,W;
cin >> H >> W;
if(H%3 == 0 || W%3 == 0){
cout << 0 << endl;
}else{
ull ans = LLONG_MAX;
ull h = H, w = W;
for(ull i = 1; i < w; i++){
ull S1 = i*h;
ull S2, S3;
ull diff;
if(h % 2 == 1){
S2 = (w-i)*(h-1)/2;
S3 = (w-i)*(h+1)/2;
ull MAX = max(S1, max(S2, S3));
ull MIN = min(S1, min(S2, S3));
diff = MAX - MIN;
}
else{
S2 = (w-i)*(h/2);
//printf("S2:%lld\tw-i:%d\th/2:%d\n", S2, w-i, h/2);
diff = abs(S1 - S2);
}
ans = min(ans, diff);
//printf("ans:%d\tdiff:%lld\tS1:%lld\tS2:%lld\n", ans, diff, S1, S2);
}
for(ull i = 1; i < h; i++){
ull S1 = i*w;
ull S2, S3;
ull diff;
if(h % 2 == 1){
S2 = (h-i)*(w-1)/2;
S3 = (h-i)*(w+1)/2;
ull MAX = max(S1, max(S2, S3));
ull MIN = min(S1, min(S2, S3));
diff = MAX - MIN;
}
else{
S2 = (h-i)*w/2;
diff = abs(S1 - S2);
}
ans = min(ans, diff);
}
cout << ans << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:36:27: error: call of overloaded 'abs(ull)' is ambiguous
36 | diff = abs(S1 - S2);
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
| ^~~
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:54:27: error: call of overloaded 'abs(ull)' is ambiguous
54 | diff = abs(S1 - S2);
| ~~~^~~~~~~~~
/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); }
| ^~~
|
s380990457 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long long h,w,ans=1e18,yoko,tate;
cin>>h>>w;
yoko=w/2;
tate=h/2;
if(h==3||w==3){
cout<<0<<endl;
return 0;
}
for(int i=1;i<h-1;i++){
long long tate1=(h-i)/2;
ans=min(ans,max({i*w,tate1*w,(h-tate1-i)*w}),min({i*w,tate1*w,(h-tate1-i)*w}));
}
for(int i=1;i<w-1;i++){
long long yoko1=(w-i)/2;
ans=min(ans,max({i*h,yoko1*h,(w-yoko1-i)*h}),min({i*h,yoko1*h,(w-yoko1-i)*h}));
}
for(int i=1;i<h;i++){
ans=min(ans,max({i*w,(h-i)*yoko,(h-i)*(w-yoko)})-min({i*w,(h-i)*yoko,(h-i)*(w-yoko)}));
}
for(int i=1;i<w;i++){
ans=min(ans,max({i*h,(w-i)*tate,(w-i)*(h-tate)})-min({i*h,(w-i)*tate,(w-i)*(h-tate)}));
}
cout<<ans<<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::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:15:12: required from here
15 | ans=min(ans,max({i*w,tate1*w,(h-tate1-i)*w}),min({i*w,tate1*w,(h-tate1-i)*w}));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s563813191 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
long long h,w,ans=1e18,yoko,tate;
cin>>h>>w;
yoko=w/2;
tate=h/2;
if(h==3||w==3){
cout<<0<<endl;
return 0;
}
for(int i=1;i<h-1;i++){
ans=min(ans,max({i*w,((h-i)/2)*w,(h-((h-i)/2)-i)*w}),min({i*w,((h-i)/2)*w,(h-((h-i)/2)-i)*w}));
}
for(int i=1;i<w-1;i++){
ans=min(ans,max({i*h,((w-i)/2)*h,(w-((w-i)/2)-i)*h}),min({i*h,((w-i)/2)*h,(w-((w-i)/2)-i)*h}));
}
for(int i=1;i<h;i++){
ans=min(ans,max({i*w,(h-i)*yoko,(h-i)*(w-yoko)})-min({i*w,(h-i)*yoko,(h-i)*(w-yoko)}));
}
for(int i=1;i<w;i++){
ans=min(ans,max({i*h,(w-i)*tate,(w-i)*(h-tate)})-min({i*h,(w-i)*tate,(w-i)*(h-tate)}));
}
cout<<ans<<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::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:14:12: required from here
14 | ans=min(ans,max({i*w,((h-i)/2)*w,(h-((h-i)/2)-i)*w}),min({i*w,((h-i)/2)*w,(h-((h-i)/2)-i)*w}));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s666384867 | p03713 | C++ | from strutils import split, parseInt, parseFloat
from sequtils import map
import macros
macro unpack*(input: seq; count: static[int]): untyped =
result = quote do: ()
when NimMinor <= 13: # 本当にここが区切りかどうかは知らない
for i in 0..<count: result[0].add quote do: `input`[`i`]
else:
for i in 0..<count: result.add quote do: `input`[`i`]
# count == 0 のとき unpackしない
# count > 0 のとき count個分 unpack した結果の tuple を返す
type UnselectableTypeError = object of Exception
template input*(typ: typedesc; count: static[Natural] = 0): untyped =
let line = stdin.readLine.split
when count == 0:
when typ is int: line.map(parseInt)
elif typ is float: line.map(parseFloat)
elif typ is string: line
else: raise newException(UnselectableTypeError, "You selected a type other than int, float or string")
else:
when typ is int: line.map(parseInt).unpack(count)
elif typ is float: line.map(parseFloat).unpack(count)
elif typ is string: line.unpack(count)
else: raise newException(UnselectableTypeError, "You selected a type other than int, float or string")
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
let
(H, W) = input(int, 2)
HHalf = H div 2
WHalf = W div 2
if H mod 3 == 0 or W mod 3 == 0:
echo 0
quit()
var result = min(H, W)
for h in 1..<H:
result = min(result, max((h * W - (H - h) * WHalf).abs, (h * W - (H - h) * (W - WHalf)).abs))
for w in 1..<W:
result = min(result, max((H * w - HHalf * (W - w)).abs, (H * w - (H - HHalf) * (W - w)).abs))
echo result
| a.cc:7:24: error: stray '#' in program
7 | when NimMinor <= 13: # 本当にここが区切りかどうかは知らない
| ^
a.cc:8:14: error: too many decimal points in number
8 | for i in 0..<count: result[0].add quote do: `input`[`i`]
| ^~~
a.cc:8:49: error: stray '`' in program
8 | for i in 0..<count: result[0].add quote do: `input`[`i`]
| ^
a.cc:8:55: error: stray '`' in program
8 | for i in 0..<count: result[0].add quote do: `input`[`i`]
| ^
a.cc:8:57: error: stray '`' in program
8 | for i in 0..<count: result[0].add quote do: `input`[`i`]
| ^
a.cc:8:59: error: stray '`' in program
8 | for i in 0..<count: result[0].add quote do: `input`[`i`]
| ^
a.cc:10:14: error: too many decimal points in number
10 | for i in 0..<count: result.add quote do: `input`[`i`]
| ^~~
a.cc:10:46: error: stray '`' in program
10 | for i in 0..<count: result.add quote do: `input`[`i`]
| ^
a.cc:10:52: error: stray '`' in program
10 | for i in 0..<count: result.add quote do: `input`[`i`]
| ^
a.cc:10:54: error: stray '`' in program
10 | for i in 0..<count: result.add quote do: `input`[`i`]
| ^
a.cc:10:56: error: stray '`' in program
10 | for i in 0..<count: result.add quote do: `input`[`i`]
| ^
a.cc:12:3: error: invalid preprocessing directive #count
12 | # count == 0 のとき unpackしない
| ^~~~~
a.cc:13:3: error: invalid preprocessing directive #count
13 | # count > 0 のとき count個分 unpack した結果の tuple を返す
| ^~~~~
a.cc:28:3: error: invalid preprocessing directive ##
28 | # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| ^
a.cc:39:10: error: too many decimal points in number
39 | for h in 1..<H:
| ^~~
a.cc:41:10: error: too many decimal points in number
41 | for w in 1..<W:
| ^~~
a.cc:1:1: error: 'from' does not name a type
1 | from strutils import split, parseInt, parseFloat
| ^~~~
a.cc:5:27: error: 'count' does not name a type
5 | macro unpack*(input: seq; count: static[int]): untyped =
| ^~~~~
a.cc:15:32: error: 'count' does not name a type
15 | template input*(typ: typedesc; count: static[Natural] = 0): untyped =
| ^~~~~
|
s139905432 | p03713 | C++ | #include<algorithm>
#include<math.h>
using namespace std;
typedef long long ll;
//hが奇数でwを動かすとき
int odd(int h, int w, int x,int m) {
if (h*x >= (h + 1)*(w - x) / 2)return min(m, h*x - (h - 1)*(w - x) / 2);
if (h*x >= (h - 1)*(w - x) / 2)return min(m, w - x);
if (h*x < (h - 1)*(w - x) / 2)return min(m, -h*x + (h + 1)*(w - x) / 2);
}
int main(void) {
int h, w, ans = 10000000;
cin >> h >> w;
if (h % 3 == 0 || w % 3 == 0)cout << 0 << endl;
else {
if (h % 2 == 0 && w % 2 == 0) {
for (int i = 1;i < h;i++)ans = min(ans, abs(w*i - w / 2 * (h - i)));
for (int i = 1;i < w;i++)ans = min(ans, abs(h*i - h / 2 * (w - i)));
cout << ans << endl;
}
else {
if (h % 2 == 0) {
for (int i = 1;i < w;i++)ans = min(ans, abs(h*i - h / 2 * (w - i)));
for (int i = 1;i < h;i++)ans = min(ans, odd(w, h, i, ans));
cout << ans << endl;
}
else {
if (w % 2 == 0) {
for (int i = 1;i < h;i++)ans = min(ans, abs(w*i - w / 2 * (h - i)));
for (int i = 1;i < w;i++)ans = min(ans, odd(h, w, i, ans));
cout << ans << endl;
}
else {
for (int i = 1;i < h;i++)ans = min(ans, odd(w, h, i, ans));
for (int i = 1;i < w;i++)ans = min(ans, odd(h, w, i, ans));
cout << ans << endl;
}
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
15 | cin >> h >> w;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<math.h>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:16:38: error: 'cout' was not declared in this scope
16 | if (h % 3 == 0 || w % 3 == 0)cout << 0 << endl;
| ^~~~
a.cc:16:38: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:51: error: 'endl' was not declared in this scope
16 | if (h % 3 == 0 || w % 3 == 0)cout << 0 << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<math.h>
+++ |+#include <ostream>
3 | using namespace std;
a.cc:21:25: error: 'cout' was not declared in this scope
21 | cout << ans << endl;
| ^~~~
a.cc:21:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:40: error: 'endl' was not declared in this scope
21 | cout << ans << endl;
| ^~~~
a.cc:21:40: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:27:33: error: 'cout' was not declared in this scope
27 | cout << ans << endl;
| ^~~~
a.cc:27:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:48: error: 'endl' was not declared in this scope
27 | cout << ans << endl;
| ^~~~
a.cc:27:48: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:33:41: error: 'cout' was not declared in this scope
33 | cout << ans << endl;
| ^~~~
a.cc:33:41: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:56: error: 'endl' was not declared in this scope
33 | cout << ans << endl;
| ^~~~
a.cc:33:56: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:38:41: error: 'cout' was not declared in this scope
38 | cout << ans << endl;
| ^~~~
a.cc:38:41: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:56: error: 'endl' was not declared in this scope
38 | cout << ans << endl;
| ^~~~
a.cc:38:56: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc: In function 'int odd(int, int, int, int)':
a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
11 | }
| ^
|
s037154537 | p03713 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
int main() {
ll h, w;
cin >> h >> w;
ll ans = 1e9;
if (w*h % 3 == 0) {
cout << 0 << endl;
return 0;
}
for (int i = 1;i < h;i++) {
ll s1 = i * w, s2 = w / 2 * (h - i), s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("h=%d %d %d %d\n",i,s1,s2,s3);
ll t1 = i * w, t2 = (h - i) / 2 * w, t3 = h * w - s1 - s2;
ll c = max(t1, max(t2, t3));
ll d = min(t1, min(t2, t3));
if (c - d >= 0)ans = min(ans, c - d);
//printf("h=%d %d %d %d\n",i,s1,s2,s3);
}
for (int i = 1;i < w;i++) {
ll s1 = i * h, s2 = h / 2 * (w - i), s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("w=%d %d %d %d\n",i,s1,s2,s3);
ll t1 = i * h, t2 = (w - i) / 2 * h, t3 = h * w - s1 - s2;
ll a = max(t1, max(t2, t3));
ll b = min(t1, min(t2, t3));
if (c - d >= 0)ans = min(ans, c - d);
//printf("w=%d %d %d %d\n",i,s1,s2,s3);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:33:20: error: redeclaration of 'll a'
33 | ll a = max(t1, max(t2, t3));
| ^
a.cc:28:20: note: 'll a' previously declared here
28 | ll a = max(s1, max(s2, s3));
| ^
a.cc:34:20: error: redeclaration of 'll b'
34 | ll b = min(t1, min(t2, t3));
| ^
a.cc:29:20: note: 'll b' previously declared here
29 | ll b = min(s1, min(s2, s3));
| ^
a.cc:35:21: error: 'c' was not declared in this scope
35 | if (c - d >= 0)ans = min(ans, c - d);
| ^
a.cc:35:25: error: 'd' was not declared in this scope
35 | if (c - d >= 0)ans = min(ans, c - d);
| ^
|
s084472527 | p03713 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
int main() {
ll h, w;
cin >> h >> w;
ll ans = 1e9;
if (w*h % 3 == 0) {
cout << 0 << endl;
return 0;
}
for (int i = 1;i < h;i++) {
ll s1 = i * w, s2 = w / 2 * (h - i), s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("h=%d %d %d %d\n",i,s1,s2,s3);
ll t1 = i * w, t2 = (h - i) / 2 * w, s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("h=%d %d %d %d\n",i,s1,s2,s3);
}
for (int i = 1;i < w;i++) {
ll s1 = i * h, s2 = h / 2 * (w - i), s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("w=%d %d %d %d\n",i,s1,s2,s3);
ll s1 = i * h, s2 = (w - i) / 2 * h, s3 = h * w - s1 - s2;
ll a = max(s1, max(s2, s3));
ll b = min(s1, min(s2, s3));
if (a - b >= 0)ans = min(ans, a - b);
//printf("w=%d %d %d %d\n",i,s1,s2,s3);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:20:54: error: redeclaration of 'll s3'
20 | ll t1 = i * w, t2 = (h - i) / 2 * w, s3 = h * w - s1 - s2;
| ^~
a.cc:15:54: note: 'll s3' previously declared here
15 | ll s1 = i * w, s2 = w / 2 * (h - i), s3 = h * w - s1 - s2;
| ^~
a.cc:21:20: error: redeclaration of 'll a'
21 | ll a = max(s1, max(s2, s3));
| ^
a.cc:16:20: note: 'll a' previously declared here
16 | ll a = max(s1, max(s2, s3));
| ^
a.cc:22:20: error: redeclaration of 'll b'
22 | ll b = min(s1, min(s2, s3));
| ^
a.cc:17:20: note: 'll b' previously declared here
17 | ll b = min(s1, min(s2, s3));
| ^
a.cc:32:20: error: redeclaration of 'll s1'
32 | ll s1 = i * h, s2 = (w - i) / 2 * h, s3 = h * w - s1 - s2;
| ^~
a.cc:27:20: note: 'll s1' previously declared here
27 | ll s1 = i * h, s2 = h / 2 * (w - i), s3 = h * w - s1 - s2;
| ^~
a.cc:32:32: error: redeclaration of 'll s2'
32 | ll s1 = i * h, s2 = (w - i) / 2 * h, s3 = h * w - s1 - s2;
| ^~
a.cc:27:32: note: 'll s2' previously declared here
27 | ll s1 = i * h, s2 = h / 2 * (w - i), s3 = h * w - s1 - s2;
| ^~
a.cc:32:54: error: redeclaration of 'll s3'
32 | ll s1 = i * h, s2 = (w - i) / 2 * h, s3 = h * w - s1 - s2;
| ^~
a.cc:27:54: note: 'll s3' previously declared here
27 | ll s1 = i * h, s2 = h / 2 * (w - i), s3 = h * w - s1 - s2;
| ^~
a.cc:33:20: error: redeclaration of 'll a'
33 | ll a = max(s1, max(s2, s3));
| ^
a.cc:28:20: note: 'll a' previously declared here
28 | ll a = max(s1, max(s2, s3));
| ^
a.cc:34:20: error: redeclaration of 'll b'
34 | ll b = min(s1, min(s2, s3));
| ^
a.cc:29:20: note: 'll b' previously declared here
29 | ll b = min(s1, min(s2, s3));
| ^
|
s897652426 | p03713 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
int h,w;
int cand1=1e9,cand2=1e9;
cin>> h >> w;
for (int i=1; i<h; i++){
long long a[3];
long long b[3];
a[0]=i*w;
b[0]=i*w;
a[1]=(h-i)*(w/2);
b[1]=((h-i)/2)*w;
a[2]=h*w-a[0]-a[1];
b[2]=h*w-b[0]-b[1];
sort(a,a+3);
sort(b,b+3);
cand1=min(cand1,a[2]-a[0]);
cand2=min(cand2,b[2]-b[0]);
}
for (int i=1; i<w; i++){
long long a[3];
long long b[3];
a[0]=i*h;
b[0]=i*h;
a[1]=(w-i)*(h/2);
b[1]=((w-i)/2)*h;
a[2]=h*w-a[0]-a[1];
b[2]=h*w-b[0]-b[1];
sort(a,a+3);
sort(b,b+3);
cand1=min(cand1,a[2]-a[0]);
cand2=min(cand2,b[2]-b[0]);
}
cout << min(cand1,cand2) <<endl;
} | a.cc: In function 'int main()':
a.cc:19:18: error: no matching function for call to 'min(int&, long long int)'
19 | cand1=min(cand1,a[2]-a[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:19:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
19 | cand1=min(cand1,a[2]-a[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:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:19:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | cand1=min(cand1,a[2]-a[0]);
| ~~~^~~~~~~~~~~~~~~~~
a.cc:20:18: error: no matching function for call to 'min(int&, long long int)'
20 | cand2=min(cand2,b[2]-b[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:20:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
20 | cand2=min(cand2,b[2]-b[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:20:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
20 | cand2=min(cand2,b[2]-b[0]);
| ~~~^~~~~~~~~~~~~~~~~
a.cc:33:18: error: no matching function for call to 'min(int&, long long int)'
33 | cand1=min(cand1,a[2]-a[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:33:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
33 | cand1=min(cand1,a[2]-a[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:33:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
33 | cand1=min(cand1,a[2]-a[0]);
| ~~~^~~~~~~~~~~~~~~~~
a.cc:34:18: error: no matching function for call to 'min(int&, long long int)'
34 | cand2=min(cand2,b[2]-b[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:34:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
34 | cand2=min(cand2,b[2]-b[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:34:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
34 | cand2=min(cand2,b[2]-b[0]);
| ~~~^~~~~~~~~~~~~~~~~
|
s900361895 | p03713 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
int dp[150][150];
int num[150];
bool cmp(int a,int b)
{
return a<b;
}
int gcd(int a,int b)
{
if(b==0)
{
return a;
}
else
return gcd(b,a%b);
}
int main()
{
int h,w;
cin>>h>>w;
if(h%3==0||w%3==0)
cout << 0 << endl;
else
{
int ans=max(n,m);
for(int i=1;i<w-1;i++)
{
int smax=(w-i)*h;
int smin1=i*(h/2);
int smin2=i*(h-h/2);
int a[3]={smax,smin1,smin2};
sort(a,a+3);
ans=min(ans,a[2]-a[0]);
}
swap(h,w);
for(int i=1;i<w-1;i++)
{
int smax=(w-i)*h;
int smin1=i*(h/2);
int smin2=i*(h-h/2);
int a[3]={smax,smin1,smin2};
sort(a,a+3);
ans=min(ans,a[2]-a[0]);
}
cout << ans << endl;
return 0;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:29:21: error: 'n' was not declared in this scope
29 | int ans=max(n,m);
| ^
a.cc:29:23: error: 'm' was not declared in this scope
29 | int ans=max(n,m);
| ^
|
s138012501 | p03713 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;
int INF = 1e9 + 7;
typedef long long ll;
typedef pair<int, int> P;
int ans = INF;
int choco(int H, int W) {
int h, w, sa, sb, sc, MAX, MIN;
for (int i = 1; i < H; i++) {
h = (H - i) / 2;
sa = i * W, sb = h * W, sc = (H - h) * W;
MAX = max(sa, sb, sc), MIN = min(sa, sb, sc);
ans = min(ans, MAX - MIN);
}
for (int i = 1; i < H; i++) {
w = W / 2;
sa = i * W, sb = (H - i)*w, sc = (H - i)* (W - w);
MAX = max(sa, sb, sc), MIN = min(sa, sb, sc);
ans = min(ans, MAX - MIN);
}
return ans;
}
int main() {
int H, W;
cin >> H >> W;
cout << min(choco(H, W), choco(W, H)) << endl;
} | In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:25:12: required from here
25 | MAX = max(sa, sb, sc), MIN = min(sa, sb, sc);
| ~~~^~~~~~~~~~~~
/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:25:35: required from here
25 | MAX = max(sa, sb, sc), MIN = min(sa, sb, sc);
| ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s811750316 | p03713 | C++ | #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
LL int find(LL int x, LL int y)
{
LLint ans = INT_MAX;
rep(i, x)
{
vector<long long int > a(3);
a[0] = i * y;
LL int div = y / 2;
a[1] = (x - i) * div;
a[2] = (x - i) * (y - div);
SORT(a);
if (DEBUG)
cout << a[0] << " " << a[1] << " " << a[2] << endl;
ans = min(ans, a[2] - a[0]);
div = (x - i) / 2;
a[0] = i * y;
a[1] = y * div;
a[2] = y * (x - i - div);
SORT(a);
if (DEBUG)
cout << a[0] << " " << a[1] << " " << a[2] << endl;
ans = min(ans, a[2] - a[0]);
}
return ans;
}
int main()
{
LL int h, w;
cin >> h >> w;
cout << min(find(h, w), find(w, h)) << endl;
return 0;
} | a.cc: In function 'long long int find(long long int, long long int)':
a.cc:17:5: error: 'LLint' was not declared in this scope
17 | LLint ans = INT_MAX;
| ^~~~~
a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
28 | ans = min(ans, a[2] - a[0]);
| ^~~
| abs
a.cc:38:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | return ans;
| ^~~
| abs
|
s937951287 | p03713 | C++ | #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int find(int x, int y)
{
int ans = INT_MAX;
rep(i, x)
{
vector<long long int > a(3);
a[0] = i * y;
int div = y / 2;
a[1] = (x - i) * div;
a[2] = (x - i) * (y - div);
SORT(a);
if (DEBUG)
cout << a[0] << " " << a[1] << " " << a[2] << endl;
ans = min(ans, a[2] - a[0]);
div = (x - i) / 2;
a[0] = i * y;
a[1] = y * div;
a[2] = y * (x - i - div);
SORT(a);
if (DEBUG)
cout << a[0] << " " << a[1] << " " << a[2] << endl;
ans = min(ans, a[2] - a[0]);
}
return ans;
}
int main()
{
int h, w;
cin >> h >> w;
cout << min(find(h, w), find(w, h)) << endl;
return 0;
} | a.cc: In function 'int find(int, int)':
a.cc:28:18: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
28 | ans = min(ans, a[2] - a[0]);
| ~~~^~~~~~~~~~~~~~~~~~
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:28:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
28 | ans = min(ans, a[2] - a[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:
/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:28:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
28 | ans = min(ans, a[2] - a[0]);
| ~~~^~~~~~~~~~~~~~~~~~
a.cc:36:18: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
36 | ans = min(ans, a[2] - a[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:36:18: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
36 | ans = min(ans, a[2] - a[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:36:18: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
36 | ans = min(ans, a[2] - a[0]);
| ~~~^~~~~~~~~~~~~~~~~~
|
s496476734 | p03713 | C++ | #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int find(int x, int y)
{
int ans = INT_MAX;
rep(i, x)
{
int a = i * y;
int div = y / 2;
int b = (x - i) * div;
int c = (x - i) * (y - div);
ans = min(ans, max(a, max(b, c) - min(a, min(b, c))));
}
return ans;
}
int main()
{
if (int h, w;
cin >> h >> w;
cout << min(find(h, w), find(w, h));
return 0;)
{
/* code */
} | a.cc: In function 'int main()':
a.cc:32:22: error: expected ')' before ';' token
32 | cin >> h >> w;
| ^
| )
a.cc:31:8: note: to match this '('
31 | if (int h, w;
| ^
a.cc:33:26: error: 'h' was not declared in this scope
33 | cout << min(find(h, w), find(w, h));
| ^
a.cc:33:29: error: 'w' was not declared in this scope
33 | cout << min(find(h, w), find(w, h));
| ^
a.cc:34:18: error: expected primary-expression before ')' token
34 | return 0;)
| ^
a.cc:37:6: error: expected '}' at end of input
37 | }
| ^
a.cc:30:1: note: to match this '{'
30 | {
| ^
|
s679646679 | p03713 | C++ | #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;
int find(int x,int y){
int ans=INT_MAX;
rep(i,x){
int a=i*y;
int div=y/2;
int b=(x-i)*div;
int c=(x-i)*(y-div);
ans=min(ans,min(a,min(b,c)));
}
return min;
}
int main()
{
int h,w;
cin>>h>>w;
cout<<min(find(h,w),find(w,h));
return 0;
} | a.cc: In function 'int find(int, int)':
a.cc:24:12: error: cannot resolve overloaded function 'min' based on conversion to type 'int'
24 | return min;
| ^~~
|
s032749614 | p03713 | C++ | #! /usr/bin/env python3
def main():
H, W = map(int, input().split())
# if (H > 2 and H % 3 == 0) or (W > 2 and W % 3 == 0):
# print(0)
# else:
ans = H * W
left = 0
up = 1
while 1:
a = W * up
b = (H - up) * (left)
c = (H - up) * (W - left)
ans = min(ans, max(a, b, c) - min(a, b, c))
if a == min(a, b, c):
up += 1
elif b == min(a, b, c):
left += 1
else:
break
if H > 2:
i = 1
j = 2
while 1:
a = W * i
b = W * j - a
c = H * W - b - a
ans = min(ans, max(a, b, c) - min(a, b, c))
if a == min(a, b, c):
i += 1
j += 1
elif b == min(a, b, c):
j += 1
else:
break
H, W = W, H
left = 0
up = 1
while 1:
a = W * up
b = (H - up) * (left)
c = (H - up) * (W - left)
ans = min(ans, max(a, b, c) - min(a, b, c))
if a == min(a, b, c):
up += 1
elif b == min(a, b, c):
left += 1
else:
break
if H > 2:
i = 1
j = 2
while 1:
a = W * i
b = W * j - a
c = H * W - b - a
ans = min(ans, max(a, b, c) - min(a, b, c))
if a == min(a, b, c):
i += 1
j += 1
elif b == min(a, b, c):
j += 1
else:
break
print(ans)
main()
| a.cc:1:2: error: invalid preprocessing directive #!
1 | #! /usr/bin/env python3
| ^
a.cc:5:58: error: ':' without preceding '?'
5 | # if (H > 2 and H % 3 == 0) or (W > 2 and W % 3 == 0):
| ^
a.cc:7:11: warning: extra tokens at end of #else directive [-Wendif-labels]
7 | # else:
| ^
a.cc:5: error: unterminated #else
5 | # if (H > 2 and H % 3 == 0) or (W > 2 and W % 3 == 0):
a.cc:3:1: error: 'def' does not name a type
3 | def main():
| ^~~
|
s037695056 | p03713 | C++ | #include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
int h, w;
cin >> h >> w;
int ans = INF;
if (h % 3 == 0 || w % 3 == 0) {
cout << 0 << endl;
return 0;
}
for (int i = 1; i < h; i++) {
int H = h - i, W = w;
int S1 = (h - H) * W, S2 = H * (W / 2);
int S3 = H * W - S2;
int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
ans = min(ans, Max - Min);
S2 = (H / 2) * W;
S3 = H * W - S2;
int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
ans = min(ans, Max - Min);
}
for (int i = 1; i < w; i++) {
int H = h, W = w - i;
int S1 = H * (w - W), S2 = (H / 2) * W;
int S3 = H * W - S2;
int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
ans = min(ans, Max - Min);
S2 = H * (W / 2);
S3 = H * W - S2;
int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
ans = min(ans, Max - Min);
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:21: error: redeclaration of 'long long int Max'
23 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:19:21: note: 'long long int Max' previously declared here
19 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:23:46: error: redeclaration of 'long long int Min'
23 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:19:46: note: 'long long int Min' previously declared here
19 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:34:21: error: redeclaration of 'long long int Max'
34 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:30:21: note: 'long long int Max' previously declared here
30 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:34:46: error: redeclaration of 'long long int Min'
34 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
a.cc:30:46: note: 'long long int Min' previously declared here
30 | int Max = max({S1, S2, S3}), Min = min({S1, S2, S3});
| ^~~
|
s160401568 | p03713 | C++ |
#include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara=1e6;
const ll LINF = 1e18;
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1;
}
if(n>1){
prime_cnt[n]+=1;
break;
}
}ある数nを素因数分解しましょう
---------------------------------------------------------------
debug:
cout<<"i: "<<i<<" j: "<<j<<" cnt: "<<cnt<<"\n";
---------------------------------------------------------------*/
long long int n,cnt=0,ans=0,a,b,c,d,cmp[10],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>h>>w;
if(h%3==0||w%3==0){
Cout(0);
}
else{
ans=min(h,w);
ll cntt,cnttt,ppos;
rrep(i,1,w+1){
cnt=h*i;
cntt=(w-i)*(h/2);
cnttt=(w-i)*(h-(h/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
rrep(i,1,h+1){
cnt=w*i;
cntt=(h-i)*(w/2);
cnttt=(h-i)*(w-(w/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
Cout(ans);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:141:11: error: cannot resolve overloaded function 'max' based on conversion to type 'long long int'
141 | pos=max{cnt,cntt,cnttt};
| ^~~
a.cc:142:12: error: cannot resolve overloaded function 'min' based on conversion to type 'll' {aka 'long long int'}
142 | ppos=min{cnt,cntt,cnttt};
| ^~~
a.cc:149:11: error: cannot resolve overloaded function 'max' based on conversion to type 'long long int'
149 | pos=max{cnt,cntt,cnttt};
| ^~~
a.cc:150:12: error: cannot resolve overloaded function 'min' based on conversion to type 'll' {aka 'long long int'}
150 | ppos=min{cnt,cntt,cnttt};
| ^~~
|
s509909417 | p03713 | C++ |
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1
/*
#include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara=1e6;
const ll LINF = 1e18;
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1;
}
if(n>1){
prime_cnt[n]+=1;
break;
}
}ある数nを素因数分解しましょう
---------------------------------------------------------------
debug:
cout<<"i: "<<i<<" j: "<<j<<" cnt: "<<cnt<<"\n";
---------------------------------------------------------------*/
long long int n,cnt=0,ans=0,a,b,c,d,cmp[10],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>h>>w;
if(h%3==0||w%3==0){
Cout(0);
}
else{
ans=min(h,w);
ll cntt,cnttt,ppos;
rrep(i,1,w+1){
cnt=h*i;
cntt=(w-i)*(h/2);
cnttt=(w-i)*(h-(h/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
rrep(i,1,h+1){
cnt=w*i;
cntt=(h-i)*(w/2);
cnttt=(h-i)*(w-(w/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
Cout(ans);
}
return 0;
}
| a.cc:197:1: error: 'string' does not name a type
197 | string alph("abcdefghijklmnopqrstuvwxyz"),s;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:204:8: error: 'cin' was not declared in this scope
204 | cin.tie(0);
| ^~~
a.cc:205:5: error: 'ios' has not been declared
205 | ios::sync_with_stdio(false);
| ^~~
a.cc:210:3: error: 'Cout' was not declared in this scope
210 | Cout(0);
| ^~~~
a.cc:213:7: error: 'min' was not declared in this scope; did you mean 'main'?
213 | ans=min(h,w);
| ^~~
| main
a.cc:214:5: error: 'll' was not declared in this scope; did you mean 'fl'?
214 | ll cntt,cnttt,ppos;
| ^~
| fl
a.cc:215:10: error: 'i' was not declared in this scope
215 | rrep(i,1,w+1){
| ^
a.cc:215:5: error: 'rrep' was not declared in this scope
215 | rrep(i,1,w+1){
| ^~~~
a.cc:231:5: error: 'Cout' was not declared in this scope
231 | Cout(ans);
| ^~~~
|
s375435550 | p03713 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara=1e6;
const ll LINF = 1e18;
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1;
}
if(n>1){
prime_cnt[n]+=1;
break;
}
}ある数nを素因数分解しましょう
---------------------------------------------------------------
debug:
cout<<"i: "<<i<<" j: "<<j<<" cnt: "<<cnt<<"\n";
---------------------------------------------------------------*/
long long int n,cnt=0,ans=0,a,b,c,d,cmp[10],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>h>>w;
if(h%3==0||w%3==0){
Cout(0);
}
else{
ans=min(h,w);
ll cntt,cnttt,ppos;
rrep(i,1,w+1){
cnt=h*i;
cntt=(w-i)*(h/2);
cnttt=(w-i)*(h-(h/2));
pos=max{cnt,cntt,cnttt};
ppos=min(cnt,cntt,cnttt);
ans=min(ans,Abs(pos,ppos));
}
#include <bits/stdc++.h>
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()
typedef long long ll;
using namespace std;
const int INF = 1e9,MOD = 1e9 + 7,ohara=1e6;
const ll LINF = 1e18;
/*---------------------------------------------------------------
long long int kaizyo(long long int hh){
cmp=1;
while(hh>1){
cmp=(cmp*hh)%MOD;
hh--;
}
return cmp;
}
long long int ruizyo(long long int aa, long long int bb){
if(aa==0){
return 1;
}
else if(aa%2==0){
long long int tt=ruizyo(aa/2,bb);
return (tt*tt)%MOD;
}
else{
return (ruizyo(aa-1,bb)*bb)%MOD;
}
}フェルマ-のア
---------------------------------------------------------------
while(x!=0){
sum+=x%10;
/ x/=10;
}
各桁の和
---------------------------------------------------------------
pair<int,int> p[100000];
cin >> tmp;
p[i]=make_pair(tmp,i);
cout << p[i].second+1 << endl;//ペアの右側つまりiを出力
---------------------------------------------------------------
bool f[100001];//1000000以下の素数を調べよう!
rrep(i,2,100001){
f[i]=false;
}
rrep(i,2,100001){
if(!f[i]){
for(int j=i+i;j<=100000;j+=i){
f[j]=true;
}
}
}
for(int i=3;i<=100000;i+=2){
if(!f[i]){
c[i]++;
}
}
---------------------------------------------------------------
long long gcd(long long aaa,long long bbb){
if(bbb==0){
return aaa;
}
return gcd(bbb,aaa%bbb);
}
long long lcm(long long aaa,long long bbb){
long long g = gcd(aaa,bbb);
return aaa/g * bbb;
}左から最大公約数と最小公倍数
---------------------------------------------------------------
long long int prime_cnt[10000];
for(int i=2;i*i<=n;i++){
while(n%i==0){
n/=i;
prime_cnt[i]+=1;
}
if(n>1){
prime_cnt[n]+=1;
break;
}
}ある数nを素因数分解しましょう
---------------------------------------------------------------
debug:
cout<<"i: "<<i<<" j: "<<j<<" cnt: "<<cnt<<"\n";
---------------------------------------------------------------*/
long long int n,cnt=0,ans=0,a,b,c,d,cmp[10],cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>h>>w;
if(h%3==0||w%3==0){
Cout(0);
}
else{
ans=min(h,w);
ll cntt,cnttt,ppos;
rrep(i,1,w+1){
cnt=h*i;
cntt=(w-i)*(h/2);
cnttt=(w-i)*(h-(h/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
rrep(i,1,h+1){
cnt=w*i;
cntt=(h-i)*(w/2);
cnttt=(h-i)*(w-(w/2));
pos=max{cnt,cntt,cnttt};
ppos=min{cnt,cntt,cnttt};
ans=min(ans,Abs(pos,ppos));
}
Cout(ans);
}
return 0;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:139:17: error: cannot resolve overloaded function 'max' based on conversion to type 'long long int'
139 | pos=max{cnt,cntt,cnttt};
| ^~~
a.cc:265:15: error: a function-definition is not allowed here before '{' token
265 | int main(void){
| ^
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::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:140:21: required from here
140 | ppos=min(cnt,cntt,cnttt);
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s448436495 | p03713 | C++ | #include <iostream>
#include <utility>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {
int h, w, ans = 2147483647;
cin >> h >> w;
if(w >= 3) ans = min(ans, (w % 3 ? 1 : 0) * h); // ||
if(h >= 3) ans = min(ans, (h % 3 ? 1 : 0) * w); // =
long long half = floor(w / 2), a, b, c; // T
for(int H = 1; H < h; H++){ // H is the height for the upper part
a = H * w;
b = (h - H) * half;
c = (h - H) * (w - half);
ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
}
half = floor(w / 2); // |-
for(int W = 1; W < w; W++){ // W is the width for the left part
a = W * h;
b = (w - W) * half;
c = (w - W) * (h - half);
ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:26: error: no matching function for call to 'min(int&, long long int)'
20 | ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:20:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
20 | ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
a.cc:28:26: error: no matching function for call to 'min(int&, long long int)'
28 | ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:28:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
28 | ans = min(ans, max(a, max(b, c)) - min(a, min(b, c)));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
|
s380600556 | p03713 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
using ll = long long;
using namespace std;
#define modmod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
int main(){
int H,W;
cin >> H >> W;
ll result;
if(H % 3 == 0){
cout << 0 << endl;
return 0;
}else{
result = W;
}
if(W % 3 == 0){
cout << 0 << endl;
return 0;
}else{
result = min(result,H);
}
REP(x,1,W){
long long a = H*x;
long long y = H/2;
long long b = (W-x) * y;
long long c = (W-x) * (H-y);
result = min(max({a,b,c})-min({a,b,c}),result);
}
REP(y,1,H){
long long a = W*y;
long long x = W/2;
long long b = (H-y) * x;
long long c = (H-y) * (W-x);
result = min(max({a,b,c})-min({a,b,c}),result);
}
cout << result << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:21: error: no matching function for call to 'min(ll&, int&)'
37 | result = min(result,H);
| ~~~^~~~~~~~~~
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:37:21: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
37 | result = min(result,H);
| ~~~^~~~~~~~~~
/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:37:21: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
37 | result = min(result,H);
| ~~~^~~~~~~~~~
|
s187390302 | p03713 | C++ | #include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
// ifstream in("input.txt");
// cin.rdbuf(in.rdbuf());
ll h,w;cin>>h>>w;
ll ans=0;
if(h%3!=0 && w%3!=0){
if(w<h){
for(ll i=1;i<w;i++){
ll s0=h*(w-i);
ll s1=(h/2)*i;
ll s2=((h+1)/2)*i;
ll mx=max(s0, max(s1, s2));
ll mn=min(s0, min(s1, s2));
ans=min(ans, mx-mn);
}
}
P(ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:17:11: note: to match this '{'
17 | int main(){
| ^
|
s142304778 | p03713 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
typedef long long int lli;
const int MAX=1e5;
lli f(lli a,lli b,lli c){
if(a>b){
lli z=a;
a=b;
b=z;
}
if(c<a)return b-c;
else if(c<b)return b-a;
else return c-a;
}
int main(){
cout<<x<<endl;
lli H,W;
cin>>H>>W;
if(H>W){
lli Z=H;
H=W;
W=Z;
}
lli ans=H;
if(H%3==0||W%3==0)ans=0;
if(W%3==1){
lli n=W/3;
if(H%2==0)ans=H/2;
else ans=min(ans,f(H*n,(H/2)*(2*n+1),(H/2+1)*(2*n+1)));
}
if(W%3==2){
lli n=W/3;
if(H%2==0)ans=H/2;
else ans=min(ans,f(H*(n+1),(H/2)*(2*n+1),(H/2+1)*(2*n+1)));
}
if(H%3==1){
lli n=H/3;
if(W%2==0)ans=min(ans,W/2);
else ans=min(ans,f(W*n,(W/2)*(2*n+1),(W/2+1)*(2*n+1)));
}
if(H%3==2){
lli n=H/3;
if(W%2==0)ans=min(ans,W/2);
else ans=min(ans,f(W*(n+1),(W/2)*(2*n+1),(W/2+1)*(2*n+1)));
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:27:9: error: 'x' was not declared in this scope
27 | cout<<x<<endl;
| ^
|
s614028658 | p03713 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
typedef long long int lli;
const int MAX=1e5;
lli f(lli a,lli b,lli c){
if(a>b){
lli z=a;
a=b;
b=z;
}
if(c<a)return b-c;
else if(c<b)return b-a;
else return c-a;
}
int main(){
cout<<x<<endl;
lli H,W;
cin>>H>>W;
if(H>W){
int Z=H;
H=W;
W=Z;
}
lli ans=H;
if(H%3==0||W%3==0)ans=0;
if(W%3==1){
lli n=W/3;
if(H%2==0)ans=H/2;
else ans=min(ans,f(H*n,(H/2)*(2*n+1),(H/2+1)*(2*n+1)));
}
if(W%3==2){
lli n=W/3;
if(H%2==0)ans=H/2;
else ans=min(ans,f(H*(n+1),(H/2)*(2*n+1),(H/2+1)*(2*n+1)));
}
if(H%3==1){
lli n=H/3;
if(W%2==0)ans=min(ans,W/2);
else ans=min(ans,f(W*n,(W/2)*(2*n+1),(W/2+1)*(2*n+1)));
}
if(H%3==2){
lli n=H/3;
if(W%2==0)ans=min(ans,W/2);
else ans=min(ans,f(W*(n+1),(W/2)*(2*n+1),(W/2+1)*(2*n+1)));
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:27:9: error: 'x' was not declared in this scope
27 | cout<<x<<endl;
| ^
|
s139094174 | p03713 | C++ | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define cost first
#define from second.first
#define to second.second
#define MOD (1000000007ll)
#define l_ength size
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
int main(void){
ll h,hd,w,wd,i,a,b,c;
cin >> h >> w;
if(!(h%3) && !(w%3)){
cout << 0 << endl;
return 0;
}
ans = min(h,w);
for(i=1ll; i<h; ++i){
a = w * i;
hd = h - i;
b = hd * (w/2);
c = hd * (w - (w/2));
ans = min(ans,max(a,c)-min(a,b));
}
for(i=1ll; i<w; ++i){
a = h * i;
wd = w - i;
b = wd * (h/2);
c = wd * (h - (h/2));
ans = min(ans,max(a,c)-min(a,b));
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
26 | ans = min(h,w);
| ^~~
| abs
|
s881124618 | p03713 | C++ | #include <iostream>
#include <climits>
#include <string>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int ascSort(const void* v1, const void* v2) {
const int _v1 = *((const int*)v1);
const int _v2 = *((const int*)v2);
if ( _v1 < _v2 ) {
return 1;
} else if ( _v1 > _v2 ) {
return -1;
} else {
return 0;
}
}
int main() {
int h,w;
cin >> h>> w;
if(h%3==0 || w%3==0){
cout << 0 <<endl;
}else{
int ans=0;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:2: error: expected '}' at end of input
30 | }
| ^
a.cc:21:12: note: to match this '{'
21 | int main() {
| ^
|
s579834753 | p03713 | Java | import java.util.Scanner;
/**
* https://abc062.contest.atcoder.jp/tasks/arc074_a
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long H = sc.nextLong();
long W = sc.nextLong();
sc.close();
long ans = Math.min((H%3==0 ? 0:1)*W,(W%3==0 ? 0:1)*H);
ans = Math.min(ans, getAreaDiff(W,H));
ans = Math.min(ans, getAreaDiff(H,W));
System.out.println(ans);
}
static long getAreaDiff(long w, long h){
long diff = h*w;
for(int i=1; i<h; i++){
long h1 = i;
long h2 = h-i;
long a1 = h1*w;
long a2 = h2*(w/2);
long a3 = h2*(w-w/2);
long area = Math.max(Math.max(a1,a2),a3) - Math.min(Math.min(a1,a2),a3);
diff = Math.min(diff, area);
}
return diff;
}
| Main.java:35: error: reached end of file while parsing
}
^
1 error
|
s771715357 | p03713 | C++ | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
int main(){
int h,w,min=mod;
cin>>h>>w;
if(h%3==0||w%3==0)cout<<0<<endl;
else{
if(h<w)swap(h,w);
int th=h,tw=w;
long a1=h/3;
if(h%3==2)a1++;
h-=a1;
a1*=w;
FOR(i,0,2){
if(i==1){
h=tw;
w=th;
a1=h/3;
if(h%3==2)a1++;
h-=a1;
a1*=w;
}
long a2,a3;
if(w%2==0||h%2==0){
a2=(long)h*w/2;
a3=a2;
//cout<<h<<w<<a1<<endl;
}else{
if(h<w)swap(h,w);
//cout<<h<<w<<a1<<endl;
a2=h/2;
h-=a2;
a2*=w;
a3=(long)h*w;
}
if(a1<a2)swap(a1,a2);
if(a2<a3)swap(a2,a3);
if(a1<a2)swap(a1,a2);
if(min>a1-a3)min=a1-a3;
}
//cout<<a1<<a2<<a3<<endl;
cout<<min<<endl;
}
return 0;
}
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset> //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip> //do setprecision
#include <ctime>
#include <complex>
using namespace std;
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
int main(){
int h,w,min=mod;
cin>>h>>w;
if(h%3==0||w%3==0)cout<<0<<endl;
else{
if(h<w)swap(h,w);
long a1=h/3-2;
long aa=a1,ah=h,aw=w;
FOR(i,0,5){
w=aw;
h=ah;
a1=aa+i;
h-=a1;
a1*=w;
long a2,a3;
if(w%2==0||h%2==0){
a2=(long)h*w/2;
a3=a2;
//cout<<h<<w<<a1<<endl;
}else{
if(h<w)swap(h,w);
//cout<<h<<w<<a1<<endl;
a2=h/2;
h-=a2;
a2*=w;
a3=(long)h*w;
}
if(a1<a2)swap(a1,a2);
if(a2<a3)swap(a2,a3);
if(a1<a2)swap(a1,a2);
if(min>a1-a3)min=a1-a3;
}
//cout<<a1<<a2<<a3<<endl;
cout<<min<<endl;
}
return 0;
}
| a.cc:5:19: warning: extra tokens at end of #include directive
5 | #include <sstream>#include <cstdio>
| ^
a.cc:116:14: error: redefinition of 'const double pi'
116 | const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
| ^~
a.cc:39:14: note: 'const double pi' previously defined here
39 | const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
| ^~
a.cc:117:11: error: redefinition of 'const int mod'
117 | const int mod=1000000007;
| ^~~
a.cc:40:11: note: 'const int mod' previously defined here
40 | const int mod=1000000007;
| ^~~
a.cc:119:5: error: redefinition of 'int main()'
119 | int main(){
| ^~~~
a.cc:42:5: note: 'int main()' previously defined here
42 | int main(){
| ^~~~
|
s239997101 | p03713 | C++ | #include <iostream>
using namespace std;
int main(void) {
int h, w;
cin >> h >> w;
if (h % 3 == 0 || w % 3 == 0) {
cout << 0 << endl;
return 0;
}
//yoko*3
int mi = w;
//yoko*2=>tate*2
int area[3];
int h1 = h / 3;
int w1 = w / 2;
area[0] = w * h1;
area[1] = w1 * (h - h1);
area[2] = (w - w1) * (h - h1);
sort(area, area + 3);
if (area[2] - area[0] < mi) {
mi = area[2] - area[0];
}
h1 = h / 3 + 1;
area[0] = w * h1;
area[1] = w1 * (h - h1);
area[2] = (w - w1) * (h - h1);
sort(area, area + 3);
if (area[2] - area[0] < mi) {
mi = area[2] - area[0];
}
//tate*3
if (mi > h) {
mi = h;
}
//tate*2=>yoko*2
h1 = h / 2;
w1 = w / 3;
area[0] = w1 * h;
area[1] = (w - w1) * h1;
area[2] = (w - w1) * (h - h1);
sort(area, area + 3);
if (area[2] - area[0] < mi) {
mi = area[2] - area[0];
}
w1 = w / 3 + 1;
area[0] = w1 * h;
area[1] = (w - w1) * h1;
area[2] = (w - w1) * (h - h1);
sort(area, area + 3);
if (area[2] - area[0] < mi) {
mi = area[2] - area[0];
}
cout << mi << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:3: error: 'sort' was not declared in this scope; did you mean 'short'?
19 | sort(area, area + 3);
| ^~~~
| short
|
s805188745 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
ll H, W;
cin >> H >> W;
ll ans = H*W;
for(ll i=1;i<=H;i++){
ll a = i*W;
ll b = (H-i)/2*W;
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=W;i++){
ll a = i*H;
ll b = (W-i)/2*H;
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=H;i++){
ll a = W*i;1
ll b = W/2*(H-i);
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=W;i++){
ll a = i*H;
ll b = H/2*(W-i);
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:21:21: error: expected ';' before 'll'
21 | ll a = W*i;1
| ^
| ;
22 | ll b = W/2*(H-i);
| ~~
a.cc:23:35: error: 'b' was not declared in this scope
23 | ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
| ^
|
s918693789 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll main(void){
ll H, W;
cin >> H >> W;
ll ans = H*W;
for(ll i=1;i<=H;i++){
ll a = i*W;
ll b = (H-i)/2*W;
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=W;i++){
ll a = i*H;
ll b = (W-i)/2*H;
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=H;i++){
ll a = W*i;1
ll b = W/2*(H-i);
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
for(ll i=1;i<=W;i++){
ll a = i*H;
ll b = H/2*(W-i);
ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
}
cout << ans << endl;
return 0;
} | a.cc:6:1: error: '::main' must return 'int'
6 | ll main(void){
| ^~
a.cc: In function 'int main()':
a.cc:21:21: error: expected ';' before 'll'
21 | ll a = W*i;1
| ^
| ;
22 | ll b = W/2*(H-i);
| ~~
a.cc:23:35: error: 'b' was not declared in this scope
23 | ans = min(ans, max(a, max(b, H*W-a-b))-min(a, min(b, H*W-a-b)));
| ^
|
s949490975 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,max,min,ans;
cin >> H >> W;
if(N*W%3==0)ans=0;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'N' was not declared in this scope
8 | if(N*W%3==0)ans=0;
| ^
|
s355079348 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int H,W,max,min,ans;
cin >> N >> W;
if(N*W%3==0)ans=0;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'N' was not declared in this scope
6 | cin >> N >> W;
| ^
|
s437320402 | p03713 | C | #include <stdio.h>
long judge(long, long);
int main(void){
long W, H;
scanf("%ld %ld", &H, &W);
if(W%3==0 || H%3==0){
printf("0");
return 0;
}
printf("%d", judge(H,W)>judge(W,H)?judge(W,H):judge(H,W));
return 0;
}
long judge(long H, long W){
int used, i;
long S, target, Max, Mid, Min, tmp;
S = H*W;
target = S/3;
for(i=1; Max < target; i++){
Max += H;
}
if((Max-target)>(H/2) &&(Max-H)>0){
Max -=H;
i--;
}
used = i-1;
target = (S-Max)/2;
for(i=1; Mid < target; i++){
Mid += (W-used);
}
if((Mid-target)>((W-used)/2)&&(Mid-(W-used))>0){
Mid -= (W-used);
}
Min = S -(Max+Mid);
if(Mid >Max){
tmp = Mid;
Mid = Max;
Max= tmp;
}
if(Min > Mid){
tmp = Min;
Min = Mid;
Mid = tmp;
}
if(Mid >Max){
tmp = Mid;
Mid = Max;
Max= tmp;
}
printf("%ld %ld %ld\n", Max, Mid, Min);
return Max-Min
}
| main.c: In function 'judge':
main.c:66:15: error: expected ';' before '}' token
66 | return Max-Min
| ^
| ;
67 |
68 | }
| ~
|
s092215653 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main(void)
{
int H, W;
cin >> H >> W;
if( W > H ){
W += H;
H = W - H;
W -= H;
}
int a, b, c;
int H_mod_3 = H % 3;
int W_mod_3 = W % 3;
int max = 0;
int min = 10000000000000;
int ans = 10000000000000;
if( H_mod_3 == 0 || W_mod_3 == 0){
cout << 0;
return 0;
}
for( int i = W/2-3; i <= W/2+3; i++){
for( int j = H/3-3; j <= H/3+3; j++){
if( H-j < 1 || W-i < 1 || j < 1 || i < 1)continue;
max = 0;
min = 10000000000000;
if( min > i * W) min = j * W;
if( max < i * W) max = j * W;
if( min > (H-j) * i) min = (H-j) * i;
if( max < (H-j) * i) max = (H-j) * i;
if( min > (H-j) * (W-i)) min = (H-j) * (W-i);
if( max < (H-j) * (W-i)) max = (H-j) * (W-i);
if( ans > max-min) ans = max-min;
//printf("a:%lld*%lld=%lld, b:%lld*%lld=%lld, c:%lld*%lld=%lld\n", j, W, j * W, H-j, i, (H-j) * i, H-j, W-i,(H-j) * (W-i));
//printf("max:%lld,min:%lld, %lld\n", max, min, ans);
}
}
cout << min(ans,W);
return 0;
} | a.cc: In function 'int main()':
a.cc:40:16: error: 'min' cannot be used as a function
40 | cout << min(ans,W);
| ~~~^~~~~~~
|
s190715881 | p03713 | C++ | #include <iostream>
using namespace std;
int max(int a, int b, int c) {
if (a > b&&a > c)return a;
else if (b > a&&b > c)return b;
else return c;
}
int min(int a, int b, int c) {
if (a < b&&a < c)return a;
else if (b < a&&b < c)return b;
else return c;
}
int mmd(int a, int b, int c) {
return max(a, b, c) - min(a, b, c);
}
int main() {
int H, W, a, b, c, tmp = INT_MAX;
cin >> H >> W;
if (H % 3 == 0 || W % 3 == 0)cout << 0 << endl;
else {
for (int i = 1; i < W; i++) {
a = i*H;
if (H % 2 == 0) {
b = (W - i)*(H / 2);
c = b;
}
else {
b = (W - i)*((H - 1) / 2);
c = (W - i)*((H + 1) / 2);
}
if (tmp > mmd(a, b, c))tmp = mmd(a, b, c);
}
for (int i = 1; i < H; i++) {
a = i*W;
if (W % 2 == 0) {
b = (H - i)*(W / 2);
c = b;
}
else {
b = (H - i)*((W - 1) / 2);
c = (H - i)*((W + 1) / 2);
}
if (tmp > mmd(a, b, c))tmp = mmd(a, b, c);
}
}
cout << tmp << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:34: error: 'INT_MAX' was not declared in this scope
25 | int H, W, a, b, c, tmp = 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;
|
s138862029 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
int m(int a1, int a2, int a3) {
if (a1 > a2) {
swap(a1, a2);
}
if (a2 > a3) {
swap(a2, a3);
}
if (a1 > a2) {
swap(a1, a2);
}
return a3-a1;
}
int f(int H, int W) {
int r = 10000000;
int k = H / 3;
if (k != 0) {
r = min(r, m(k * W, (H - k)*(W / 2), (H - k)*(W - (W / 2))));
}
r = min(r, m((k + 1) * W, (H - k - 1)*(W / 2), (H - k - 1)*(W - (W / 2))));
return r;
}
int main(){
int H, W;
cin >> H >> W;
int res = H;
if (H % 3 == 0 || W % 3 == 0) {
res = 0;
cout << 0 << endl;
return 0;
}
res = min(H, W);
res = min(res, f(H, W));
res = min(res, f(W, H));
cout << res << endl;
return 0; | a.cc: In function 'int main()':
a.cc:38:12: error: expected '}' at end of input
38 | return 0;
| ^
a.cc:24:11: note: to match this '{'
24 | int main(){
| ^
|
s710860843 | p03713 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w;
cin>>h>>w;
for(int i=0; i<h; i++){
s[0]
}
}
| a.cc: In function 'int main()':
a.cc:8:17: error: 's' was not declared in this scope
8 | s[0]
| ^
|
s316434248 | p03713 | C | #define L long long
L n(L a,L b){return a<b?a:b;}
L x(L a,L b){return a>b?a:b;}
L l(L a){return a>0?a:-a;}
#define E(p,q) x(l(b*i-p),l(b*i-q))
L s(int a,int b){
L i=0,p=1<<30;
for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
}
int main(void){
L h,w;
scanf("%d%d",&h,&w);
printf("%d",n(s(h,w),s(w,h));
} | main.c: In function 'main':
main.c:13:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define L long long
main.c:13:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
14 | printf("%d",n(s(h,w),s(w,h));
| ^~~~~~
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:37: error: expected ')' before ';' token
14 | printf("%d",n(s(h,w),s(w,h));
| ~ ^
| )
main.c:14:38: error: expected ';' before '}' token
14 | printf("%d",n(s(h,w),s(w,h));
| ^
| ;
15 | }
| ~
|
s354061703 | p03713 | C | #define L long long
L n(L a,L b){return a<b?a:b;}
L x(L a,L b){return a>b?a:b;}
L l(L a){return a>0?a:-a}
#define E(p,q) x(l(b*i-p),l(b*i-q))
L s(int a,int b){
L i=0,p=1<<30;
for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
}
int main(void){
L h,w;
scanf("%d%d",&h,&w);
printf("%d",n(s(h,w),s(w,h));
} | main.c: In function 'l':
main.c:4:25: error: expected ';' before '}' token
4 | L l(L a){return a>0?a:-a}
| ^
| ;
main.c: In function 'main':
main.c:13:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define L long long
main.c:13:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
14 | printf("%d",n(s(h,w),s(w,h));
| ^~~~~~
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:37: error: expected ')' before ';' token
14 | printf("%d",n(s(h,w),s(w,h));
| ~ ^
| )
main.c:14:38: error: expected ';' before '}' token
14 | printf("%d",n(s(h,w),s(w,h));
| ^
| ;
15 | }
| ~
|
s507089860 | p03713 | C | #define L long long
L n(L a,L b){return a<b?a:b;}
L x(L a,L b){return a>b?a:b;}
L l(L a){return a>0?a:-a}
#define E(p,q) x(l(b*i-p),l(b*i-q));
L s(int a,int b){
L i=0,p=1<<30;
for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
}
int main(void){
L h,w;
scanf("%d%d",&h,&w);
printf("%d",n(s(h,w),s(w,h));
} | main.c: In function 'l':
main.c:4:25: error: expected ';' before '}' token
4 | L l(L a){return a>0?a:-a}
| ^
| ;
main.c: In function 's':
main.c:5:36: error: expected ')' before ';' token
5 | #define E(p,q) x(l(b*i-p),l(b*i-q));
| ^
main.c:8:24: note: in expansion of macro 'E'
8 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:8:23: note: to match this '('
8 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:8:22: error: too few arguments to function 'n'
8 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:2:3: note: declared here
2 | L n(L a,L b){return a<b?a:b;}
| ^
main.c: In function 'main':
main.c:13:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define L long long
main.c:13:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
13 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:13:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:14:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
14 | printf("%d",n(s(h,w),s(w,h));
| ^~~~~~
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:14:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:37: error: expected ')' before ';' token
14 | printf("%d",n(s(h,w),s(w,h));
| ~ ^
| )
main.c:14:38: error: expected ';' before '}' token
14 | printf("%d",n(s(h,w),s(w,h));
| ^
| ;
15 | }
| ~
|
s290406159 | p03713 | C | #define L long long
L n(L a,L b){return a<b?a:b;}
L x(L a,L b){return a>b?a:b;}
#define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
L s(int a,int b){
L i=0,p=1<<30;
for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
}
int main(void){
L h,w;
scanf("%d%d",&h,&w);
printf("%d",n(s(h,w),s(w,h));
} | main.c: In function 's':
main.c:4:18: error: implicit declaration of function 'llabs' [-Wimplicit-function-declaration]
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'llabs'
+++ |+#include <stdlib.h>
1 | #define L long long
main.c:4:18: warning: incompatible implicit declaration of built-in function 'llabs' [-Wbuiltin-declaration-mismatch]
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:4:18: note: include '<stdlib.h>' or provide a declaration of 'llabs'
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:4:44: error: expected ')' before ';' token
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:7:23: note: to match this '('
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:7:22: error: too few arguments to function 'n'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:2:3: note: declared here
2 | L n(L a,L b){return a<b?a:b;}
| ^
main.c: In function 'main':
main.c:12:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
12 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define L long long
main.c:12:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
12 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
13 | printf("%d",n(s(h,w),s(w,h));
| ^~~~~~
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:37: error: expected ')' before ';' token
13 | printf("%d",n(s(h,w),s(w,h));
| ~ ^
| )
main.c:13:38: error: expected ';' before '}' token
13 | printf("%d",n(s(h,w),s(w,h));
| ^
| ;
14 | }
| ~
|
s071435453 | p03713 | C | #define L long long
L n(L a,L b){return a<b?a:b;}
L x(L a,L b){return a>b?a:b;}
#define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
L s(int a,int b){
L i=0,p=1<<30;
for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
}
int main(void){
L h,w;
scanf("%d%d",&h,&w);
printf("%d",n(s(h,w),s(w,h));
} | main.c: In function 's':
main.c:4:18: error: implicit declaration of function 'llabs' [-Wimplicit-function-declaration]
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'llabs'
+++ |+#include <stdlib.h>
1 | #define L long long
main.c:4:18: warning: incompatible implicit declaration of built-in function 'llabs' [-Wbuiltin-declaration-mismatch]
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:4:18: note: include '<stdlib.h>' or provide a declaration of 'llabs'
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^~~~~
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:4:44: error: expected ')' before ';' token
4 | #define E(p,q) x(llabs(b*i-p),llabs(b*i-q));
| ^
main.c:7:24: note: in expansion of macro 'E'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:7:23: note: to match this '('
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:7:22: error: too few arguments to function 'n'
7 | for(;i++<a;p=n(p,n(E((a-i)/2*b,b*(a-i-(a-i)/2)),E(b/2*(a-i),(a-i)*(b-b/2)))));
| ^
main.c:2:3: note: declared here
2 | L n(L a,L b){return a<b?a:b;}
| ^
main.c: In function 'main':
main.c:12:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
12 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define L long long
main.c:12:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
12 | scanf("%d%d",&h,&w);
| ^~~~~
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
13 | printf("%d",n(s(h,w),s(w,h));
| ^~~~~~
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:37: error: expected ')' before ';' token
13 | printf("%d",n(s(h,w),s(w,h));
| ~ ^
| )
main.c:13:38: error: expected ';' before '}' token
13 | printf("%d",n(s(h,w),s(w,h));
| ^
| ;
14 | }
| ~
|
s960113622 | p03713 | C++ | #include <iostream>
#include <vector>
using namespace std;
#define int long long
auto main() -> signed {
int H, W;
cin >> H >> W;
if(H%3==0||W%3==0) {
cout << 0 << endl;
return 0;
}
int ans = 1e+9;
for(int h=1; h<H; ++h) {
int a = h*W;
int bw = W/2;
int b = bw*(H-h);
int c = (W-bw)*(H-h);
vector<int> v;
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
ans = min(ans, v[2]-v[0]);
if(H-h>=2) {
int bh = (H-h)/2;
b = bh*W;
c = (H-h-bh)*W;
v.clear();
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
ans = min(ans, v[2]-v[0]);
}
}
for(int w=1; w<W; ++w) {
int a = w*H;
int bh = H/2;
int b = bh*(W-w);
int c = (W-w)*(H-bh);
vector<int> v;
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
ans = min(ans, v[2]-v[0]);
if(W-w>=2) {
int bw = (W-w)/2;
b = bw*H;
c = (W-w-bw)*H;
v.clear();
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
ans = min(ans, v[2]-v[0]);
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:24:9: error: 'sort' was not declared in this scope; did you mean 'short'?
24 | sort(v.begin(), v.end());
| ^~~~
| short
a.cc:49:9: error: 'sort' was not declared in this scope; did you mean 'short'?
49 | sort(v.begin(), v.end());
| ^~~~
| short
|
s340443033 | p03713 | C++ | #include <iostream>
using namespace std;
#define int long long
int main()
{
int h, w, i, y;
int x1, x2, x3;
int _min, _max;
long long answer = 1e11;
cin >> h >> w;
if(h % 3 == 0 || w % 3 == 0)
{
cout << "0";
}
else
{
//1
for(i=0; i<=h; i++)
{
x1 = i * w;
x2 = (h - i) * (w / 2);
x3 = h * w - x1 - x2;
_min = min(x1, min(x2, x3));
_max = max(x1, max(x2, x3));
answer = min(answer, _max - _min);
}
//2
y = h;
h = w;
w = y;
for(i=0; i<=h; i++)
{
x1 = i * w;
x2 = (h - i) * (w / 2);
x3 = h * w - x1 - x2;
_min = min(x1, min(x2, x3));
_max = max(x1, max(x2, x3));
answer = min(answer, _max - _min);
}
cout << answer << endl;
}
return 0;
}
| cc1plus: error: '::main' must return 'int'
|
s796453767 | p03713 | C | #include <stdio.h>
int main()
{
int h, w, h1, h2;
int answer = 0;
int x1, x3;
int m, n;
scanf("%d %d", &m, &n);
if(m >= n)
{
h = m;
w = n;
}
else
{
h = n;
w = m;
}
if(h % 3 == 0 || w % 3 == 0)
{
answer = 0;
}
else
{
//1
h1 = h / 3;
if(h % 3 == 2) h1++;
x1 = h1 * w;
//3
h2 = h - h1;
if(w % 2 == 0)
{
x3 = h2 * w / 2;
}
else if(h2 % 2 == 0)
{
x3 = w * h2 / 2;
}
else
{
if(w =< h2)
{
x3 = w * h2 / 2;
}
else
{
x3 = h2 * w / 2;
}
}
//
if(x1 > x3)
{
answer = x1 -x3;
}
else if(x3 > x1)
{
answer = x3 - x1;
}
else
{
answer = 0;
}
if(answer < 0)
{
answer = 0;
}
}
printf("%d\n", answer);
return 0;
}
| main.c: In function 'main':
main.c:43:13: error: expected expression before '<' token
43 | if(w =< h2)
| ^
|
s041519355 | p03713 | C | //
x2 = (h - i) / 2 * w;
x3 = h * w - x1 - x2;
if(x1 <= x2)
{
min = x1;
max = x3;
}
else if(x2 < x1 && x1 < x3)
{
min = x2;
max = x3;
}
else
{
min = x2;
max = x1;
}
if(answer1 > max - min)
{
answer1 = max - min;
} | main.c:2:7: warning: data definition has no type or storage class
2 | x2 = (h - i) / 2 * w;
| ^~
main.c:2:7: error: type defaults to 'int' in declaration of 'x2' [-Wimplicit-int]
main.c:2:13: error: 'h' undeclared here (not in a function)
2 | x2 = (h - i) / 2 * w;
| ^
main.c:2:17: error: 'i' undeclared here (not in a function)
2 | x2 = (h - i) / 2 * w;
| ^
main.c:2:26: error: 'w' undeclared here (not in a function)
2 | x2 = (h - i) / 2 * w;
| ^
main.c:3:7: warning: data definition has no type or storage class
3 | x3 = h * w - x1 - x2;
| ^~
main.c:3:7: error: type defaults to 'int' in declaration of 'x3' [-Wimplicit-int]
main.c:3:20: error: 'x1' undeclared here (not in a function); did you mean 'x3'?
3 | x3 = h * w - x1 - x2;
| ^~
| x3
main.c:4:7: error: expected identifier or '(' before 'if'
4 | if(x1 <= x2)
| ^~
main.c:9:7: error: expected identifier or '(' before 'else'
9 | else if(x2 < x1 && x1 < x3)
| ^~~~
main.c:14:7: error: expected identifier or '(' before 'else'
14 | else
| ^~~~
main.c:19:7: error: expected identifier or '(' before 'if'
19 | if(answer1 > max - min)
| ^~
|
s809567362 | p03713 | C++ |
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
long h = scan.nextLong();
long w = scan.nextLong();
long answer;
if(h%3==0 || w%3==0){
answer = 0;
}else{
ArrayList<Long> list = new ArrayList<>();
long x = h * w / 3;
long i = x / h;
long temp, max, min;
if(h % 2 == 0){
temp = Math.abs(h*i - h/2*(w-i));
list.add(temp);
System.out.println(temp);
i++;
temp = Math.abs(h*i - h/2*(w-i));
list.add(temp);
System.out.println(temp);
}else{
max = Math.max(Math.abs(h*i - h/2*(w-i)), Math.abs(h*i - (h/2+1)*(w-i)));
max = Math.max(max, w-i);
min = Math.min(Math.abs(h*i - h/2*(w-i)), Math.abs(h*i - (h/2+1)*(w-i)));
min = Math.min(min, w-i);
temp = max - min;
list.add(temp);
i++;
max = Math.max(Math.abs(h*i - h/2*(w-i)), Math.abs(h*i - (h/2+1)*(w-i)));
max = Math.max(max, w-i);
min = Math.min(Math.abs(h*i - h/2*(w-i)), Math.abs(h*i - (h/2+1)*(w-i)));
min = Math.min(min, w-i);
temp = max - min;
}
i = x / w;
if(w % 2 == 0){
temp = Math.abs(w*i - w/2*(h-i));
list.add(temp);
System.out.println(temp);
i++;
temp = Math.abs(w*i - w/2*(h-i));
list.add(temp);
System.out.println(temp);
}else{
max = Math.max(Math.abs(w*i - w/2*(h-i)), Math.abs(w*i - (w/2+1)*(h-i)));
max = Math.max(max, h-i);
min = Math.min(Math.abs(w*i - w/2*(h-i)), Math.abs(w*i - (w/2+1)*(h-i)));
min = Math.min(min, h-i);
temp = max - min;
list.add(temp);
System.out.println(temp);
i++;
max = Math.max(Math.abs(w*i - w/2*(h-i)), Math.abs(w*i - (w/2+1)*(h-i)));
max = Math.max(max, h-i);
min = Math.min(Math.abs(w*i - w/2*(h-i)), Math.abs(w*i - (w/2+1)*(h-i)));
min = Math.min(min, h-i);
temp = max - min;
System.out.println(temp);
}
Collections.sort(list);
answer = list.get(0);
}
System.out.println(answer);
}
}
| a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.ArrayList;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.Collections;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.Scanner;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
7 | public class Main {
| ^~~~~~
|
s682348638 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
#define MOD 1e9 + 7
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
int main() {
ll H, W;
scanf("%lld %lld", &H, &W);
ll ans = INT_MAX;
for(ll i = 1; i < H; ++i) {
ll tmp = i * W;
ll tmp2 = (H - i) * (W / 2);
ll tmp3 = (H - i) * (W - W / 2);
ll maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
ll mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
tmp2 =((H - i) / 2) * W;
tmp3 =((H - i) - (H - i) / 2) * W;
maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
}
(ll i = 1; i < W; ++i) {
ll tmp = i * H;
ll tmp2 = (W - i) * (H / 2);
ll tmp3 = (W - i) * (H - H / 2);
ll maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
ll mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
tmp2 = ((W - i) / 2) * W;
tmp3 = ((W - i) - (W - i) / 2) * W;
maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
}
printf("%lld\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:38:13: error: expected primary-expression before 'i'
38 | (ll i = 1; i < W; ++i) {
| ^
a.cc:38:12: error: expected ')' before 'i'
38 | (ll i = 1; i < W; ++i) {
| ~ ^~
| )
a.cc:38:20: error: 'i' was not declared in this scope
38 | (ll i = 1; i < W; ++i) {
| ^
|
s591568234 | p03713 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
#define MOD 1e9 + 7
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
int main() {
ll H, W;
scanf("%lld %lld", &H, &W);
ll ans = INF;
for(ll i = 1; i < H; ++i) {
ll tmp = i * W;
ll tmp2 = (H - i) * (W / 2);
ll tmp3 = (H - i) * (W - W / 2);
ll maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
ll mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
tmp2 =((H - i) / 2) * W;
tmp3 =((H - i) - (H - i) / 2) * W;
maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
}
(ll i = 1; i < W; ++i) {
ll tmp = i * H;
ll tmp2 = (W - i) * (H / 2);
ll tmp3 = (W - i) * (H - H / 2);
ll maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
ll mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
tmp2 = ((W - i) / 2) * W;
tmp3 = ((W - i) - (W - i) / 2) * W;
maxi = max(tmp, tmp2);
maxi = max(maxi, tmp3);
mini = min(tmp, tmp2);
mini = min(mini, tmp3);
ans = min(ans, maxi - mini);
}
printf("%lld\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:38:13: error: expected primary-expression before 'i'
38 | (ll i = 1; i < W; ++i) {
| ^
a.cc:38:12: error: expected ')' before 'i'
38 | (ll i = 1; i < W; ++i) {
| ~ ^~
| )
a.cc:38:20: error: 'i' was not declared in this scope
38 | (ll i = 1; i < W; ++i) {
| ^
|
s009858216 | p03713 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 100005
#define HMAX 100005
#define INF (long long)1e18
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef long long ll;
typedef pair<int ,int > P;
struct edge{
int to,cost;
};
int A,B,C,D,E,N,W,H,ans;
char a[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
for (int i = 0; i < H; ++i)
{
A = W * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = W * ((H-i)/2);
C = W * (H-i - (H-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (W/2) * (H-i);
E = (W-W/2) * (H-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ma-mi,maximum-minimum);
}
for (int i = 0; i < W; ++i)
{
A = H * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = H * ((W-i)/2);
C = H * (W-i - (W-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (H/2) * (W-i);
E = (H-H/2) * (W-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ans,ma-mi);
ans = min(ans,maximum-minimum);
}
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> H >> W;
solve();
#ifdef DEBUG
debug();
#endif
answer();
return 0;
} | /tmp/ccDeATlg.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x4be): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccDeATlg.o
a.cc:(.text+0x4d7): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccDeATlg.o
collect2: error: ld returned 1 exit status
|
s137645191 | p03713 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 100005
#define HMAX 100005
#define INF (long long)1e18
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef long long ll;
typedef pair<int ,int > P;
struct edge{
int to,cost;
};
int A,B,C,D,E,N,W,H,ans,dp[HMAX][WMAX];
char a[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
for (int i = 0; i < H; ++i)
{
A = W * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = W * ((H-i)/2);
C = W * (H-i - (H-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (W/2) * (H-i);
E = (W-W/2) * (H-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ma-mi,maximum-minimum);
}
for (int i = 0; i < W; ++i)
{
A = H * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = H * ((W-i)/2);
C = H * (W-i - (W-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (H/2) * (W-i);
E = (H-H/2) * (W-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ans,ma-mi);
ans = min(ans,maximum-minimum);
}
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> H >> W;
solve();
#ifdef DEBUG
debug();
#endif
answer();
return 0;
} | /tmp/cc6qXqGF.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x4be): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc6qXqGF.o
a.cc:(.text+0x4d7): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc6qXqGF.o
collect2: error: ld returned 1 exit status
|
s470187607 | p03713 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 100005
#define HMAX 100005
#define INF (long long)1e18
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef long long ll;
typedef pair<int ,int > P;
struct edge{
int to,cost;
};
int A,B,C,D,E,N,W,H,ans,dp[HMAX][WMAX];
char a[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
for (int i = 0; i < H; ++i)
{
A = W * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = W * ((H-i)/2);
C = W * (H-i - (H-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (W/2) * (H-i);
E = (W-W/2) * (H-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ma-mi,maximum-minimum);
}
for (int i = 0; i < W; ++i)
{
A = H * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = H * ((W-i)/2);
C = H * (W-i - (W-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (H/2) * (W-i);
E = (H-H/2) * (W-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ans,ma-mi);
ans = min(ans,maximum-minimum);
}
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> H >> W;
solve();
#ifdef DEBUG
debug();
#endif
answer();
return 0;
} | /tmp/cc3Q5ff7.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x4be): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc3Q5ff7.o
a.cc:(.text+0x4d7): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc3Q5ff7.o
collect2: error: ld returned 1 exit status
|
s390126974 | p03713 | C++ | #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 100005
#define HMAX 100005
#define INF (long long)1e18
//コメントアウトするとdebug()を実行しない
#define DEBUG
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
std::fill( (T*)array, (T*)(array+N), val );
}
typedef long long ll;
typedef pair<int ,int > P;
struct edge{
int to,cost;
};
int A,B,C,D,E,N,W,H,ans,dp[HMAX][WMAX];
char a[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};
void solve(){
for (int i = 0; i < H; ++i)
{
A = W * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = W * ((H-i)/2);
C = W * (H-i - (H-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (W/2) * (H-i);
E = (W-W/2) * (H-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ma-mi,maximum-minimum);
}
for (int i = 0; i < W; ++i)
{
A = H * (i+1);
int ma = A,mi = A, maximum = A,minimum = A;
B = H * ((W-i)/2);
C = H * (W-i - (W-i)/2);
ma = max(ma,B);
ma = max(ma,C);
mi = min(mi,B);
mi = min(mi,C);
D = (H/2) * (W-i);
E = (H-H/2) * (W-i);
maximum = max(maximum,B);
maximum = max(maximum,C);
minimum = min(minimum,B);
minimum = min(minimum,C);
ans = min(ans,ma-mi);
ans = min(ans,maximum-minimum);
}
}
void debug(){
}
void answer(){
cout << ans << "\n";
}
int main(){
cin >> H >> W;
solve();
#ifdef DEBUG
debug();
#endif
answer();
return 0;
} | /tmp/ccGtG2ve.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x4be): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccGtG2ve.o
a.cc:(.text+0x4d7): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/ccGtG2ve.o
collect2: error: ld returned 1 exit status
|
s530541385 | p03713 | C++ | #include <bits/stdc++.h>
#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 SORTR(v,n) sort(v, v+n, greater<int>());
#define int long long // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
int h;
int w;
int ans=INF;
signed main(){
scanf("%lld", &h);
scanf("%lld", &w);
int a;
if(h%3 == 0||w%3 == 0){
cout<< 0;
return 0;
}
ans = min(h,w);
for(int i = 1;i < h;i++){
a=i*w;
b=(h-i)*(w/2);
c=h*w-a-b;
int buf=max(abs(b-c), max(abs(a-c),abs(a-b)));
ans=min(ans,buf);
}
swap(w,h);
for(int i = 1;i < h;i++){
a=i*w;
b=(h-i)*(w/2);
c=h*w-a-b;
int buf=max(abs(b-c), max(abs(a-c),abs(a-b)));
ans=min(ans,buf);
}
printf("%lld\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:36:9: error: 'b' was not declared in this scope
36 | b=(h-i)*(w/2);
| ^
a.cc:37:9: error: 'c' was not declared in this scope
37 | c=h*w-a-b;
| ^
a.cc:46:9: error: 'b' was not declared in this scope
46 | b=(h-i)*(w/2);
| ^
a.cc:47:9: error: 'c' was not declared in this scope
47 | c=h*w-a-b;
| ^
|
s679210521 | p03713 | C++ | #include <iostream>
#include <algorithm>
int main(){
int height,width;
int h2,w2;
int h3,w3;
int widthvar;
int S1,S2,S3;
std::cin >> height >> width;
int defmin = 2000000000;
for(int w1 = 1; w1 < width; w1++){//横に2分割 左の面積=S1
S1 = w1*height;
widthvar =width- w1;
//右側を横に分割
w2 = widthvar / 2;
S2 = w2*height;
w3 = widthvar - w2;
S3 = w3*height;
defmin = std::min(defmin,std::max(S1,S2,S3) - std::min(S1,S2,S3));
//右側を縦に分割
h2 = height / 2;
S2 = widthvar*h2;
h3 = height - h2;
S3 = widthvar*h3;
defmin = std::min(defmin,std::max(S1,S2,S3) - std::min(S1,S2,S3));
}
std::swap(height,width);
//縦と横を入れ替えて同じことを行う
for(int w1 = 1; w1 < width; w1++){//横に2分割 左の面積=S1
S1 = w1*height;
widthvar = width - w1;
//右側を横に分割
w2 = widthvar / 2;
S2 = w2*height;
w3 = widthvar - w2;
S3 = w3*height;
defmin = std::min(defmin,std::max(S1,S2,S3) - std::min(S1,S2,S3));
//右側を縦に分割
h2 = height / 2;
S2 = widthvar*h2;
h3 = height - h2;
S3 = widthvar*h3;
defmin = std::min(defmin,std::max(S1,S2,S3) - std::min(S1,S2,S3));
}
std::cout << defmin << std::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:21:36: required from here
21 | defmin = std::min(defmin,std::max(S1,S2,S3) - std::min(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 = int; _Compare = int]':
a.cc:21:57: required from here
21 | defmin = std::min(defmin,std::max(S1,S2,S3) - std::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))
| ~~~~~~^~~~~~~~~~
|
s242277784 | p03713 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
int main(void) {
int H, W, Hc, S1, S2, S3, minC, diff;
cin >> H >> W;
minC = INT_MAX;
if (H > W)
swap(H, W);
if ((H * W) % 3 == 0) {
cout << 0 << endl;
return 0;
}
Hc = H / 2;
for (int i = 1; i < W; i++) {
S1 = Hc * i;
S2 = (H - Hc) * i;
S3 = H * (W - i);
diff = max({S1, S2, S3}) - min({S1, S2, S3});
if (minC > diff)
minC = diff;
}
cout << minC << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:10: error: 'INT_MAX' was not declared in this scope
9 | minC = INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include <iostream>
+++ |+#include <climits>
3 |
|
s303855415 | p03713 | C++ | #include <iostream>
#include <vector>
using namespace std;
int diff(vector<int> a) {
return *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
}
int main() {
int H, W;
vector<vector<int>> div(4, vector<int>(3)); // 4通り考えれば十分
cin >> H >> W;
if (H % 3 == 0 or W % 3 == 0) {
cout << 0 << endl;
return 0;
}
div[0][0] = W / 3 * H;
div[0][1] = (W - W / 3) * (H / 2);
div[0][2] = (W - W / 3) * (H / 2);
if (H % 2 != 0) div[0][2] += W - W / 3;
div[1][0] = (W / 3 + 1) * H;
div[1][1] = (W - W / 3 - 1) * (H / 2);
div[1][2] = (W - W / 3 - 1) * (H / 2);
if (H % 2 != 0) div[1][2] += W - W / 3 - 1;
div[2][0] = H / 3 * W;
div[2][1] = (H - H / 3) * (W / 2);
div[2][2] = (H - H / 3) * (W / 2);
if (W % 2 != 0) div[2][2] += H - H / 3;
div[3][0] = (H / 3 + 1) * W;
div[3][1] = (H - H / 3 - 1) * (W / 2);
div[3][2] = (H - H / 3 - 1) * (W / 2);
if (W % 2 != 0) div[3][2] += H - H / 3 - 1;
cout << min({diff(div[0]), diff(div[1]), diff(div[2]), diff(div[3])}) << endl;
} | a.cc: In function 'int diff(std::vector<int>)':
a.cc:6:17: error: 'max_element' was not declared in this scope
6 | return *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
| ^~~~~~~~~~~
a.cc:6:52: error: 'min_element' was not declared in this scope
6 | return *max_element(a.begin(), a.end()) - *min_element(a.begin(), a.end());
| ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:38:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
38 | cout << min({diff(div[0]), diff(div[1]), diff(div[2]), diff(div[3])}) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: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
|
s628725312 | p03713 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int cutT(float h, float w){
int p,q,s1,s2,s3;
p = static_cast<int>(h/3+0.5f);
q = static_cast<int>(w/2+0.5f);
s1 = p * w;
s2 = (h-p) * q;
s3 = (h-p) * (w-q);
return (max(max(s1,s2),s3) - min(min(s1,s2),s3));
}
int main(int argc, char const *argv[]) {
int h,w,temp;
std::cin >> h >> w;
if (h % 3 == 0 || w % 3 == 0) {
std::cout << 0 << '\n';
return 0;
}
// heightの方を長くしておく
if (h < w) {
temp = h;
h = w;
w = temp;
}
temp = cutT(h, w);
temp = min(temp, w)
std::cout << temp << '\n';
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:34:28: error: expected ';' before 'std'
34 | temp = min(temp, w)
| ^
| ;
35 | std::cout << temp << '\n';
| ~~~
|
s195399638 | p03713 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
long long Diff(long H, long W)
{
long long Smax, Smin, Diff =0;
for (long i = 1; i < W - 2; i++){
for (long j = i + 1; j < W - 1; j++){
Smax = H*max(i, max(j - i, W - j));
Smin = H*min(i, min(j - i, W - j));
if (c==0)Diff = Smax - Smin;
else (Diff ? Diff : Smax - Smin) ;
c++;
}
}
for (long i = 1; i < H - 1; i++){
for (long j = i + 1; j < W - 1; j++){
Smax = max(i*j, max((H - i)*j, H*(W - j)));
Smin = min(i*j, min((H - i)*j, H*(W - j)));
Diff = (Diff < Smax - Smin ? Diff : Smax - Smin);
Smax = max(H*j, max(i*(W - j), (H - i)*(W - j)));
Smin = min(H*j, min(i*(W - j), (H - i)*(W - j)));
Diff = (Diff < Smax - Smin ? Diff : Smax - Smin);
}
}
return Diff;
}
int main()
{
int H, W;
cin >> H >> W;
cout << min(Diff(H, W), Diff(W, H));
cin >> H;
return 0;
} | a.cc: In function 'long long int Diff(long int, long int)':
a.cc:14:29: error: 'c' was not declared in this scope
14 | if (c==0)Diff = Smax - Smin;
| ^
a.cc:16:25: error: 'c' was not declared in this scope
16 | c++;
| ^
|
s721951328 | p03713 | C++ | using namespace std;
long Diff(int H, int W)
{
long Smax, Smin, Diff =0;
int c = 0;
for (int i = 1; i < W - 2; i++){
for (int j = i + 1; j < W - 1; j++){
Smax = H*max(i, max(j - i, W - j));
Smin = H*min(i, min(j - i, W - j));
if (c==0)Diff = Smax - Smin;
else (Diff ? Diff : Smax - Smin) ;
c++;
}
}
for (int i = 1; i < H - 1; i++){
for (int j = i + 1; j < W - 1; j++){
Smax = max(i*j, max((H - i)*j, H*(W - j)));
Smin = min(i*j, min((H - i)*j, H*(W - j)));
Diff = (Diff < Smax - Smin ? Diff : Smax - Smin);
Smax = max(H*j, max(i*(W - j), (H - i)*(W - j)));
Smin = min(H*j, min(i*(W - j), (H - i)*(W - j)));
Diff = (Diff < Smax - Smin ? Diff : Smax - Smin);
}
}
return Diff;
}
int main()
{
int H, W;
cin >> H >> W;
cout << min(Diff(H, W), Diff(W, H));
cin >> H;
return 0;
} | a.cc: In function 'long int Diff(int, int)':
a.cc:9:41: error: 'max' was not declared in this scope; did you mean 'Smax'?
9 | Smax = H*max(i, max(j - i, W - j));
| ^~~
| Smax
a.cc:9:34: error: 'max' was not declared in this scope; did you mean 'Smax'?
9 | Smax = H*max(i, max(j - i, W - j));
| ^~~
| Smax
a.cc:10:41: error: 'min' was not declared in this scope; did you mean 'Smin'?
10 | Smin = H*min(i, min(j - i, W - j));
| ^~~
| Smin
a.cc:10:34: error: 'min' was not declared in this scope; did you mean 'Smin'?
10 | Smin = H*min(i, min(j - i, W - j));
| ^~~
| Smin
a.cc:18:41: error: 'max' was not declared in this scope; did you mean 'Smax'?
18 | Smax = max(i*j, max((H - i)*j, H*(W - j)));
| ^~~
| Smax
a.cc:18:32: error: 'max' was not declared in this scope; did you mean 'Smax'?
18 | Smax = max(i*j, max((H - i)*j, H*(W - j)));
| ^~~
| Smax
a.cc:19:41: error: 'min' was not declared in this scope; did you mean 'Smin'?
19 | Smin = min(i*j, min((H - i)*j, H*(W - j)));
| ^~~
| Smin
a.cc:19:32: error: 'min' was not declared in this scope; did you mean 'Smin'?
19 | Smin = min(i*j, min((H - i)*j, H*(W - j)));
| ^~~
| Smin
a.cc: In function 'int main()':
a.cc:34:9: error: 'cin' was not declared in this scope
34 | cin >> H >> W;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:35:9: error: 'cout' was not declared in this scope
35 | cout << min(Diff(H, W), Diff(W, H));
| ^~~~
a.cc:35:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:17: error: 'min' was not declared in this scope; did you mean 'main'?
35 | cout << min(Diff(H, W), Diff(W, H));
| ^~~
| main
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.