submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s109171540 | p00114 | C++ | #include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<cmath>
#include<climits>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
#define ing long long
int gcd(int a, int b){
if(b == 0) return a;
return gcd(b, a % b);
}
int lcm(int a, int b){
return a*b / gcd(a, b);
}
int f(int x, int a, int m){
if(x == 1) return 0;
return f(a*x % m, a, m) + 1;
}
unsigned main(){
while(true){
int A, M, ans = 1;
for(int i = 0; i < 3; i++){
cin >> A >> M;
if(!A || !M) return 0;
ans = lcm(ans, f( A % M, A, M ) + 1 );
}
printf("%d\n", ans);
}
} | cc1plus: error: '::main' must return 'int'
|
s732440442 | p00114 | C++ | #include<iostream>
#include<cstdio>
#include<map>
#include<set>
#include<cmath>
#include<climits>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
long long gcd(long long a, long long b){
if(b == 0) return a;
return gcd(b, a % b);
}
long long lcm(long long a, long long b){
return a*b / gcd(a, b);
}
long long f(long long x, long long a, long long m){
if(x == 1) return 0;
return f(a*x % m, a, m) + 1;
}
unsigned main(){
while(true){
long long A, M, ans = 1;
for(long long i = 0; i < 3; i++){
cin >> A >> M;
if(!A || !M) return 0;
ans = lcm(ans, f( A % M, A, M ) + 1 );
}
printf("%d\n", ans);
}
} | cc1plus: error: '::main' must return 'int'
|
s711235046 | p00114 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
int in[6]={0};
while(cin>>in[0]>>in[1]>>in[2]>>in[3]>>in[4]>>in[5],in[0]+in[1]+in[2]+in[3]+in[4]+in[5]){
rep(i,3){
int a=in[i*2],b=in[i*2+1];
int co=0;
int d=1;
while(1){
co++;
d=(a*d)%b;
if(d==1)break;
}
in[i]=co;
}
cout<<__lcm(in[0],__lcm(in[1],in[2]))<<endl;
}} | a.cc: In function 'int main()':
a.cc:38:27: error: '__lcm' was not declared in this scope
38 | cout<<__lcm(in[0],__lcm(in[1],in[2]))<<endl;
| ^~~~~
a.cc:38:15: error: '__lcm' was not declared in this scope
38 | cout<<__lcm(in[0],__lcm(in[1],in[2]))<<endl;
| ^~~~~
|
s394102106 | p00114 | C++ | #include<iostream>
#include<algorithm>
#define ll long long int
using namespace std;
ll rep(ll s,ll t){
return (s/__gcd(s,t))*t;
}
ll main(){
ll a1,a2,a3,x,y,z,m1,m2,m3,now,a,b,c;
while(cin>>a1>>m1>>a2>>m2>>a3>>m3,a1||m1||a2||m2||a3||m3){
x=a1%m1;a=-1;b=-1;c=-1;
y=a2%m2;now=1;
z=a3%m3;
while(a==-1||b==-1||c==-1){
now++;
x=(a1*x)%m1;
if(x==1)
a=now;
y=(a2*y)%m2;
if(y==1)
b=now;
z=(a3*z)%m3;
if(z==1)
c=now;
}
cout<<rep(rep(a,b),c)<<endl;
}
return 0;
} | a.cc:3:22: error: '::main' must return 'int'
3 | #define ll long long int
| ^~~
a.cc:8:1: note: in expansion of macro 'll'
8 | ll main(){
| ^~
|
s638425091 | p00114 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
int a1,a2,a3,m1,m2,m3;
while(1)
{
cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3;
if(a1==0&&m1==0&&a2==0&&m2==0&&a3==0&&m3==0)break;
int c1=1,c2=1,c3=1;
int res=a1%m1;
//bool flag=true;
while(res!=1)
{
c1++;
res=(res*a1)%m1;
}
res=a2%m2;
while(res!=1)
{
c2++;
res=(res*a2)%m2;
}
res=a3%m3;
while(res!=1)
{
c3++;
res=(res*a3)%m3;
}
int tmp=__gcd(c1,c2);
tmp=__gcd(tmp,c3);
cout << c1*c2/gcd(c1, c2)*c3/gcd(c2,c3)/gcd(c1,c3)*gcd(c1, gcd(c2,c3)) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:61:31: error: 'gcd' was not declared in this scope
61 | cout << c1*c2/gcd(c1, c2)*c3/gcd(c2,c3)/gcd(c1,c3)*gcd(c1, gcd(c2,c3)) << endl;
| ^~~
|
s854020453 | p00115 | C | afdfd | main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
1 | afdfd
| ^~~~~
|
s312434851 | p00115 | C++ | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <numeric>
#include <ctime>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <map>
using namespace std;
typedef long long int lint;
class Mat3i {
int a[3][3];
public:
Mat3i(){
memset(a, 0, sizeof(int)* 3 * 3);
}
Mat3i(int a00, int a01, int a02, int a10, int a11, int a12, int a20, int a21, int a22){
a[0][0] = a00, a[0][1] = a01, a[0][2] = a02;
a[1][0] = a10, a[1][1] = a11, a[1][2] = a12;
a[2][0] = a20, a[2][1] = a21, a[2][2] = a22;
}
int det(){
return a[0][0] * a[1][1] * a[2][2] + a[0][1] * a[1][2] * a[2][0] + a[0][2] * a[1][0] * a[2][1] - a[0][2] * a[1][1] * a[2][0] - a[0][0] * a[1][2] * a[2][1] - a[0][1] * a[1][0] * a[2][2];
}
};
int main()
{
int xu, yu, zu;
int xe, ye, ze;
int x1, y1, z1, x2, y2, z2, x3, y3, z3;
cin >> xu >> yu >> zu;
cin >> xe >> ye >> ze;
cin >> x1 >> y1 >> z1;
cin >> x2 >> y2 >> z2;
cin >> x3 >> y3 >> z3;
int d = Mat3i(x2 - x1, x3 - x1, xu - xe, y2 - y1, y3 - y1, yu - ye, z2 - z1, z3 - z1, zu - ze).det();
double s = (double)Mat3i(xu - x1, x3 - x1, xu - xe, yu - y1, y3 - y1, yu - ye, zu - z1, z3 - z1, zu - ze).det() / d;
double t = (double)Mat3i(x2 - x1, xu - x1, xu - xe, y2 - y1, yu - y1, yu - ye, z2 - z1, zu - z1, zu - ze).det() / d;
double k = (double)Mat3i(x2 - x1, x3 - x1, xu - x1, y2 - y1, y3 - y1, yu - y1, z2 - z1, z3 - z1, zu - z1).det() / d;
if (0 <= s && s <= 1 && 0 <= t && t <= 1 && 0 <= k && k <= 1) cout << "MISS" << endl;
else cout << "HIT" << endl;
return 0;
} | a.cc: In constructor 'Mat3i::Mat3i()':
a.cc:25:17: error: 'memset' was not declared in this scope
25 | memset(a, 0, sizeof(int)* 3 * 3);
| ^~~~~~
a.cc:17:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
16 | #include <map>
+++ |+#include <cstring>
17 |
|
s962135821 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
bool intersect( const Pt &norm, Pt &inr )
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(norm), dot_BPN = bp.dot(norm);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr.x = uaz.x + ue.x*h;
inr.y = uaz.y + ue.y*h;
inr.z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
Pt norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
Pt inr;
if( intersect( norm, inr ) &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect(const Pt&, Pt&)':
a.cc:87:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
87 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s645777590 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
bool intersect( const Pt &norm, Pt &inr )
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(norm), dot_BPN = bp.dot(norm);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr.x = uaz.x + ue.x*h;
inr.y = uaz.y + ue.y*h;
inr.z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
Pt norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
Pt inr;
if( intersect( norm, inr ) &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect(const Pt&, Pt&)':
a.cc:87:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
87 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s060140438 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
bool intersect( const Pt &norm, Pt *inr )
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(norm), dot_BPN = bp.dot(norm);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr->x = uaz.x + ue.x*h;
inr->y = uaz.y + ue.y*h;
inr->z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
Pt norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
Pt inr;
if( intersect( norm, &inr ) &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect(const Pt&, Pt*)':
a.cc:87:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
87 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s343643039 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
bool intersect( Pt &norm, Pt &inr )
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(norm), dot_BPN = bp.dot(norm);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr.x = uaz.x + ue.x*h;
inr.y = uaz.y + ue.y*h;
inr.z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
Pt norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
Pt inr;
if( intersect( norm, inr ) &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect(Pt&, Pt&)':
a.cc:87:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
87 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s101429936 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
bool intersect( const Pt &n, Pt &inr )
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(n), dot_BPN = bp.dot(n);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr.x = uaz.x + ue.x*h;
inr.y = uaz.y + ue.y*h;
inr.z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
Pt norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
Pt inr;
if( intersect( norm, inr ) &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect(const Pt&, Pt&)':
a.cc:87:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
87 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s961976961 | p00115 | C++ | // AOJ 0115
#include<cstdio>
#include<cmath>
#define rep(i,a) for(int i=0;i<(a);++i)
const double EPS = 1e-5;
struct Pt
{
double x, y, z;
Pt( double x = 0, double y = 0, double z = 0 )
: x(x), y(y), z(z)
{}
Pt& operator+= ( const Pt &p )
{
x += p.x;
y += p.y;
z += p.z;
return *this;
}
Pt& operator-= ( const Pt &p )
{
x -= p.x;
y -= p.y;
z -= p.z;
return *this;
}
Pt operator+ ( const Pt &p ) const
{ return Pt( x+p.x, y+p.y, z+p.z ); }
Pt operator- ( const Pt &p ) const
{ return Pt( x-p.x, y-p.y, z-p.z ); }
Pt operator* ( double k ) const
{ return Pt( k*x, k*y, k*z ); }
Pt operator/ ( double k ) const
{ return Pt( x/k, y/k, z/k ); }
bool operator== ( const Pt &p ) const
{ return x==p.x && y==p.y && z==p.z; }
double dot( const Pt &p ) const
{ return x*p.x+y*p.y; }
double norm() const
{ return sqrt(x*x+y*y+z*z); }
Pt cross( const Pt &p ) const
{ return Pt( y*p.z-z*p.y, z*p.x-x*p.z, x*p.y-y*p.x ); }
};
struct Tri
{
Pt p0, p1, p2;
Tri( Pt a, Pt b, Pt c )
: p0(a), p1(b), p2(c)
{}
Pt norm()
{
Pt n = (p1-p0).cross(p2-p0);
return n/n.norm();
}
double area()
{
double a = (p1-p0).norm(), b = (p2-p1).norm(), c = (p2-p0).norm();
double s = (a+b+c)/2;
return sqrt(s*(s-a)*(s-b)*(s-c));
}
};
Pt uaz, enemy, v[3];
Pt norm, inr;
bool intersect()
{
Pt &ap = v[0]-uaz, bp = v[0]-enemy;
double dot_APN = ap.dot(norm), dot_BPN = bp.dot(norm);
if( fabs(dot_APN) < EPS && fabs(dot_BPN) < EPS )
return false;
else if( !(dot_APN <= EPS && dot_BPN >= -EPS) && !(dot_BPN <= EPS && dot_APN >= -EPS) )
return false;
Pt ue = enemy-uaz;
double h = fabs(dot_APN)/(fabs(dot_APN)+fabs(dot_BPN));
inr.x = uaz.x + ue.x*h;
inr.y = uaz.y + ue.y*h;
inr.z = uaz.z + ue.z*h;
return true;
}
int main()
{
double x, y, z;
scanf( "%lf%lf%lf", &x, &y, &z ); uaz = Pt(x,y,z);
scanf( "%lf%lf%lf", &x, &y, &z ); enemy = Pt(x,y,z);
rep( i, 3 )
scanf( "%lf%lf%lf", &x, &y, &z ), v[i] = Pt(x,y,z);
Tri barrier(v[0],v[1],v[2]);
norm = barrier.norm();
bool fl = true;
if( fabs((uaz-enemy).dot(norm)) >= EPS )
{
if( intersect() &&
Tri(v[0],v[1],inr).area()+Tri(v[1],v[2],inr).area()+Tri(v[2],v[0],inr).area() < barrier.area()+EPS )
fl = false;
}
puts( fl?"HIT":"MISS" );
return 0;
} | a.cc: In function 'bool intersect()':
a.cc:88:22: error: cannot bind non-const lvalue reference of type 'Pt&' to an rvalue of type 'Pt'
88 | Pt &ap = v[0]-uaz, bp = v[0]-enemy;
| ~~~~^~~~
|
s295648589 | p00115 | C++ | #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-8;
class P {
public:
double x, y, z;
P(){};
P(double x, double y, double z) : x(x), y(y), z(z) {};
P operator+(const P &p) {
return P(x + p.x, y + p.y, z + p.z);
}
P operator-(const P &p) {
return P(x - p.x, y - p.y, z - p.z);
}
P operator*(const double &n) {
return P(x * n, y * n, z * n);
}
P operator/(const double &n) {
return P(x / n, y / n, z / n);
}
};
double dot(const P &a, const P &b) {
return a.x * b.x + a.y * b.y + a.z * b.z;
}
P cross(const P &a, const P &b) {
return P(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
}
int main() {
P p[5];
for (int i=0; i<5; ++i) cin >> p[i].x >> p[i].y >> p[i].z;
P z = cross(p[3] - p[2], p[4] - p[2]);
double a = dot(p[2] - p[0], z);
double b = dot(p[1] - p[0], z);
double c = abs(a);
double d = abs(b) - c;
if (abs(a) < eps || (b < -eps && eps < a) || (a < -eps && eps < b) || d < -eps) {
cout << "HIT\n";
return 0;
}
P i = (p[0] * d + p[1] * c) / (c + d);
bool plus = false, minus = false;
for (int i=0; i<3; ++i) {
double t = dot(z, cross(p[(i + 1) % 3 + 2] - p[i + 2], i - p[i + 2]));
if (-eps < t) plus = true;
else if (eps > t) minus = true;
}
cout << ( ! plus || ! minus ? "MISS\n" : "HIT\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:51:74: error: no match for 'operator-' (operand types are 'int' and 'P')
51 | double t = dot(z, cross(p[(i + 1) % 3 + 2] - p[i + 2], i - p[i + 2]));
| ~ ^ ~~~~~~~~
| | |
| int P
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:51:83: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
51 | double t = dot(z, cross(p[(i + 1) % 3 + 2] - p[i + 2], i - p[i + 2]));
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:51:83: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
51 | double t = dot(z, cross(p[(i + 1) % 3 + 2] - p[i + 2], i - p[i + 2]));
| ^
|
s704973798 | p00115 | C++ | // ?????¬???????????¬??????
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;
// calculate vector x which satisfy Ax = b
// (A is N*N Matrix, b, x is N-dim vector)
template <typename T>
using Matrix = vector< vector<T> >;
constexpr double EPS = 1e-8;
template <typename T>
vector<double> gauss_jordan(const Matrix<T> &A, const vector<T> &b) {
int N = A.size();
// B = [A b]
Matrix<double> B(N, vector<double>(N+1));
for(int i=0; i<N; i++) {
for(int j=0; j<=N; j++) {
if(j < N) B[i][j] = A[i][j];
else B[i][j] = b[i];
}
}
for(int i=0; i<N; i++) {
int pivot = i;
for(int j=i+1; j<N; j++) {
if(abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
}
swap(B[i], B[pivot]);
// pivot is zero -> No solution or Not unique
assert(abs(B[i][i]) >= EPS);
for(int j=i+1; j<=N; j++) B[i][j] /= B[i][i];
for(int j=0; j<N; j++) {
if(i != j) {
for(int k=i+1; k<=N; k++) B[j][k] -= B[j][i] * B[i][k];
}
}
}
vector<double> x(N);
for(int i=0; i<N; i++) x[i] = B[i][N];
return x;
}
double pos[5][3];
signed main() {
rep(i,0,5) rep(j,0,3) cin >> pos[i][j];
Matrix<double> mat(3, vector<double>(3));
vector<double> vec(3);
rep(i,0,3) {
mat[i][0] = pos[3][i] - pos[2][i];
mat[i][1] = pos[4][i] - pos[2][i];
mat[i][2] = pos[0][i] - pos[1][i];
}
rep(i,0,3) vec[i] = pos[0][i] - pos[2][i];
vector<double> ans = gauss_jordan(mat, vec);
if(ans[0] < 0 || ans[1] < 0 || ans[0] + ans[1] > 1.0 || k < 0) cout << "HIT" << endl;
else cout << "MISS" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:102:61: error: 'k' was not declared in this scope
102 | if(ans[0] < 0 || ans[1] < 0 || ans[0] + ans[1] > 1.0 || k < 0) cout << "HIT" << endl;
| ^
|
s690275289 | p00115 | C++ | #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include <quadmath.h>
using namespace std;
typedef long double __float128;
ld EPS = 1e-20;
ld add(ld a, ld b){
if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
return a+b;
}
struct point{
ld x,y,z;
point(){}
point(ld x,ld y,ld z) : x(x) , y(y), z(z){}
point operator + (point p){
return point(add(x,p.x), add(y,p.y),add(z,p.z));
}
point operator - (point p){
return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
}
};
ld dist(point a,point b){
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
}
ld tetrahedra_volume(ld a,ld b,ld c,ld x,ld y,ld z){
#define sqr(x) ((x)*(x))
ld tv=sqr(a*x)*(sqr(b)+sqr(c)-sqr(a)+sqr(y)+sqr(z)-sqr(x))
+sqr(b*y)*(sqr(c)+sqr(a)-sqr(b)+sqr(z)+sqr(x)-sqr(y))
+sqr(c*z)*(sqr(a)+sqr(b)-sqr(c)+sqr(x)+sqr(y)-sqr(z))
-sqr(a*y*z)-sqr(b*z*x)-sqr(c*x*y)-sqr(a*b*c);
ld V=sqrt(tv/144.0);
if(V!=V)return -1;
return sqrt(tv/144.0);
#undef sqr
}
ld tetrahedra_volume(point A,point B,point C,point D){
ld a=dist(B,C),b=dist(C,A),c=dist(A,B);
ld d=dist(D,A),e=dist(D,B),f=dist(D,C);
ld V=tetrahedra_volume(a,b,c,d,e,f);
if(V<0)return -1;
return V;
}
int main(void){
point P,Q,A,B,C;
cin >> P.x >> P.y >> P.z;
cin >> Q.x >> Q.y >> Q.z;
cin >> A.x >> A.y >> A.z;
cin >> B.x >> B.y >> B.z;
cin >> C.x >> C.y >> C.z;
ld res1=tetrahedra_volume(A,C,P,Q);
ld res2=tetrahedra_volume(B,C,P,Q);
ld res3=tetrahedra_volume(A,B,P,Q);
if(res1==-1 || res2==-1 || res3==-1){
cout << "MISS" << endl;
return 0;
}
ld res4=tetrahedra_volume(A,B,C,P);
ld res5=tetrahedra_volume(A,B,C,Q);
if(res5==-1)cout << "MISS" << endl;
else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
else cout << "HIT" << endl;
return 0;
} | a.cc:11:21: error: conflicting declaration 'typedef long double __float128'
11 | typedef long double __float128;
| ^~~~~~~~~~
cc1plus: note: previous declaration as '__float128'
a.cc:13:1: error: 'ld' does not name a type
13 | ld EPS = 1e-20;
| ^~
a.cc:16:1: error: 'ld' does not name a type
16 | ld add(ld a, ld b){
| ^~
a.cc:22:3: error: 'ld' does not name a type
22 | ld x,y,z;
| ^~
a.cc:24:11: error: expected ')' before 'x'
24 | point(ld x,ld y,ld z) : x(x) , y(y), z(z){}
| ~ ^~
| )
a.cc: In member function 'point point::operator+(point)':
a.cc:27:22: error: 'x' was not declared in this scope
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
a.cc:27:26: error: 'struct point' has no member named 'x'
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
a.cc:27:18: error: 'add' was not declared in this scope; did you mean 'fadd'?
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^~~
| fadd
a.cc:27:34: error: 'y' was not declared in this scope; did you mean 'yn'?
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
| yn
a.cc:27:38: error: 'struct point' has no member named 'y'
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
a.cc:27:45: error: 'z' was not declared in this scope
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
a.cc:27:49: error: 'struct point' has no member named 'z'
27 | return point(add(x,p.x), add(y,p.y),add(z,p.z));
| ^
a.cc: In member function 'point point::operator-(point)':
a.cc:31:22: error: 'x' was not declared in this scope
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
a.cc:31:27: error: 'struct point' has no member named 'x'
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
a.cc:31:18: error: 'add' was not declared in this scope; did you mean 'fadd'?
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^~~
| fadd
a.cc:31:35: error: 'y' was not declared in this scope; did you mean 'yn'?
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
| yn
a.cc:31:40: error: 'struct point' has no member named 'y'
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
a.cc:31:47: error: 'z' was not declared in this scope
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
a.cc:31:52: error: 'struct point' has no member named 'z'
31 | return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
| ^
a.cc: At global scope:
a.cc:36:1: error: 'ld' does not name a type
36 | ld dist(point a,point b){
| ^~
a.cc:40:1: error: 'ld' does not name a type
40 | ld tetrahedra_volume(ld a,ld b,ld c,ld x,ld y,ld z){
| ^~
a.cc:53:1: error: 'ld' does not name a type
53 | ld tetrahedra_volume(point A,point B,point C,point D){
| ^~
a.cc: In function 'int main()':
a.cc:64:12: error: 'struct point' has no member named 'x'
64 | cin >> P.x >> P.y >> P.z;
| ^
a.cc:64:19: error: 'struct point' has no member named 'y'
64 | cin >> P.x >> P.y >> P.z;
| ^
a.cc:64:26: error: 'struct point' has no member named 'z'
64 | cin >> P.x >> P.y >> P.z;
| ^
a.cc:65:12: error: 'struct point' has no member named 'x'
65 | cin >> Q.x >> Q.y >> Q.z;
| ^
a.cc:65:19: error: 'struct point' has no member named 'y'
65 | cin >> Q.x >> Q.y >> Q.z;
| ^
a.cc:65:26: error: 'struct point' has no member named 'z'
65 | cin >> Q.x >> Q.y >> Q.z;
| ^
a.cc:66:12: error: 'struct point' has no member named 'x'
66 | cin >> A.x >> A.y >> A.z;
| ^
a.cc:66:19: error: 'struct point' has no member named 'y'
66 | cin >> A.x >> A.y >> A.z;
| ^
a.cc:66:26: error: 'struct point' has no member named 'z'
66 | cin >> A.x >> A.y >> A.z;
| ^
a.cc:67:12: error: 'struct point' has no member named 'x'
67 | cin >> B.x >> B.y >> B.z;
| ^
a.cc:67:19: error: 'struct point' has no member named 'y'
67 | cin >> B.x >> B.y >> B.z;
| ^
a.cc:67:26: error: 'struct point' has no member named 'z'
67 | cin >> B.x >> B.y >> B.z;
| ^
a.cc:68:12: error: 'struct point' has no member named 'x'
68 | cin >> C.x >> C.y >> C.z;
| ^
a.cc:68:19: error: 'struct point' has no member named 'y'
68 | cin >> C.x >> C.y >> C.z;
| ^
a.cc:68:26: error: 'struct point' has no member named 'z'
68 | cin >> C.x >> C.y >> C.z;
| ^
a.cc:70:3: error: 'ld' was not declared in this scope
70 | ld res1=tetrahedra_volume(A,C,P,Q);
| ^~
a.cc:71:5: error: expected ';' before 'res2'
71 | ld res2=tetrahedra_volume(B,C,P,Q);
| ^~~~~
| ;
a.cc:72:5: error: expected ';' before 'res3'
72 | ld res3=tetrahedra_volume(A,B,P,Q);
| ^~~~~
| ;
a.cc:73:6: error: 'res1' was not declared in this scope
73 | if(res1==-1 || res2==-1 || res3==-1){
| ^~~~
a.cc:73:18: error: 'res2' was not declared in this scope
73 | if(res1==-1 || res2==-1 || res3==-1){
| ^~~~
a.cc:73:30: error: 'res3' was not declared in this scope
73 | if(res1==-1 || res2==-1 || res3==-1){
| ^~~~
a.cc:78:5: error: expected ';' before 'res4'
78 | ld res4=tetrahedra_volume(A,B,C,P);
| ^~~~~
| ;
a.cc:79:5: error: expected ';' before 'res5'
79 | ld res5=tetrahedra_volume(A,B,C,Q);
| ^~~~~
| ;
a.cc:81:6: error: 'res5' was not declared in this scope
81 | if(res5==-1)cout << "MISS" << endl;
| ^~~~
a.cc:82:16: error: 'res1' was not declared in this scope
82 | else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
| ^~~~
a.cc:82:21: error: 'res2' was not declared in this scope
82 | else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
| ^~~~
a.cc:82:26: error: 'res3' was not declared in this scope
82 | else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
| ^~~~
a.cc:82:33: error: 'res4' was not declared in this scope
82 | else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
| ^~~~
a.cc:82:45: error: 'EPS' was not declared in this scope
82 | else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
| ^~~
|
s821505129 | p00115 | C++ | #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#include <quadmath.h>
using namespace std;
typedef __float128 ld;
ld EPS = 1e-20;
ld add(ld a, ld b){
if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
return a+b;
}
struct point{
ld x,y,z;
point(){}
point(ld x,ld y,ld z) : x(x) , y(y), z(z){}
point operator + (point p){
return point(add(x,p.x), add(y,p.y),add(z,p.z));
}
point operator - (point p){
return point(add(x,-p.x), add(y,-p.y),add(z,-p.z));
}
};
ld dist(point a,point b){
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
}
ld tetrahedra_volume(ld a,ld b,ld c,ld x,ld y,ld z){
#define sqr(x) ((x)*(x))
ld tv=sqr(a*x)*(sqr(b)+sqr(c)-sqr(a)+sqr(y)+sqr(z)-sqr(x))
+sqr(b*y)*(sqr(c)+sqr(a)-sqr(b)+sqr(z)+sqr(x)-sqr(y))
+sqr(c*z)*(sqr(a)+sqr(b)-sqr(c)+sqr(x)+sqr(y)-sqr(z))
-sqr(a*y*z)-sqr(b*z*x)-sqr(c*x*y)-sqr(a*b*c);
ld V=sqrt(tv/144.0);
if(V!=V)return -1;
return sqrt(tv/144.0);
#undef sqr
}
ld tetrahedra_volume(point A,point B,point C,point D){
ld a=dist(B,C),b=dist(C,A),c=dist(A,B);
ld d=dist(D,A),e=dist(D,B),f=dist(D,C);
ld V=tetrahedra_volume(a,b,c,d,e,f);
if(V<0)return -1;
return V;
}
int main(void){
point P,Q,A,B,C;
cin >> P.x >> P.y >> P.z;
cin >> Q.x >> Q.y >> Q.z;
cin >> A.x >> A.y >> A.z;
cin >> B.x >> B.y >> B.z;
cin >> C.x >> C.y >> C.z;
ld res1=tetrahedra_volume(A,C,P,Q);
ld res2=tetrahedra_volume(B,C,P,Q);
ld res3=tetrahedra_volume(A,B,P,Q);
if(res1==-1 || res2==-1 || res3==-1){
cout << "MISS" << endl;
return 0;
}
ld res4=tetrahedra_volume(A,B,C,P);
ld res5=tetrahedra_volume(A,B,C,Q);
if(res5==-1)cout << "MISS" << endl;
else if(abs((res1+res2+res3)-(res4+res5))<EPS)cout << "MISS" << endl;
else cout << "HIT" << endl;
return 0;
} | a.cc: In function 'ld dist(point, point)':
a.cc:37:18: error: call of overloaded 'pow(ld, int)' is ambiguous
37 | return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
| ~~~^~~~~~~~~~~
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/bits/requires_hosted.h:31,
from /usr/include/c++/14/cmath:41,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
| ^~~~~~~~~~~~~~
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
380 | pow(long double __x, long double __y)
| ^~~
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
376 | pow(float __x, float __y)
| ^~~
a.cc:37:33: error: call of overloaded 'pow(ld, int)' is ambiguous
37 | return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
| ~~~^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
| ^~~~~~~~~~~~~~
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
380 | pow(long double __x, long double __y)
| ^~~
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
376 | pow(float __x, float __y)
| ^~~
a.cc:37:48: error: call of overloaded 'pow(ld, int)' is ambiguous
37 | return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2)+pow(a.z-b.z,2));
| ~~~^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
| ^~~~~~~~~~~~~~
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
380 | pow(long double __x, long double __y)
| ^~~
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
376 | pow(float __x, float __y)
| ^~~
a.cc: In function 'ld tetrahedra_volume(ld, ld, ld, ld, ld, ld)':
a.cc:47:13: error: call of overloaded 'sqrt(ld)' is ambiguous
47 | ld V=sqrt(tv/144.0);
| ~~~~^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate: 'double sqrt(double)'
176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
| ^~~~~~~~~~
/usr/include/c++/14/cmath:446:3: note: candidate: 'constexpr long double std::sqrt(long double)'
446 | sqrt(long double __x)
| ^~~~
/usr/include/c++/14/cmath:442:3: note: candidate: 'constexpr float std::sqrt(float)'
442 | sqrt(float __x)
| ^~~~
a.cc:49:15: error: call of overloaded 'sqrt(ld)' is ambiguous
49 | return sqrt(tv/144.0);
| ~~~~^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:176:1: note: candidate: 'double sqrt(double)'
176 | __MATHCALL (sqrt,, (_Mdouble_ __x));
| ^~~~~~~~~~
/usr/include/c++/14/cmath:446:3: note: candidate: 'constexpr long double std::sqrt(long double)'
446 | sqrt(long double __x)
| ^~~~
/usr/include/c++/14/cmath:442:3: note: candidate: 'constexpr float std::sqrt(float)'
442 | sqrt(float __x)
| ^~~~
a.cc: In function 'int main()':
a.cc:64:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'ld' {aka '__float128'})
64 | cin >> P.x >> P.y >> P.z;
| ~~~ ^~ ~~~
| | |
| | ld {aka __float128}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:3:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:64:12: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'ld' {aka '__float128'}
64 | cin >> P.x >> P.y >> P.z;
| ~~^
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>( |
s038498254 | p00115 | C++ | #include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-7)
#define equals(a,b) (fabs((a)-(b))<EPS)
using namespace std;
//作成中 どれもVirifyしてない
class Point3d{
public:
double x,y,z;
Point3d(double x=0,double y=0,double z=0):x(x),y(y),z(z){}
Point3d operator + (const Point3d& a){
return Point3d(x+a.x,y+a.y,z+a.z);
}
Point3d operator - (const Point3d& a){
return Point3d(x-a.x,y-a.y,z-a.z);
}
Point3d operator * (const double& d){
return Point3d(x*d,y*d,z*d);
}
Point3d operator / (const double& d){
return Point3d(x/d,y/d,z/d);
}
bool operator < (const Point3d& p)const{
return !equals(x,p.x)?x<p.x:((!equals(y,p.y))?y<p.y:z<p.z);
}
bool operator == (const Point3d& p)const{
return equals(x,p.x) && equals(y,p.y) && equals(z,p.z);
}
};
struct Segment3d{
Point3d p[2];
Segment3d(Point3d p1=Point3d(),Point3d p2=Point3d()){
p[0] = p1, p[1] = p2;
}
bool operator == (const Segment3d& seg)const{
return p[0] == seg.p[0] && p[1] == seg.p[1];
}
};
typedef Point3d Vector3d;
typedef Segment3d Line3d;
ostream& operator << (ostream& os,const Point3d& p){
os << "(" << p.x << "," << p.y << "," << p.z << ")";
}
ostream& operator << (ostream& os,const Segment3d& seg){
os << "(" << seg.p[0] << "," << seg.p[1] << ")";
}
double dot(const Point3d& a,const Point3d& b){
return a.x*b.x + a.y*b.y + a.z*b.z;
}
Vector3d cross(const Point3d& a,const Point3d& b){
return Vector3d(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}
inline double norm(const Point3d &p){
return p.x*p.x + p.y*p.y + p.z*p.z;
}
inline double abs(const Point3d &p){
return sqrt(norm(p));
}
inline double toRad(double theta){
return theta * M_PI / 180.0;
}
bool point_on_the_triangle3d(Point3d tri1,Point3d tri2,Point3d tri3,Point3d p){
Vector3d v1 = tri2 - tri1;
Vector3d v2 = tri3 - tri2;
Vector3d v3 = tri1 - tri3;
/*
bool res = ( cross(v1,p-tri1).z >= 0 ); //線分上にある場合もtrue, 線分上にある場合は駄目とするならば > 0 とすること
bool res2 = ( cross(v2,p-tri2).z >= 0 );
bool res3 = ( cross(v3,p-tri3).z >= 0 );
return res == res2 && res2 == res3;
*/
//Vector3d cp[3] = { cross(v1,p-tri2), cross(v2,p-tri3), cross(v3,p-tri1) };
Vector3d cp[3] = { cross(v1,p-tri1), cross(v2,p-tri2), cross(v3,p-tri3) };
//cout << cp[0] << " | " << cp[1] << " | " << cp[2] << endl;
double d1 = dot(cp[0],cp[1]);
double d2 = dot(cp[0],cp[2]);
if( d1 >= 0 && d2 >= 0 ) return true;
return false;
}
bool on_line3d(Line3d line,Point3d p){
cout << cross(p-line.p[0],line.p[1]-line.p[0]) << endl;
return equals(abs(cross(p-line.p[0],line.p[1]-line.p[0])),0);
}
bool on_segment3d(Segment3d seg,Point3d p){
double dist[3] = { abs(seg.p[1]-seg.p[0]), abs(p-seg.p[0]), abs(p-seg.p[1]) };
cout << dist[0] << " " << dist[1] << " " << dist[2] << endl;
return on_line3d(seg,p) && equals(dist[0],dist[1]+dist[2]);
}
inline Point3d rotateX(Point3d p,double rad){
return Point3d(p.x,p.y*cos(rad)-p.z*sin(rad),p.y*sin(rad)+p.z*cos(rad));
}
inline Point3d rorateY(Point3d p,double rad){
return Point3d(p.x*cos(rad)+p.z*sin(rad),p.y,-p.x*sin(rad)+p.z*cos(rad));
}
inline Point3d rorateZ(Point3d p,double rad){
return Point3d(p.x*cos(rad)-p.y*sin(rad),p.x*sin(rad)+p.y*cos(rad),p.z);
}
inline Point3d rotateEuler(Point3d p,double alpha,double beta,double gamma){
return Point3d( (cos(alpha)*cos(beta)*cos(gamma)-sin(alpha)*sin(gamma)) * p.x + (-cos(alpha)*cos(beta)*sin(gamma)-sin(alpha)*cos(gamma)) * p.y + (cos(alpha)*sin(beta)) * p.z,
(sin(alpha)*cos(beta)*cos(gamma)+cos(alpha)*sin(gamma)) * p.x + (-sin(alpha)*cos(beta)*sin(gamma)+cos(alpha)*cos(gamma)) * p.y + (sin(alpha)*sin(beta)) * p.z,
(-sin(beta)*cos(gamma)) * p.x + (sin(beta)*sin(gamma)) * p.y + (cos(beta)) * p.z);
}
inline Point3d rotateRollPitchYaw(Point3d p,double roll,double pitch,double yaw){
return Point3d( ( cos(roll) * cos(pitch) ) * p.x + ( cos(roll) * sin(pitch) * sin(yaw) - sin(roll) * cos(yaw) ) * p.y + ( cos(roll) * sin(pitch) * cos(yaw) + sin(roll) * sin(yaw) ) * p.z,
( sin(roll) * cos(pitch) ) * p.x + ( sin(roll) * sin(pitch) * sin(yaw) + cos(roll) * cos(yaw) ) * p.y + ( sin(roll) * sin(pitch) * cos(yaw) - cos(roll) * sin(yaw) ) * p.z,
-sin(pitch) * p.x + cos(pitch) * sin(yaw) * p.y + cos(pitch) * cos(yaw) * p.z);
}
class Plane3d{
public:
Point3d normal_vector; //法線ベクトル
double d; // 平面方程式 normal_vector.x * x + normal_vector.y * y + normal_vector.z * z + d = 0
Plane3d(Point3d normal_vector=Point3d(),double d=0):normal_vector(normal_vector),d(d){}
Plane3d(Vector3d a,Vector3d b,Vector3d c){
Vector3d v1 = b - a;
Vector3d v2 = c - a;
Vector3d tmp = cross(v1,v2);
normal_vector = tmp / abs(tmp);
set_d(a);
}
//法線ベクトルnormal_vectorと平面上の1点からdを計算する
void set_d(Point3d p){
d = dot(normal_vector,p);
}
//平面と点pの距離を求める
double distanceP(Point3d p){
Point3d a = normal_vector * d;//平面上の適当な点をつくる
return abs( dot(p-a,normal_vector) );
}
//平面上でもっとも点pと近い点を求める
Point3d nearest_point(Point3d p){
Point3d a = normal_vector * d;
return p - ( normal_vector * dot(p-a,normal_vector) );
}
//平面と線分が交差するか
bool intersectS(Segment3d seg){
Point3d a = normal_vector * d;
double res1 = dot(a-seg.p[0],normal_vector);
double res2 = dot(a-seg.p[1],normal_vector);
if( res1 > res2 ) swap(res1,res2);
//cout << res1 << " < " << res2 << endl;
if( res1 <= 0 && res2 >= 0 ) return true;
return false;
}
//平面と線分の交点を求める
Point3d crosspointS(Segment3d seg){
Point3d a = normal_vector * d;
double dot_p0a = fabs(dot( seg.p[0]-a,normal_vector ));
double dot_p1a = fabs(dot( seg.p[1]-a,normal_vector ));
if( dot_p0a+dot_p1a == 0 ) return seg.p[0];
return seg.p[0] + ( seg.p[1] - seg.p[0] ) * ( dot_p0a / ( dot_p0a + dot_p1a ) );
}
};
Point3d crosspointTS(Point3d tri1,Point3d tri2,Point3d tri3,Segment3d seg){
Vector3d normal_vector = cross(tri2-tri1,tri3-tri1);
normal_vector = normal_vector / abs( normal_vector );
double dist1 = dot(seg.p[1]-seg.p[0],normal_vector);
double dist2 = dot(tri1-seg.p[0],normal_vector);
double t = dist2 / dist1;
Point3d e = (seg.p[1]-seg.p[0]) / abs(seg.p[1]-seg.p[0]);
return seg.p[0] + e * t;
}
const string Y="HIT", N = "MISS";
int main(){
/*
Point3d p(12,51,9);
double a = toRad(121), b = toRad(31), c = toRad(19);
cout << rotateEuler(p,a,b,c) << endl;
cout << rotateRollPitchYaw(p,a,b,c) << endl;
*/
/*
Point3d a(0,0,0);
Point3d b(10,0,0);
Point3d c(0,10,0);
Point3d p(1,1,10);
cout << point_on_the_triangle3d(a,b,c,p) << endl;
*/
/*
Segment3d seg(Point3d(0,0,0),Point3d(10,0,0));
Point3d p(4,0,0);
cout << on_segment3d(seg,p) << endl;
*/
Point3d tri[3],S,G;
cin >> S.x >> S.y >> S.z;
cin >> G.x >> G.y >> G.z;
rep(i,3)cin >> tri[i].x >> tri[i].y >> tri[i].z;
bool error1 = false, erro2 = false;
rep(i,3){
if( S == tri[i] )error1 = true;
if( G == tri[i] )error2 = true;
}
if( error1 ){
cout << N << endl;
return 0;
}
if( error2 ){
cout << Y << endl;
return 0;
}
Plane3d plane(tri[0],tri[1],tri[2]);
//cout << plane.normal_vector.x << "x + " << plane.normal_vector.y << "y + " << plane.normal_vector.z << "z + " << plane.d << endl;
//cout << plane.normal_vector << endl;
//cout << "d = " << plane.d << endl;
//cout << "a = " << plane.normal_vector * plane.d << endl;
Segment3d seg(S,G);
if( !plane.intersectS(seg) ){
cout << Y << endl;
return 0;
}
Point3d cp = /*crosspointTS(tri[0],tri[1],tri[2],Segment3d(S,G));*/plane.crosspointS(seg);
//cout << cp << " " << plane.crosspointS(seg)<< endl;
//cout << "cp = " << cp << endl;
cout << (point_on_the_triangle3d(tri[0],tri[1],tri[2],cp)?N:Y) << endl;
return 0;
} | a.cc: In function 'std::ostream& operator<<(std::ostream&, const Point3d&)':
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, const Segment3d&)':
a.cc:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
63 | }
| ^
a.cc: In function 'int main()':
a.cc:231:22: error: 'error2' was not declared in this scope; did you mean 'erro2'?
231 | if( G == tri[i] )error2 = true;
| ^~~~~~
| erro2
a.cc:238:7: error: 'error2' was not declared in this scope; did you mean 'erro2'?
238 | if( error2 ){
| ^~~~~~
| erro2
|
s186782081 | p00115 | C++ | #include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-7)
#define equals(a,b) (fabs((a)-(b))<EPS)
using namespace std;
//作成中 どれもVirifyしてない
class Point3d{
public:
double x,y,z;
Point3d(double x=0,double y=0,double z=0):x(x),y(y),z(z){}
Point3d operator + (const Point3d& a){
return Point3d(x+a.x,y+a.y,z+a.z);
}
Point3d operator - (const Point3d& a){
return Point3d(x-a.x,y-a.y,z-a.z);
}
Point3d operator * (const double& d){
return Point3d(x*d,y*d,z*d);
}
Point3d operator / (const double& d){
return Point3d(x/d,y/d,z/d);
}
bool operator < (const Point3d& p)const{
return !equals(x,p.x)?x<p.x:((!equals(y,p.y))?y<p.y:z<p.z);
}
bool operator == (const Point3d& p)const{
return equals(x,p.x) && equals(y,p.y) && equals(z,p.z);
}
};
struct Segment3d{
Point3d p[2];
Segment3d(Point3d p1=Point3d(),Point3d p2=Point3d()){
p[0] = p1, p[1] = p2;
}
bool operator == (const Segment3d& seg)const{
return p[0] == seg.p[0] && p[1] == seg.p[1];
}
};
typedef Point3d Vector3d;
typedef Segment3d Line3d;
ostream& operator << (ostream& os,const Point3d& p){
os << "(" << p.x << "," << p.y << "," << p.z << ")";
}
ostream& operator << (ostream& os,const Segment3d& seg){
os << "(" << seg.p[0] << "," << seg.p[1] << ")";
}
double dot(const Point3d& a,const Point3d& b){
return a.x*b.x + a.y*b.y + a.z*b.z;
}
Vector3d cross(const Point3d& a,const Point3d& b){
return Vector3d(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}
inline double norm(const Point3d &p){
return p.x*p.x + p.y*p.y + p.z*p.z;
}
inline double abs(const Point3d &p){
return sqrt(norm(p));
}
inline double toRad(double theta){
return theta * M_PI / 180.0;
}
bool on_line3d(Line3d line,Point3d p){
cout << cross(p-line.p[0],line.p[1]-line.p[0]) << endl;
return equals(abs(cross(p-line.p[0],line.p[1]-line.p[0])),0);
}
bool on_segment3d(Segment3d seg,Point3d p){
if( !on_line3d(seg,p) ) return false;
double dist[3] = { abs(seg.p[1]-seg.p[0]), abs(p-seg.p[0]), abs(p-seg.p[1]) };
cout << dist[0] << " " << dist[1] << " " << dist[2] << endl;
return on_line3d(seg,p) && equals(dist[0],dist[1]+dist[2]);
}
bool point_on_the_triangle3d(Point3d tri1,Point3d tri2,Point3d tri3,Point3d p){
if( on_segment3d(Segment(tri1,tri2),p) ) return true;
if( on_segment3d(Segment(tri2,tri3),p) ) return true;
if( on_segment3d(Segment(tri3,tri1),p) ) return true;
Vector3d v1 = tri2 - tri1;
Vector3d v2 = tri3 - tri2;
Vector3d v3 = tri1 - tri3;
/*
bool res = ( cross(v1,p-tri1).z >= 0 ); //線分上にある場合もtrue, 線分上にある場合は駄目とするならば > 0 とすること
bool res2 = ( cross(v2,p-tri2).z >= 0 );
bool res3 = ( cross(v3,p-tri3).z >= 0 );
return res == res2 && res2 == res3;
*/
//Vector3d cp[3] = { cross(v1,p-tri2), cross(v2,p-tri3), cross(v3,p-tri1) };
Vector3d cp[3] = { cross(v1,p-tri1), cross(v2,p-tri2), cross(v3,p-tri3) };
//cout << cp[0] << " | " << cp[1] << " | " << cp[2] << endl;
double d1 = dot(cp[0],cp[1]);
double d2 = dot(cp[0],cp[2]);
if( d1 >= 0 && d2 >= 0 ) return true;
return false;
}
inline Point3d rotateX(Point3d p,double rad){
return Point3d(p.x,p.y*cos(rad)-p.z*sin(rad),p.y*sin(rad)+p.z*cos(rad));
}
inline Point3d rorateY(Point3d p,double rad){
return Point3d(p.x*cos(rad)+p.z*sin(rad),p.y,-p.x*sin(rad)+p.z*cos(rad));
}
inline Point3d rorateZ(Point3d p,double rad){
return Point3d(p.x*cos(rad)-p.y*sin(rad),p.x*sin(rad)+p.y*cos(rad),p.z);
}
inline Point3d rotateEuler(Point3d p,double alpha,double beta,double gamma){
return Point3d( (cos(alpha)*cos(beta)*cos(gamma)-sin(alpha)*sin(gamma)) * p.x + (-cos(alpha)*cos(beta)*sin(gamma)-sin(alpha)*cos(gamma)) * p.y + (cos(alpha)*sin(beta)) * p.z,
(sin(alpha)*cos(beta)*cos(gamma)+cos(alpha)*sin(gamma)) * p.x + (-sin(alpha)*cos(beta)*sin(gamma)+cos(alpha)*cos(gamma)) * p.y + (sin(alpha)*sin(beta)) * p.z,
(-sin(beta)*cos(gamma)) * p.x + (sin(beta)*sin(gamma)) * p.y + (cos(beta)) * p.z);
}
inline Point3d rotateRollPitchYaw(Point3d p,double roll,double pitch,double yaw){
return Point3d( ( cos(roll) * cos(pitch) ) * p.x + ( cos(roll) * sin(pitch) * sin(yaw) - sin(roll) * cos(yaw) ) * p.y + ( cos(roll) * sin(pitch) * cos(yaw) + sin(roll) * sin(yaw) ) * p.z,
( sin(roll) * cos(pitch) ) * p.x + ( sin(roll) * sin(pitch) * sin(yaw) + cos(roll) * cos(yaw) ) * p.y + ( sin(roll) * sin(pitch) * cos(yaw) - cos(roll) * sin(yaw) ) * p.z,
-sin(pitch) * p.x + cos(pitch) * sin(yaw) * p.y + cos(pitch) * cos(yaw) * p.z);
}
class Plane3d{
public:
Point3d normal_vector; //法線ベクトル
double d; // 平面方程式 normal_vector.x * x + normal_vector.y * y + normal_vector.z * z + d = 0
Plane3d(Point3d normal_vector=Point3d(),double d=0):normal_vector(normal_vector),d(d){}
Plane3d(Vector3d a,Vector3d b,Vector3d c){
Vector3d v1 = b - a;
Vector3d v2 = c - a;
Vector3d tmp = cross(v1,v2);
normal_vector = tmp / abs(tmp);
set_d(a);
}
//法線ベクトルnormal_vectorと平面上の1点からdを計算する
void set_d(Point3d p){
d = dot(normal_vector,p);
}
//平面と点pの距離を求める
double distanceP(Point3d p){
Point3d a = normal_vector * d;//平面上の適当な点をつくる
return abs( dot(p-a,normal_vector) );
}
//平面上でもっとも点pと近い点を求める
Point3d nearest_point(Point3d p){
Point3d a = normal_vector * d;
return p - ( normal_vector * dot(p-a,normal_vector) );
}
//平面と線分が交差するか
bool intersectS(Segment3d seg){
Point3d a = normal_vector * d;
double res1 = dot(a-seg.p[0],normal_vector);
double res2 = dot(a-seg.p[1],normal_vector);
if( res1 > res2 ) swap(res1,res2);
//cout << res1 << " < " << res2 << endl;
if( res1 <= 0 && res2 >= 0 ) return true;
return false;
}
//平面と線分の交点を求める
Point3d crosspointS(Segment3d seg){
Point3d a = normal_vector * d;
double dot_p0a = fabs(dot( seg.p[0]-a,normal_vector ));
double dot_p1a = fabs(dot( seg.p[1]-a,normal_vector ));
if( dot_p0a+dot_p1a == 0 ) return seg.p[0];
return seg.p[0] + ( seg.p[1] - seg.p[0] ) * ( dot_p0a / ( dot_p0a + dot_p1a ) );
}
};
Point3d crosspointTS(Point3d tri1,Point3d tri2,Point3d tri3,Segment3d seg){
Vector3d normal_vector = cross(tri2-tri1,tri3-tri1);
normal_vector = normal_vector / abs( normal_vector );
double dist1 = dot(seg.p[1]-seg.p[0],normal_vector);
double dist2 = dot(tri1-seg.p[0],normal_vector);
double t = dist2 / dist1;
Point3d e = (seg.p[1]-seg.p[0]) / abs(seg.p[1]-seg.p[0]);
return seg.p[0] + e * t;
}
const string Y="HIT", N = "MISS";
int main(){
/*
Point3d p(12,51,9);
double a = toRad(121), b = toRad(31), c = toRad(19);
cout << rotateEuler(p,a,b,c) << endl;
cout << rotateRollPitchYaw(p,a,b,c) << endl;
*/
/*
Point3d a(0,0,0);
Point3d b(10,0,0);
Point3d c(0,10,0);
Point3d p(1,1,10);
cout << point_on_the_triangle3d(a,b,c,p) << endl;
*/
/*
Segment3d seg(Point3d(0,0,0),Point3d(10,0,0));
Point3d p(4,0,0);
cout << on_segment3d(seg,p) << endl;
*/
Point3d tri[3],S,G;
cin >> S.x >> S.y >> S.z;
cin >> G.x >> G.y >> G.z;
rep(i,3)cin >> tri[i].x >> tri[i].y >> tri[i].z;
/*
bool error1 = false, error2 = false;
rep(i,3){
if( S == tri[i] )error1 = true;
if( G == tri[i] )error2 = true;
}
if( error1 ){
cout << N << endl;
return 0;
}
if( error2 ){
cout << N << endl;
return 0;
}
*/
Plane3d plane(tri[0],tri[1],tri[2]);
/*
double tmp = fabs(dot(G-S,plane.normal_vector));
if( equals(tmp,0) ){
cout << N << endl;
return 0;
}
*/
//cout << plane.normal_vector.x << "x + " << plane.normal_vector.y << "y + " << plane.normal_vector.z << "z + " << plane.d << endl;
//cout << plane.normal_vector << endl;
//cout << "d = " << plane.d << endl;
//cout << "a = " << plane.normal_vector * plane.d << endl;
Segment3d seg(S,G);
if( !plane.intersectS(seg) ){
cout << Y << endl;
return 0;
}
Point3d cp = /*crosspointTS(tri[0],tri[1],tri[2],Segment3d(S,G));*/plane.crosspointS(seg);
//cout << cp << " " << plane.crosspointS(seg)<< endl;
//cout << "cp = " << cp << endl;
cout << (point_on_the_triangle3d(tri[0],tri[1],tri[2],cp)?N:Y) << endl;
return 0;
} | a.cc: In function 'std::ostream& operator<<(std::ostream&, const Point3d&)':
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, const Segment3d&)':
a.cc:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
63 | }
| ^
a.cc: In function 'bool point_on_the_triangle3d(Point3d, Point3d, Point3d, Point3d)':
a.cc:101:20: error: 'Segment' was not declared in this scope; did you mean 'Segment3d'?
101 | if( on_segment3d(Segment(tri1,tri2),p) ) return true;
| ^~~~~~~
| Segment3d
a.cc:102:20: error: 'Segment' was not declared in this scope; did you mean 'Segment3d'?
102 | if( on_segment3d(Segment(tri2,tri3),p) ) return true;
| ^~~~~~~
| Segment3d
a.cc:103:20: error: 'Segment' was not declared in this scope; did you mean 'Segment3d'?
103 | if( on_segment3d(Segment(tri3,tri1),p) ) return true;
| ^~~~~~~
| Segment3d
|
s254125315 | p00116 | Java | import java.util.Scanner;
public class a {
public static void main(String[] a) {
Scanner s = new Scanner(System.in);
for (;;) {
int h = s.nextInt() + 1;
int w = s.nextInt() + 1;
if (h * w == 1)
break;
int[][] l = new int[h][w];
int[][] t = new int[h][w];
int m = 0;
for (int i = 1; i < h; i++) {
char[] c = s.next().toCharArray();
for (int j = 1; j < w; j++) {
if (c[j - 1] == '.')
l[i][j] = l[i][j - 1] + 1;
t[i][j] = l[i][j];
for (int k = 0; k < i; k++) {
t[k][j] = Math.min(t[k][j], l[i][j]);
m = Math.max(m, t[k][j] * (i - k + 1));
}
}
}
System.out.println(m);
}
}
}
| Main.java:3: error: class a is public, should be declared in a file named a.java
public class a {
^
1 error
|
s953873492 | p00116 | Java | /* Rectangular Seaching */
import java.io.*;
import java.util.*;
public class Main_prev{
public static void main(String args[]){
try{
new Main_prev();
}catch(IOException err){
err.printStackTrace();
}
}
public Main_prev() throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
List<Integer> Ans = new ArrayList<Integer>();
String line;
while((line = in.readLine()) != null){
String[] dst = line.split(" ");
int h = Integer.parseInt(dst[0]);
int w = Integer.parseInt(dst[1]);
if(w == 0 && h == 0){
break;
}
long t = System.currentTimeMillis();
int[][] data = new int[h][w];
Box[] box = new Box[w];
for(int j=0; j<h; j++){
line = in.readLine();
for(int i=0; i<w; i++){
if(line.substring(i, i+1).equals("*")){
data[j][i] = 0;
}
else{
data[j][i] = 1;
}
}
}
System.out.println("data read");
System.out.println(System.currentTimeMillis()-t);
t = System.currentTimeMillis();
int S = 0;
int dstS;
for(int j=0; j<h; j++){
for(int i=0; i<w; i++){
if(j==0){
if(data[j][i]==0){
box[i] = null;
}
else if(i==0){
box[i] = new Box(1, 1);
}
else{
box[i] = new Box(box[i-1], null, data, i, j);
}
}
else{
if(data[j][i]==0){
box[i] = null;
}
else if(i==0){
box[i] = new Box(null, box[i], data, i, j);
}
else{
box[i] = new Box(box[i-1], box[i], data, i, j);
}
}
if(box[i] != null){
if(S < (dstS = box[i].getMaxS())){
S = dstS;
}
}
}
}
Ans.add(S);
System.out.println("calculation");
System.out.println(System.currentTimeMillis()-t);
}
for(int i=0; i<Ans.size(); i++){
System.out.println(Ans.get(i));
}
in.close();
}
}
class Box{
List<Integer> w;
List<Integer> h;
int nLeft;
int nAbove;
int size;
public Box(){
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
nLeft = 0;
nAbove = 0;
size = 0;
}
public Box(int w, int h){
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
this.w.add(w);
this.h.add(h);
nLeft = 0;
nAbove = 0;
size = 1;
}
public Box(Box left, Box above, int[][] data, int x, int y){
this.nLeft = (left != null) ? left.nLeft+1 : 1;
this.nAbove = (above != null) ? above.nAbove+1 : 1;
int width = 0;
int height = 0;
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
if(left != null){
for(int n=0; n<left.size; n++){
if(left.h.get(n) > nAbove){
height = nAbove;
}
else{
height = left.h.get(n);
}
width = left.w.get(n)+1;
this.add(width, height);
}
}
if(above != null){
for(int n=0; n<above.size; n++){
if(above.w.get(n) > nLeft){
width = nLeft;
}
else{
width = above.w.get(n);
}
height = above.h.get(n)+1;
this.add(width, height);
}
}
if(above == null && left == null){
this.w.add(1);
this.h.add(1);
}
this.size = this.w.size();
}
public int getMaxS(){
int S = 0;
int dst;
for(int i=0; i<this.size; i++){
dst = this.w.get(i) * this.h.get(i);
if(S < dst){
S = dst;
}
}
return S;
}
public void add(int w, int h){
for(int n=0; n<this.size; n++){
if(w <= this.w.get(n) && h <= this.h.get(n)){
return;
}
}
this.w.add(w);
this.h.add(h);
size++;
}
} | Main.java:5: error: class Main_prev is public, should be declared in a file named Main_prev.java
public class Main_prev{
^
1 error
|
s612447625 | p00116 | Java | /* Rectangular Seaching */
import java.io.*;
import java.util.*;
public class Main_prev{
public static void main(String args[]){
try{
new Main_prev();
}catch(IOException err){
err.printStackTrace();
}
}
public Main_prev() throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
List<Integer> Ans = new ArrayList<Integer>();
String line;
while((line = in.readLine()) != null){
String[] dst = line.split(" ");
int h = Integer.parseInt(dst[0]);
int w = Integer.parseInt(dst[1]);
if(w == 0 && h == 0){
break;
}
int[][] data = new int[h][w];
Box[] box = new Box[w];
for(int j=0; j<h; j++){
line = in.readLine();
for(int i=0; i<w; i++){
if(line.substring(i, i+1).equals("*")){
data[j][i] = 0;
}
else{
data[j][i] = 1;
}
}
}
int S = 0;
int dstS;
for(int j=0; j<h; j++){
for(int i=0; i<w; i++){
if(j==0){
if(data[j][i]==0){
box[i] = null;
}
else if(i==0){
box[i] = new Box(1, 1);
}
else{
box[i] = new Box(box[i-1], null, data, i, j);
}
}
else{
if(data[j][i]==0){
box[i] = null;
}
else if(i==0){
box[i] = new Box(null, box[i], data, i, j);
}
else{
box[i] = new Box(box[i-1], box[i], data, i, j);
}
}
if(box[i] != null){
if(S < (dstS = box[i].getMaxS())){
S = dstS;
}
}
}
}
Ans.add(S);
}
for(int i=0; i<Ans.size(); i++){
System.out.println(Ans.get(i));
}
in.close();
}
}
class Box{
List<Integer> w;
List<Integer> h;
int nLeft;
int nAbove;
int size;
public Box(){
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
nLeft = 0;
nAbove = 0;
size = 0;
}
public Box(int w, int h){
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
this.w.add(w);
this.h.add(h);
nLeft = 0;
nAbove = 0;
size = 1;
}
public Box(Box left, Box above, int[][] data, int x, int y){
this.nLeft = (left != null) ? left.nLeft+1 : 1;
this.nAbove = (above != null) ? above.nAbove+1 : 1;
int width = 0;
int height = 0;
this.w = new ArrayList<Integer>();
this.h = new ArrayList<Integer>();
if(left != null){
for(int n=0; n<left.size; n++){
if(left.h.get(n) > nAbove){
height = nAbove;
}
else{
height = left.h.get(n);
}
width = left.w.get(n)+1;
this.add(width, height);
}
}
if(above != null){
for(int n=0; n<above.size; n++){
if(above.w.get(n) > nLeft){
width = nLeft;
}
else{
width = above.w.get(n);
}
height = above.h.get(n)+1;
this.add(width, height);
}
}
if(above == null && left == null){
this.w.add(1);
this.h.add(1);
}
this.size = this.w.size();
}
public int getMaxS(){
int S = 0;
int dst;
for(int i=0; i<this.size; i++){
dst = this.w.get(i) * this.h.get(i);
if(S < dst){
S = dst;
}
}
return S;
}
public void add(int w, int h){
for(int n=0; n<this.size; n++){
if(w <= this.w.get(n) && h <= this.h.get(n)){
return;
}
}
this.w.add(w);
this.h.add(h);
size++;
}
} | Main.java:5: error: class Main_prev is public, should be declared in a file named Main_prev.java
public class Main_prev{
^
1 error
|
s147871332 | p00116 | Java | import java.util.*;
public class Main{
Scanner sc = new Scanner(System.in);
void run(){
for(;;){int h=sc.nextInt();
int w=sc.nextInt();
if(h+w==0)
break;int[][]fl=new int[h+1][w+1];int[][]ft=new int[h+1][w+1];
int m=0;
for(int i=1;i<=h;i++){
char[]c=("*"+sc.next()).toCharArray();for(int j=1;j<=w;j++){fl[i][j]=fl[i][j-1]+1;
if(c[j]=='*')
fl[i][j] = 0;ft[i][j]=fl[i][j];for(int k=0;k<i;k++)ft[k][j]=Math.min(ft[k][j],fl[i][j]);for(int k=0;k<=i;++)m=Math.max(max,ft[k][j]*(i-k+1));
}}System.out.println(m);
}}public static void main(String[] a){
Main m=new Main();
m.run();
}
} | Main.java:13: error: illegal start of expression
fl[i][j] = 0;ft[i][j]=fl[i][j];for(int k=0;k<i;k++)ft[k][j]=Math.min(ft[k][j],fl[i][j]);for(int k=0;k<=i;++)m=Math.max(max,ft[k][j]*(i-k+1));
^
1 error
|
s524809720 | p00116 | C | #include <cstdio>
#include <stack>
#include <algorithm>
using namespace std;
struct Rectangle{ int height; int pos;};
int func(int size, int buffer[]){
stack<Rectangle> S;
int maxv = 0;
buffer[size] = 0;
for(int i = 0; i <= size; ++i){
Rectangle rect;
rect.height = buffer[i];
rect.pos = i;
if(S.empty()){
S.push(rect);
}else{
if(S.top().height < rect.height){
S.push(rect);
}else if(S.top().height > rect.height){
int target = i;
while(!S.empty() && S.top().height >= rect.height){
Rectangle pre = S.top(); S.pop();
int area = pre.height * (i - pre.pos);
maxv = max(maxv, area);
target = pre.pos;
}
rect.pos = target;
S.push(rect);
}
}
}
return maxv;
}
int main(){
int H, W, map[501][501], i, j;
char in[501];
while(scanf("%d%d", &H, &W) && H && W){
for(i = 0; i < H; ++i){
scanf("%s", in);
for(j = 0; j < W; ++j) map[i][j] = in[j] == '*' ? 0 : 1;
}
for(i = 1; i < H; ++i)
for(j = 0; j < W; ++j)
if(map[i][j])
map[i][j] = map[i - 1][j] + 1;
int maxv = 0;
for(i = 0; i < H; ++i)
maxv = max(maxv, func(W, map[i]));
printf("%d\n", maxv);
}
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s837208976 | p00116 | C | #include<stdio.h>
#define MAX 501
#define BLOCK '*'
#define DOT '.'
void input( char cel[][ MAX ], short H, short W );
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp );
void judge( long S[] );
void output( long S );
int main()
{
short H = 0;
short W = 0;
while(1)
{
long S = 0;
char cel[ MAX ][ MAX ] = {0};
scanf("%hd %hd", &H, &W );
switch( H )
{
case 0:
return 0;
}
input( cel, H, W );
search( cel, 0, H - 1, 0, W - 1, &S );
output( S );
}
//return 0;
}
void input( char cel[][ MAX ], short H, short W )
{
short num1 = 0;
scanf(" ");
for( num1 = 0; num1 < H; num1++ )
{
gets( cel[ num1 ] );
}
return;
}
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
{
short num1 = 0;
short num2 = 0;
short num3 = 0;
short loop1 = 0;
short loop2 = 0;
long count = 0;
long Sa = *Sp;
long S[4] = {0};
for( num1 = ( down + up + 1 ) / 2, loop1 = up; loop1 <= down; num1++, loop1++ )
{
if( num1 > down )
{
num1 = up;
}
for( num2 = ( right + left + 1 ) / 2, loop2 = left; loop2 <= right; num2++, loop2++ )
{
if( num2 > right )
{
num2 = left;
}
if( cel[ num1 ][ num2 ] == BLOCK )
{
S[0] = ( right - num2 ) * ( down - up + 1 );
S[1] = ( right - left + 1 ) * ( down - num1 );
S[2] = ( num2 - left ) * ( down - up + 1 );
S[3] = ( right - left + 1 ) * ( num1 - up );
judge( S );
for( num3 = 0; num3 < 4; num3++ )
{
if( S[ num3 ] == ( right - num2 ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 + 1 <= right ))
{
search( cel, up, down, num2 + 1, right, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( down - num1 ))
{
if(( *Sp < S[ num3 ] ) && ( num1 + 1 <= down ))
{
search( cel, num1 + 1, down, left, right, Sp, Cp );
}
}
if( S[ num3 ] == ( num2 - left ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 - 1 >= left ))
{
search( cel, up, down, left, num2 - 1, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( num1 - up ))
{
if(( *Sp < S[ num3 ] ) && ( num1 - 1 >= up ))
{
search( cel, up, num1 - 1, left, right, Sp, Cp );
}
}
}
return;
}
else if( cel[ num1 ][ num2 ] == DOT)
{
count++;
}
}
}
if( *Sp < count )
{
*Sp = count;
}
return;
}
void judge( long S[] )
{
long temp = 0;
short num1 = 0;
short num2 = 0;
for( num1 = 0; num1 < 4; num1++ )
{
for( num2 = 0 ; num2 < 3; num2++ )
{
if( S[ num2 ] > S[ num2 + 1] )
{
temp = S[ num2 ];
S[ num2 ] = S[ num2 + 1 ];
S[ num2 + 1 ] = temp;
}
}
}
return;
}
void output( long S )
{
printf("%ld\n", S );
return;
} | main.c: In function 'input':
main.c:48:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
48 | gets( cel[ num1 ] );
| ^~~~
| fgets
main.c: In function 'search':
main.c:96:101: error: 'Cp' undeclared (first use in this function); did you mean 'Sp'?
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~
| Sp
main.c:96:101: note: each undeclared identifier is reported only once for each function it appears in
main.c:96:57: error: too many arguments to function 'search'
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:104:57: error: too many arguments to function 'search'
104 | search( cel, num1 + 1, down, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:112:57: error: too many arguments to function 'search'
112 | search( cel, up, down, left, num2 - 1, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:120:57: error: too many arguments to function 'search'
120 | search( cel, up, num1 - 1, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
|
s094552567 | p00116 | C | #include<stdio.h>
#define MAX 501
#define BLOCK '*'
#define DOT '.'
void input( char cel[][ MAX ], short H, short W );
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp );
void judge( long S[] );
void output( long S );
int main()
{
short H = 0;
short W = 0;
while(1)
{
long S = 0;
char cel[ MAX ][ MAX ] = {0};
scanf("%hd %hd", &H, &W );
switch( H )
{
case 0:
return 0;
}
input( cel, H, W );
search( cel, 0, H - 1, 0, W - 1, &S );
output( S );
}
//return 0;
}
void input( char cel[][ MAX ], short H, short W )
{
short num1 = 0;
scanf(" ");
for( num1 = 0; num1 < H; num1++ )
{
gets( cel[ num1 ] );
}
return;
}
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
{
short num1 = 0;
short num2 = 0;
short num3 = 0;
short loop1 = 0;
short loop2 = 0;
long count = 0;
long Sa = *Sp;
long S[4] = {0};
for( num1 = ( down + up + 1 ) / 2, loop1 = up; loop1 <= down; num1++, loop1++ )
{
if( num1 > down )
{
num1 = up;
}
for( num2 = ( right + left + 1 ) / 2, loop2 = left; loop2 <= right; num2++, loop2++ )
{
if( num2 > right )
{
num2 = left;
}
if( cel[ num1 ][ num2 ] == BLOCK )
{
S[0] = ( right - num2 ) * ( down - up + 1 );
S[1] = ( right - left + 1 ) * ( down - num1 );
S[2] = ( num2 - left ) * ( down - up + 1 );
S[3] = ( right - left + 1 ) * ( num1 - up );
judge( S );
for( num3 = 0; num3 < 4; num3++ )
{
if( S[ num3 ] == ( right - num2 ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 + 1 <= right ))
{
search( cel, up, down, num2 + 1, right, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( down - num1 ))
{
if(( *Sp < S[ num3 ] ) && ( num1 + 1 <= down ))
{
search( cel, num1 + 1, down, left, right, Sp, Cp );
}
}
if( S[ num3 ] == ( num2 - left ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 - 1 >= left ))
{
search( cel, up, down, left, num2 - 1, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( num1 - up ))
{
if(( *Sp < S[ num3 ] ) && ( num1 - 1 >= up ))
{
search( cel, up, num1 - 1, left, right, Sp, Cp );
}
}
}
return;
}
else if( cel[ num1 ][ num2 ] == DOT)
{
count++;
}
}
}
if( *Sp < count )
{
*Sp = count;
}
return;
}
void judge( long S[] )
{
long temp = 0;
short num1 = 0;
short num2 = 0;
for( num1 = 0; num1 < 4; num1++ )
{
for( num2 = 0 ; num2 < 3; num2++ )
{
if( S[ num2 ] > S[ num2 + 1] )
{
temp = S[ num2 ];
S[ num2 ] = S[ num2 + 1 ];
S[ num2 + 1 ] = temp;
}
}
}
return;
}
void output( long S )
{
printf("%ld\n", S );
return;
} | main.c: In function 'input':
main.c:48:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
48 | gets( cel[ num1 ] );
| ^~~~
| fgets
main.c: In function 'search':
main.c:96:101: error: 'Cp' undeclared (first use in this function); did you mean 'Sp'?
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~
| Sp
main.c:96:101: note: each undeclared identifier is reported only once for each function it appears in
main.c:96:57: error: too many arguments to function 'search'
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:104:57: error: too many arguments to function 'search'
104 | search( cel, num1 + 1, down, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:112:57: error: too many arguments to function 'search'
112 | search( cel, up, down, left, num2 - 1, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:120:57: error: too many arguments to function 'search'
120 | search( cel, up, num1 - 1, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
|
s972070482 | p00116 | C | #include<stdio.h>
#define MAX 501
#define BLOCK '*'
#define DOT '.'
void input( char cel[][ MAX ], short H, short W );
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp );
void judge( long S[] );
void output( long S );
int main()
{
short H = 0;
short W = 0;
while(1)
{
long S = 0;
char cel[ MAX ][ MAX ] = {0};
scanf("%hd %hd", &H, &W );
switch( H )
{
case 0:
return 0;
}
input( cel, H, W );
search( cel, 0, H - 1, 0, W - 1, &S );
output( S );
}
return 0;
}
void input( char cel[][ MAX ], short H, short W )
{
short num1 = 0;
scanf(" ");
for( num1 = 0; num1 < H; num1++ )
{
gets( cel[ num1 ] );
}
return;
}
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
{
short num1 = 0;
short num2 = 0;
short num3 = 0;
short loop1 = 0;
short loop2 = 0;
long count = 0;
long Sa = *Sp;
long S[4] = {0};
for( num1 = ( down + up + 1 ) / 2, loop1 = up; loop1 <= down; num1++, loop1++ )
{
if( num1 > down )
{
num1 = up;
}
for( num2 = ( right + left + 1 ) / 2, loop2 = left; loop2 <= right; num2++, loop2++ )
{
if( num2 > right )
{
num2 = left;
}
if( cel[ num1 ][ num2 ] == BLOCK )
{
S[0] = ( right - num2 ) * ( down - up + 1 );
S[1] = ( right - left + 1 ) * ( down - num1 );
S[2] = ( num2 - left ) * ( down - up + 1 );
S[3] = ( right - left + 1 ) * ( num1 - up );
judge( S );
for( num3 = 0; num3 < 4; num3++ )
{
if( S[ num3 ] == ( right - num2 ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 + 1 <= right ))
{
search( cel, up, down, num2 + 1, right, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( down - num1 ))
{
if(( *Sp < S[ num3 ] ) && ( num1 + 1 <= down ))
{
search( cel, num1 + 1, down, left, right, Sp, Cp );
}
}
if( S[ num3 ] == ( num2 - left ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 - 1 >= left ))
{
search( cel, up, down, left, num2 - 1, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( num1 - up ))
{
if(( *Sp < S[ num3 ] ) && ( num1 - 1 >= up ))
{
search( cel, up, num1 - 1, left, right, Sp, Cp );
}
}
}
return;
}
else if( cel[ num1 ][ num2 ] == DOT)
{
count++;
}
}
}
if( *Sp < count )
{
*Sp = count;
}
return;
}
void judge( long S[] )
{
long temp = 0;
short num1 = 0;
short num2 = 0;
for( num1 = 0; num1 < 4; num1++ )
{
for( num2 = 0 ; num2 < 3; num2++ )
{
if( S[ num2 ] > S[ num2 + 1] )
{
temp = S[ num2 ];
S[ num2 ] = S[ num2 + 1 ];
S[ num2 + 1 ] = temp;
}
}
}
return;
}
void output( long S )
{
printf("%ld\n", S );
return;
} | main.c: In function 'input':
main.c:48:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
48 | gets( cel[ num1 ] );
| ^~~~
| fgets
main.c: In function 'search':
main.c:96:101: error: 'Cp' undeclared (first use in this function); did you mean 'Sp'?
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~
| Sp
main.c:96:101: note: each undeclared identifier is reported only once for each function it appears in
main.c:96:57: error: too many arguments to function 'search'
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:104:57: error: too many arguments to function 'search'
104 | search( cel, num1 + 1, down, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:112:57: error: too many arguments to function 'search'
112 | search( cel, up, down, left, num2 - 1, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:120:57: error: too many arguments to function 'search'
120 | search( cel, up, num1 - 1, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
|
s512460187 | p00116 | C | #include<stdio.h>
#define MAX 501
#define BLOCK '*'
#define DOT '.'
void input( char cel[][ MAX ], short H, short W );
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp );
void judge( long S[] );
void output( long S );
int main()
{
short H = 0;
short W = 0;
while(1)
{
long S = 0;
char cel[ MAX ][ MAX ] = {0};
scanf("%hd %hd", &H, &W );
switch( H )
{
case 0:
return 0;
}
input( cel, H, W );
search( cel, 0, H - 1, 0, W - 1, &S );
output( S );
}
return 0;
}
void input( char cel[][ MAX ], short H, short W )
{
short num1 = 0;
scanf(" ");
for( num1 = 0; num1 < H; num1++ )
{
gets( cel[ num1 ] );
}
return;
}
void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
{
short num1 = 0;
short num2 = 0;
short num3 = 0;
short loop1 = 0;
short loop2 = 0;
long count = 0;
long Sa = *Sp;
long S[4] = {0};
for( num1 = ( down + up + 1 ) / 2, loop1 = up; loop1 <= down; num1++, loop1++ )
{
if( num1 > down )
{
num1 = up;
}
for( num2 = ( right + left + 1 ) / 2, loop2 = left; loop2 <= right; num2++, loop2++ )
{
if( num2 > right )
{
num2 = left;
}
if( cel[ num1 ][ num2 ] == BLOCK )
{
S[0] = ( right - num2 ) * ( down - up + 1 );
S[1] = ( right - left + 1 ) * ( down - num1 );
S[2] = ( num2 - left ) * ( down - up + 1 );
S[3] = ( right - left + 1 ) * ( num1 - up );
judge( S );
for( num3 = 0; num3 < 4; num3++ )
{
if( S[ num3 ] == ( right - num2 ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 + 1 <= right ))
{
search( cel, up, down, num2 + 1, right, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( down - num1 ))
{
if(( *Sp < S[ num3 ] ) && ( num1 + 1 <= down ))
{
search( cel, num1 + 1, down, left, right, Sp, Cp );
}
}
if( S[ num3 ] == ( num2 - left ) * ( down - up + 1 ))
{
if(( *Sp < S[ num3 ] ) && ( num2 - 1 >= left ))
{
search( cel, up, down, left, num2 - 1, Sp, Cp );
}
}
if( S[ num3 ] == ( right - left + 1 ) * ( num1 - up ))
{
if(( *Sp < S[ num3 ] ) && ( num1 - 1 >= up ))
{
search( cel, up, num1 - 1, left, right, Sp, Cp );
}
}
}
return;
}
else if( cel[ num1 ][ num2 ] == DOT)
{
count++;
}
}
}
if( *Sp < count )
{
*Sp = count;
}
return;
}
void judge( long S[] )
{
long temp = 0;
short num1 = 0;
short num2 = 0;
for( num1 = 0; num1 < 4; num1++ )
{
for( num2 = 0 ; num2 < 3; num2++ )
{
if( S[ num2 ] > S[ num2 + 1] )
{
temp = S[ num2 ];
S[ num2 ] = S[ num2 + 1 ];
S[ num2 + 1 ] = temp;
}
}
}
return;
}
void output( long S )
{
printf("%ld\n", S );
return;
} | main.c: In function 'input':
main.c:48:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
48 | gets( cel[ num1 ] );
| ^~~~
| fgets
main.c: In function 'search':
main.c:96:101: error: 'Cp' undeclared (first use in this function); did you mean 'Sp'?
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~
| Sp
main.c:96:101: note: each undeclared identifier is reported only once for each function it appears in
main.c:96:57: error: too many arguments to function 'search'
96 | search( cel, up, down, num2 + 1, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:104:57: error: too many arguments to function 'search'
104 | search( cel, num1 + 1, down, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:112:57: error: too many arguments to function 'search'
112 | search( cel, up, down, left, num2 - 1, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
main.c:120:57: error: too many arguments to function 'search'
120 | search( cel, up, num1 - 1, left, right, Sp, Cp );
| ^~~~~~
main.c:54:6: note: declared here
54 | void search( char cel[][ MAX ], short up, short down, short left, short right, long *Sp )
| ^~~~~~
|
s560568886 | p00116 | C++ | #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <utility>
typedef std::pair<char, char> WH;
typedef std::vector<WH> whvec;
int main(){
int h, w;
while( std::cin >> h >> w, w + h != 0 ){
bool map[501][501];
std::string in;
whvec data[501][501];
int data_max = 0;
WH wh;
for( int i = 1; i <= h; ++i ){
std::cin >> in;
for( int l = 1; l <= w; ++l ){
map[i][l] = ( in[l - 1] == '.' );
}
}
for( int i = 1; i <= h; ++i ){
for( int l = 1; l <= w; ++l ){
if( map[i][l] ){
if( map[i - 1][l] && map[i][l - 1] ){
int x_cnt = 0, y_cnt = 0;
while( map[i][l - x_cnt] )x_cnt++;
while( map[i - y_cnt][l] )y_cnt++;
for( int m = 0; m < data[i - 1][l].size(); ++m ){
wh = WH( std::min(data[i - 1][l][m].first, x_cnt), data[i - 1][l][m].second + 1 );
if( std::find( data[i][l].begin(), data[i][l].end(), wh ) == data[i][l].end() ){
data[i][l].push_back( wh );
data_max = std::max( data_max, wh.first * wh.second );
}
}
for( int m = 0; m < data[i][l - 1].size(); ++m ){
wh = WH( data[i][l - 1][m].first + 1, std::min(data[i][l - 1][m].second, y_cnt) );
if( std::find( data[i][l].begin(), data[i][l].end(), wh ) == data[i][l].end() ){
data[i][l].push_back( wh );
data_max = std::max( data_max, wh.first * wh.second );
}
}
}else if( map[i - 1][l] ){
for( int m = 0; m < data[i - 1][l].size(); ++m ){
data[i][l].push_back( wh = WH( 1, data[i - 1][l][m].second + 1 ) );
data_max = std::max( data_max, wh.first * wh.second );
}
}else if( map[i][l - 1] ){
for( int m = 0; m < data[i][l - 1].size(); ++m ){
data[i][l].push_back( wh = WH( data[i][l - 1][m].first + 1, 1 ) );
data_max = std::max( data_max, wh.first * wh.second );
}
}else data[i][l].push_back( wh = WH( 1, 1 ) ), data_max = std::max( data_max, wh.first * wh.second );
}
}
}
std::cout << data_max << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:74: error: no matching function for call to 'min(char&, int&)'
39 | wh = WH( std::min(data[i - 1][l][m].first, x_cnt), data[i - 1][l][m].second + 1 );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:39:74: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'int')
39 | wh = WH( std::min(data[i - 1][l][m].first, x_cnt), data[i - 1][l][m].second + 1 );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:6:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:39:74: note: mismatched types 'std::initializer_list<_Tp>' and 'char'
39 | wh = WH( std::min(data[i - 1][l][m].first, x_cnt), data[i - 1][l][m].second + 1 );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:46:103: error: no matching function for call to 'min(char&, int&)'
46 | wh = WH( data[i][l - 1][m].first + 1, std::min(data[i][l - 1][m].second, y_cnt) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:46:103: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'int')
46 | wh = WH( data[i][l - 1][m].first + 1, std::min(data[i][l - 1][m].second, y_cnt) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:46:103: note: mismatched types 'std::initializer_list<_Tp>' and 'char'
46 | wh = WH( data[i][l - 1][m].first + 1, std::min(data[i][l - 1][m].second, y_cnt) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s349267682 | p00116 | C++ | #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <utility>
#define YNUM(X) ( X < 0 ? X + 3 : X )
int h, w;
bool map[502][502];
std::string in;
int data[3][502][502];
int data_max = 0;
int height_sum[502][502], width_sum[502][502];
int main(){
while( std::cin >> h >> w, w + h != 0 ){
data_max = 0;
memset( height_sum, 0, sizeof(height_sum) );
memset( width_sum, 0, sizeof(width_sum) );
for( int i = 1; i <= h; ++i ){
std::cin >> in;
for( int l = 1; l <= w; ++l ){
map[i][l] = ( in[l - 1] == '.' );
if(map[i][l]){
width_sum[i][l] = width_sum[i][l - 1] + 1;
height_sum[i][l] = height_sum[i - 1][l] + 1;
}
}
}
/*for( int i = 1, n = 1; n <= h; n++, i = n % 3 ){
for( int l = 1; l <= w; l++ ){
memset( data[i][l], 0, sizeof(int) * 502 );
if( map[n][l] ){
if( map[n - 1][l] && map[n][l - 1] ){
int x_cnt = width_sum[n][l], y_cnt = height_sum[n][l];
for( int m = 0; m < 502; ++m ){
if( data[YNUM(i - 1)][l][m] ){
data[i][l][std::min(m, x_cnt)] = data[YNUM(i - 1)][l][m] + 1;
data_max = std::max( data_max, wh.first * wh.second );
}
}
for( int m = 0; m < 502; ++m ){
if( data[i][l - 1][m] ){
data[i][l][m + 1] = std::min(data[i][l - 1][m], y_cnt);
data_max = std::max( data_max, (m + 1) * data[i][l][m + 1] );
}
}
}else if( map[n - 1][l] ){
for( int m = 0; m < 502; ++m ){
if( data[YNUM(i - 1)][l] ){
data[i][l][1] = std::max( data[i][l][1], data[YNUM(i - 1)][l][m] + 1 );
data_max = std::max( data_max, wh.first * wh.second );
}
}
}else if( map[n][l - 1] ){
for( int m = 1; m < 502; ++m ){
if( data[i][l - 1][m] ){
data[i][l][m + 1] = std::max( data[i][l][m + 1], 1 );
data_max = std::max( data_max, (m + 1) * data[i][l][1] );
}
}
}else data[i][l][1] = std::max( data[i][l][1], 1 ), data_max = std::max( data_max, data[i][l][1] );
}
}
}
std::cout << data_max << std::endl;
}*/
return 0;
} | a.cc: In function 'int main()':
a.cc:81:2: error: expected '}' at end of input
81 | }
| ^
a.cc:18:11: note: to match this '{'
18 | int main(){
| ^
|
s180935640 | p00116 | C++ | #include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <utility>
#define YNUM(X) ( X < 0 ? X + 3 : X )
int h, w;
bool map[502][502];
char in[502];
int data[3][502][502];
int data_max = 0;
int height_sum[502][502], width_sum[502][502];
int main(){
while( std::cin >> h >> w, w + h != 0 ){
data_max = 0;
memset( height_sum, 0, sizeof(height_sum) );
memset( width_sum, 0, sizeof(width_sum) );
for( int i = 1; i <= h; ++i ){
std::cin >> in;
for( int l = 1; l <= w; ++l ){
map[i][l] = ( in[l - 1] == '.' );
if(map[i][l]){
width_sum[i][l] = width_sum[i][l - 1] + 1;
height_sum[i][l] = height_sum[i - 1][l] + 1;
}
}
}
for( int i = 1, n = 1; n <= h; n++, i = n % 3 ){
for( int l = 1; l <= w; l++ ){
memset( data[i][l], 0, sizeof(int) * 502 );
if( map[n][l] ){
if( map[n - 1][l] && map[n][l - 1] ){
int x_cnt = width_sum[n][l], y_cnt = height_sum[n][l];
for( int m = 0; m < 502; ++m ){
if( data[YNUM(i - 1)][l][m] ){
data[i][l][std::min(m, x_cnt)] = data[YNUM(i - 1)][l][m] + 1;
data_max = std::max( data_max, wh.first * wh.second );
}
}
for( int m = 0; m < 502; ++m ){
if( data[i][l - 1][m] ){
data[i][l][m + 1] = std::min(data[i][l - 1][m], y_cnt);
data_max = std::max( data_max, (m + 1) * data[i][l][m + 1] );
}
}
}else if( map[n - 1][l] ){
for( int m = 0; m < 502; ++m ){
if( data[YNUM(i - 1)][l] ){
data[i][l][1] = std::max( data[i][l][1], data[YNUM(i - 1)][l][m] + 1 );
data_max = std::max( data_max, wh.first * wh.second );
}
}
}else if( map[n][l - 1] ){
for( int m = 1; m < 502; ++m ){
if( data[i][l - 1][m] ){
data[i][l][m + 1] = std::max( data[i][l][m + 1], 1 );
data_max = std::max( data_max, (m + 1) * data[i][l][1] );
}
}
}else data[i][l][1] = std::max( data[i][l][1], 1 ), data_max = std::max( data_max, data[i][l][1] );
}
}
}
std::cout << data_max << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:64: error: 'wh' was not declared in this scope; did you mean 'w'?
46 | data_max = std::max( data_max, wh.first * wh.second );
| ^~
| w
a.cc:60:64: error: 'wh' was not declared in this scope; did you mean 'w'?
60 | data_max = std::max( data_max, wh.first * wh.second );
| ^~
| w
|
s591325662 | p00116 | C++ | #include <cstdio>
#include <iostream>
using namespace std;
char str[512][512];
int H, W;
int size(int si, int sj)
{
int max = 0;
for (int ei = si; ei < H; ei++){
for (int ej = sj; ej < W; ej++){
int f = 1;
for (int i = si; i <= ei; i++){
for (int j = sj; j <= ej; j++){
if (str[i][j] != '.'){
f = 0;
break;
}
if (f == 0){
break;
}
}
}
if (f && max < (ei - si + 1) * (ej - sj + 1)){
max = (ei - si + 1) * (ej - sj + 1);
}
}
}
return (max);
}
int main()
{
while (1){
cin >> H >> W;
if (!H && !W){
break;
}
for (int i = 0; i < 512; i++){
strcpy(str[i], "");
}
for (int i = 0; i < H; i++){
cin >> str[i];
}
int max = 0;
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
int s = size(i, j);
if (max < s){
max = s;
}
}
}
printf("%d\n", max);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:25: error: 'strcpy' was not declared in this scope
46 | strcpy(str[i], "");
| ^~~~~~
a.cc:3:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <iostream>
+++ |+#include <cstring>
3 |
|
s842070715 | p00116 | C++ | g#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int main(void){
int H,W;
while(cin>>H>>W){
if(H==0) break;
vector<string> grid(H);
int sum[501][501] = {0};
REP(i,H){
cin>>grid[i];
}
REP(y,H)REP(x,W){
sum[y+1][x+1] = sum[y+1][x] + sum[y][x+1] - sum[y][x];
sum[y+1][x+1] += (grid[y][x]=='*')?1:0;
}
int ans=0;
/*
REP(y1,H)REP(x1,W)FOR(y2,y1+1,H)FOR(x2,x1+1,W){
if(sum[x2+1][y2+1]-sum[x1][y2+1]
-sum[x2+1][y1]+sum[x1][y1]==0){
ans = max((x2-x1+1)*(y2-y1+1),ans);
}
}
*/
bool f = false;
FOR(dy,1,H+1){
FOR(dx,1,W+1){
f = false;
FOR(y,dy-1,H){
FOR(x,dx-1,W){
if(sum[y+1][x+1]-sum[y+1-dy][x+1]
-sum[y+1][x+1-dx] + sum[y+1-dy][x+1-dx]==0){
f = true;
break;
}
}
if(f) break;
}
if(f) ans = max(ans,dx*dy);
else break;
}
}
cout<<ans<<endl;
}
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | g#include <cstdio>
| ^
a.cc:1:1: error: 'g' does not name a type
1 | g#include <cstdio>
| ^
In file included from /usr/include/c++/14/cmath:45,
from a.cc:3:
/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,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/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:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
In file included from /usr/include/stdlib.h:32,
from /usr/include/c++/14/cstdlib:79,
from a.cc:2:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/include/c++/14/bits/stl_alg |
s655367191 | p00116 | C++ | #include <iostream>
using namespace std;
#define REP(i,n) for(i=1;i<=n;i++)
short x,y,w[505][505];char map[505][505];int main(){int i,j,k;while(cin>>y>>x,y){REP(i,y)cin>>map[i]+1;memset(w,0,sizeof(w));REP(i,y)REP(j,x)w[i][j]=x-j+1;REP(i,y)REP(j,x)if(map[i][j]=='.')continue;else for(k=j;k>0;k--)if(w[i][k]>j-k)w[i][k]=j-k;int max=0;REP(i,y)REP(j,x){int h=1;if(!w[i][j])continue;for(k=i-1;w[k][j]>=w[i][j];k--)h++;for(k=i+1;w[k][j]>=w[i][j];k++)h++;if(max<w[i][j]*h)max=w[i][j]*h;}cout<<max<<endl;}} | a.cc: In function 'int main()':
a.cc:4:104: error: 'memset' was not declared in this scope
4 | short x,y,w[505][505];char map[505][505];int main(){int i,j,k;while(cin>>y>>x,y){REP(i,y)cin>>map[i]+1;memset(w,0,sizeof(w));REP(i,y)REP(j,x)w[i][j]=x-j+1;REP(i,y)REP(j,x)if(map[i][j]=='.')continue;else for(k=j;k>0;k--)if(w[i][k]>j-k)w[i][k]=j-k;int max=0;REP(i,y)REP(j,x){int h=1;if(!w[i][j])continue;for(k=i-1;w[k][j]>=w[i][j];k--)h++;for(k=i+1;w[k][j]>=w[i][j];k++)h++;if(max<w[i][j]*h)max=w[i][j]*h;}cout<<max<<endl;}}
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s491508929 | p00116 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
#define REP(i,n) for(i=1;i<=n;i++)
short x,y,w[505][505];char map[505][505];int main(){int i,j,k;while(cin>>y>>x,y){REP(i,y)cin>>map[i]+1;memset(w,0,sizeof(w));REP(i,y)REP(j,x)w[i][j]=x-j+1;REP(i,y)REP(j,x)if(map[i][j]=='.')continue;else for(k=j;k>0;k--)if(w[i][k]>j-k)w[i][k]=j-k;int max=0;REP(i,y)REP(j,x){int h=1;if(!w[i][j])continue;for(k=i-1;w[k][j]>=w[i][j];k--)h++;for(k=i+1;w[k][j]>=w[i][j];k++)h++;if(max<w[i][j]*h)max=w[i][j]*h;}cout<<max<<endl;}} | a.cc: In function 'int main()':
a.cc:5:104: error: 'memset' was not declared in this scope
5 | short x,y,w[505][505];char map[505][505];int main(){int i,j,k;while(cin>>y>>x,y){REP(i,y)cin>>map[i]+1;memset(w,0,sizeof(w));REP(i,y)REP(j,x)w[i][j]=x-j+1;REP(i,y)REP(j,x)if(map[i][j]=='.')continue;else for(k=j;k>0;k--)if(w[i][k]>j-k)w[i][k]=j-k;int max=0;REP(i,y)REP(j,x){int h=1;if(!w[i][j])continue;for(k=i-1;w[k][j]>=w[i][j];k--)h++;for(k=i+1;w[k][j]>=w[i][j];k++)h++;if(max<w[i][j]*h)max=w[i][j]*h;}cout<<max<<endl;}}
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s176228498 | p00116 | C++ | #include<stdio.h>
#include<stack>
#include<algorithm>
#include<map>
using namespace std;
int h,w;
char m[512][512];
int AboveHeight(int x,int y)
{
int res=0;
while(m[y][x]=='.')
{
++res;
--y;
}
return res;
}
int Solve(int y)
{
typedef pair<int,int>P;
int res=0, x;
stack<P> s;
for(x=1; x<=w+1; ++x)
{
int a=AboveHeight(x,y);
if(s.empty() || s.top().first <= a)
s.push(P(a,x));
else
{
int lastX = -1;
while(!s.empty() && s.top().first > a)
{
P p=s.top();
s.pop();
res = max(res, p.first * (x-p.second));
lastX = p.second;
}
s.push(P(a,lastX));
}
}
return res;
}
int main()
{
while(scanf("%d%d",&h,&w),h)
{
memset(m,'*',sizeof(m));
int x,y;
int res=0;
for(y=1; y<=h; ++y)
scanf("%s",&m[y][1]);
for(y=1; y<=h; ++y)
res=max(res,Solve(y));
printf("%d\n",res);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:51:17: error: 'memset' was not declared in this scope
51 | memset(m,'*',sizeof(m));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<map>
+++ |+#include <cstring>
5 | using namespace std;
|
s928676392 | p00116 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
const int INF = 99999;
void p(vector<int> v){
for(int i = 0; i < v.size(); i++){
cout << (i?" ":"") << v[i];
}
cout << endl;
}
void p(vector<string> v){
for(int i = 0; i < v.size(); i++){
cout << (i?"\n":"") << v[i];
}
cout << endl;
}
void p(vector<vector<int>> v){
for(int i = 0; i < v.size(); i++){
p(v[i]);
}
cout << endl;
}
bool hasNoMark(string s, int left, int right, const char mark = '*'){
for(int i = left; i <= right; i++){
if(s[i] == '*') return false;
}
return true;
}
int main(){
int h, w;
while(cin >> h >> w){
if( !h && !w ) break;
vector<string> data;
for(int i = 0; i < h; i++){
string line;
cin >> line;
line += '*';
data.push_back(line);
}
string line(w+1, '*');
data.push_back(line);
int recmax = 0;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(data[i][j] == '*') continue;
int left = j;
while(data[i][j] != '*') j++;
int h = 1;
while(hasNoMark(data[i+h], left, j-1)) h++;
recmax = max((j-left)*h, recmax);
}
}
// p(data);
cout << recmax << endl;
}
return 0;
}#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
const int INF = 99999;
void p(vector<int> v){
for(int i = 0; i < v.size(); i++){
cout << (i?" ":"") << v[i];
}
cout << endl;
}
void p(vector<string> v){
for(int i = 0; i < v.size(); i++){
cout << (i?"\n":"") << v[i];
}
cout << endl;
}
void p(vector<vector<int>> v){
for(int i = 0; i < v.size(); i++){
p(v[i]);
}
cout << endl;
}
bool hasNoMark(string s, int left, int right, const char mark = '*'){
for(int i = left; i <= right; i++){
if(s[i] == '*') return false;
}
return true;
}
int main(){
int h, w;
while(cin >> h >> w){
if( !h && !w ) break;
vector<string> data;
for(int i = 0; i < h; i++){
string line;
cin >> line;
line += '*';
data.push_back(line);
}
string line(w+1, '*');
data.push_back(line);
int recmax = 0;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(data[i][j] == '*') continue;
int left = j;
while(data[i][j] != '*') j++;
int h = 1;
while(hasNoMark(data[i+h], left, j-1)) h++;
recmax = max((j-left)*h, recmax);
}
}
// p(data);
cout << recmax << endl;
}
return 0;
} | a.cc:72:2: error: stray '#' in program
72 | }#include <iostream>
| ^
a.cc:72:3: error: 'include' does not name a type
72 | }#include <iostream>
| ^~~~~~~
a.cc:79:11: error: redefinition of 'const int INF'
79 | const int INF = 99999;
| ^~~
a.cc:8:11: note: 'const int INF' previously defined here
8 | const int INF = 99999;
| ^~~
a.cc:81:6: error: redefinition of 'void p(std::vector<int>)'
81 | void p(vector<int> v){
| ^
a.cc:10:6: note: 'void p(std::vector<int>)' previously defined here
10 | void p(vector<int> v){
| ^
a.cc:88:6: error: redefinition of 'void p(std::vector<std::__cxx11::basic_string<char> >)'
88 | void p(vector<string> v){
| ^
a.cc:17:6: note: 'void p(std::vector<std::__cxx11::basic_string<char> >)' previously defined here
17 | void p(vector<string> v){
| ^
a.cc:95:6: error: redefinition of 'void p(std::vector<std::vector<int> >)'
95 | void p(vector<vector<int>> v){
| ^
a.cc:24:6: note: 'void p(std::vector<std::vector<int> >)' previously defined here
24 | void p(vector<vector<int>> v){
| ^
a.cc:102:6: error: redefinition of 'bool hasNoMark(std::string, int, int, char)'
102 | bool hasNoMark(string s, int left, int right, const char mark = '*'){
| ^~~~~~~~~
a.cc:31:6: note: 'bool hasNoMark(std::string, int, int, char)' previously defined here
31 | bool hasNoMark(string s, int left, int right, const char mark = '*'){
| ^~~~~~~~~
a.cc:109:5: error: redefinition of 'int main()'
109 | int main(){
| ^~~~
a.cc:38:5: note: 'int main()' previously defined here
38 | int main(){
| ^~~~
|
s154602986 | p00116 | C++ | while True:
H,W = map(int, raw_input().split(" "))
if (H,W) == (0,0):
break
field = [raw_input() for _ in xrange(H)]
space = [[0]*(W+1) for _ in xrange(H)]
for x in xrange(W-1,-1,-1):
for y in xrange(H):
if field[y][x]==".":
space[y][x] = space[y][x+1]+1
ans = 0
for x in xrange(W):
for y in (yy for yy in xrange(H) if field[y][x] == "."):
for hh in xrange(y+1,H+1):
ans = max(ans, min(s[x] for s in space[y:h])*(h-y))
print ans | a.cc:1:1: error: expected unqualified-id before 'while'
1 | while True:
| ^~~~~
|
s530991358 | p00116 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int h, w;
string s[999];
int data[999][999];
while(true){
cin >> h >> w;
if(!h && !w) break;
for(int i=0;i<h;i++) cin >> s[i];
for(int i=0;i<h;i++){
int k = 0;
for(int j=w-1;j>=0;j--){
data[i][j] = ++k;
if(s[i][j] == '*') data[i][j] = k = 0;
}
}#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
int h, w;
string s[999];
int data[999][999];
while(true){
cin >> h >> w;
if(!h && !w) break;
for(int i=0;i<h;i++) cin >> s[i];
for(int i=0;i<h;i++){
int k = 0;
for(int j=w-1;j>=0;j--){
data[i][j] = ++k;
if(s[i][j] == '*') data[i][j] = k = 0;
}
}
int ans = 0;
for(int j=0;j<w;j++){
for(int i=0;i<h;i++){
int p = data[i][j];
for(int k=i,l=1;k<h;k++,l++){
p = min(p, data[k][j]);
ans = max(ans, p * l);
}
}
}
cout << ans << endl;
}
}
int ans = 0;
for(int j=0;j<w;j++){
for(int i=0;i<h;i++){
int p = data[i][j];
for(int k=i,l=1;k<h;k++,l++){
p = min(p, data[k][j]);
ans = max(ans, p * l);
}
}
}
cout << ans << endl;
}
} | a.cc:24:6: error: stray '#' in program
24 | }#include<iostream>
| ^
a.cc: In function 'int main()':
a.cc:24:7: error: 'include' was not declared in this scope
24 | }#include<iostream>
| ^~~~~~~
a.cc:24:23: error: expected primary-expression before '>' token
24 | }#include<iostream>
| ^
a.cc:27:1: error: expected primary-expression before 'using'
27 | using namespace std;
| ^~~~~
a.cc:29:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
29 | int main(){
| ^~
a.cc:29:9: note: remove parentheses to default-initialize a variable
29 | int main(){
| ^~
| --
a.cc:29:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:29:11: error: a function-definition is not allowed here before '{' token
29 | int main(){
| ^
|
s758434524 | p00117 | Java | #include<iostream>
using namespace std;
static const int INF = 1<<21;
int n, m, a, b, c, d, s, g, v, p;
int mat[21][21];
void floyd(){
for(int k = 1; k <= n; k++){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
mat[i][j] = min(mat[i][j], mat[i][k]+mat[k][j]);
}
}
}
}
int main(){
scanf("%d", &n);
scanf("%d", &m);
for(int i = 0; i < 21; i++){
for(int j = 0; j < 21; j++){
mat[i][j] = INF;
}
}
for(int i = 0; i < m; i++){
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
mat[a][b] = c;
mat[b][a] = d;
}
scanf("%d,%d,%d,%d", &s, &g, &v, &p);
floyd();
printf("%d\n", v-(mat[s][g]+mat[g][s]+p));
return 0;
}
| Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include<iostream>
^
Main.java:4: error: class, interface, enum, or record expected
static const int INF = 1<<21;
^
Main.java:5: error: class, interface, enum, or record expected
int n, m, a, b, c, d, s, g, v, p;
^
Main.java:6: error: class, interface, enum, or record expected
int mat[21][21];
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
void floyd(){
^
(use --enable-preview to enable unnamed classes)
Main.java:19: error: illegal start of expression
scanf("%d", &n);
^
Main.java:20: error: illegal start of expression
scanf("%d", &m);
^
Main.java:29: error: illegal start of expression
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
^
Main.java:29: error: illegal start of expression
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
^
Main.java:29: error: illegal start of expression
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
^
Main.java:29: error: illegal start of expression
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
^
Main.java:34: error: illegal start of expression
scanf("%d,%d,%d,%d", &s, &g, &v, &p);
^
Main.java:34: error: illegal start of expression
scanf("%d,%d,%d,%d", &s, &g, &v, &p);
^
Main.java:34: error: illegal start of expression
scanf("%d,%d,%d,%d", &s, &g, &v, &p);
^
Main.java:34: error: illegal start of expression
scanf("%d,%d,%d,%d", &s, &g, &v, &p);
^
16 errors
|
s329691908 | p00117 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
new Main().run();
}
int[][] cost;
boolean[] visit;
int[] dist;
int n;
public void run(){
Scanner scan = new Scanner(System.in);
while(true){
n = scan.nextInt();
int m = scan.nextInt();
cost = new int[n][n];
for(int i = 0;i < n;i++){
Arrays.fill(cost[i], 1000000);
}
for(int i = 0;i < m;i++){
String[] str = scan.next().split(",");
int a = Integer.parseInt(str[0])-1;
int b = Integer.parseInt(str[1])-1;
cost[a][b] = Integer.parseInt(str[2]);
cost[b][a] = Integer.parseInt(str[3]);
}
String[] str = scan.next().split(",");
int[] x = {Integer.parseInt(str[0])-1,Integer.parseInt(str[1])-1};
int reward = Integer.parseInt(str[2]) - Integer.parseInt(str[3]);
for(int i = 0;i < 2;i++){
visit = new boolean[n];
dist = new int[n];
Arrays.fill(dist,1000000);
Arrays.fill(visit,false);
dijkstra(x[i]);
reward -= dist[x[(i+1)%2]];
}
System.out.println(reward);
}
}
public void dijkstra(int start){
dist[start] = 0;
while(true){
int min = 1000000;
int next = -1;
for(int u = 0;u < n;u++){
if(visit[u]){
continue;
}
dist[u] = Math.min(dist[u],dist[start] + cost[start][u]);
if(dist[u] < min){
min = dist[u];
next = u;
}
}
visit[start] = true;
start = next;
if(start == -1){
break;
}
}
} | Main.java:62: error: reached end of file while parsing
}
^
1 error
|
s902474265 | p00117 | C | #include<stdio.h>
#include<stdlib.h>
#define INF 10000000
#define N 21
#define error(s) do{fprintf(stderr , s); exit(-1);}while(0)
int M[N][N],a[N][N],W[N][N],p[N][N];;
void floyd(void);
void path(int i, int j);
int main(){
int i,j,n,m,a1,b,c,d,x1,x2,y1,y2;
for(i = 0 ; i < N ; i++){
for(j = 1 ; j < N ; j++){
M[i][j] = 0;
}
}
scanf("%d",&n);
scanf("%d",&m);
for(i = 0 ; i < m ; i++){
scanf("%d,%d,%d,%d",&a1,&b,&c,&d);
M[a1][b] = c;
M[b][a1] = d;
}
scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
if(i == j){
a[i][j] = 0;
W[i][j] = 0;
}
else if(M[i][j] == 0){
a[i][j] = INF;
W[i][j] = INF;
}
else{
a[i][j] = M[i][j];
W[i][j] = M[i][j];
}
if(W[i][j] != INF){
p[i][j] = j;
}
else{
p[i][j] = -1;
}
}
}
floyd();
path(x1,x2,&y1);
y1 -= y2;
path(x2,x1,&y1);
printf("%d\n",y1);
return 0;
}
void floyd(void){
int i , j , k ;
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
a[i][j] = W[i][j];
}
}
for(k = 0 ; k < N ; k++){
for(i = 0 ; i < N ; i++){
for(j = 0 ; j < N ; j++){
if(a[i][k] + a[k][j] < a[i][j]){
a[i][j] = a[i][k] + a[k][j];
p[i][j] = p[i][k];
}
}
}
}
}
void path(int i, int j ,int *y1){
int tmp,k = i;
tmp = k;
while(p[k][j] != j && p[k][j] != -1){
k = p[k][j];
*y1 -= M[tmp][k];
tmp = k;
}
if(p[k][j] == -1)error("No Path");
*y1 -= M[k][j];
} | main.c: In function 'main':
main.c:59:9: error: too many arguments to function 'path'
59 | path(x1,x2,&y1);
| ^~~~
main.c:12:6: note: declared here
12 | void path(int i, int j);
| ^~~~
main.c:61:9: error: too many arguments to function 'path'
61 | path(x2,x1,&y1);
| ^~~~
main.c:12:6: note: declared here
12 | void path(int i, int j);
| ^~~~
main.c: At top level:
main.c:87:6: error: conflicting types for 'path'; have 'void(int, int, int *)'
87 | void path(int i, int j ,int *y1){
| ^~~~
main.c:12:6: note: previous declaration of 'path' with type 'void(int, int)'
12 | void path(int i, int j);
| ^~~~
|
s066770792 | p00117 | C | #include<stdio.h>
#include<string.h>
#include<limits.h>
int min( int a ,int b )
{
return a > b ? b : a ;
}
void in( int move[][ 200 ] ,int next[][ 200 ] ,int *ans ,int m )
{
int now ,nex ;
int go ,back ;
int i ,j ;
for( i = 0 ; i < m ; ++i )
{
scanf( "%d,%d,%d,%d" ,&now ,&nex ,&go ,&back ) ;
++next[ now ][ 0 ] ;
++next[ nex ][ 0 ] ;
next[ now ][ next[ now ][ 0 ] ] = nex ;
next[ nex ][ next[ nex ][ 0 ] ] = now ;
move[ now ][ nex ] = go ;
move[ nex ][ now ] = back ;
/*
go_k[ now ][ nex ] = go ;
back_k[ nex ][ now ] = back ;
*/
}
}
int next[ 200 ][ 200 ] ;
int move[ 200 ][ 200 ] ;
bool came[ 200 ][ 200 ] ;
int n ,m ;
int st ,end ;
void search( int *ans ,int kale[][ 200 ] ,int now )
{
int i ;
for( i = 1 ; i <= next[ now ][ 0 ] ; ++i )
{
if( next[ now ][ i ] != st && came[ now ][ i ] == false )
{
came[ now ][ i ] = true ;
ans[ next[ now ][ i ] ] = min( ans[ now ] + kale[ now ][ next[ now ][ i ] ] ,ans[ next[ now ][ i ] ] ) ;
if( next[ now ][ i ] != end )
{
search( ans ,kale ,next[ now ][ i ] ) ;
}
}
}
}
void init( int *ans ,int n )
{
while( n )
{
ans[ n-- ] = INT_MAX ;
}
}
int main()
{
int kale ,stick ;
int ans[ 20 + 1 ] ;
scanf( "%d" ,&n ) ;
init( ans ,n ) ;
scanf( "%d" ,&m ) ;
in( move ,next ,ans ,m ) ;
scanf( "%d,%d,%d,%d" ,&st ,&end ,&kale ,&stick ) ;
ans[ st ] = 0 ;
search( ans ,move ,st ) ;
stick += ans[ end ] ;
init( ans ,n ) ;
st += end ;
end = st - end ;
st -= end ;
ans[ st ] = 0 ;
memset( came ,0 ,sizeof came ) ;
search( ans ,move ,st ) ;
printf( "%d\n" ,kale - ( stick + ans[ end ] ) ) ;
return 0 ;
} | main.c:46:1: error: unknown type name 'bool'
46 | bool came[ 200 ][ 200 ] ;
| ^~~~
main.c:5:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
4 | #include<limits.h>
+++ |+#include <stdbool.h>
5 |
main.c: In function 'search':
main.c:58:67: error: 'false' undeclared (first use in this function)
58 | if( next[ now ][ i ] != st && came[ now ][ i ] == false )
| ^~~~~
main.c:58:67: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:58:67: note: each undeclared identifier is reported only once for each function it appears in
main.c:60:44: error: 'true' undeclared (first use in this function)
60 | came[ now ][ i ] = true ;
| ^~~~
main.c:60:44: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s062163512 | p00117 | C | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));} | main.c:1:1: warning: data definition has no type or storage class
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'g' [-Wimplicit-int]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c:1:13: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c:1:15: warning: data definition has no type or storage class
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c:1:15: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
main.c:1:17: error: type defaults to 'int' in declaration of 'X' [-Wimplicit-int]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c:1:19: error: return type defaults to 'int' [-Wimplicit-int]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c: In function 'D':
main.c:1:19: error: type of 'S' defaults to 'int' [-Wimplicit-int]
main.c:1:19: error: type of 'G' defaults to 'int' [-Wimplicit-int]
main.c:1:50: error: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'memset'
+++ |+#include <string.h>
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
main.c:1:50: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~~~
main.c:1:50: note: include '<string.h>' or provide a declaration of 'memset'
main.c:1:108: error: expected expression before '?' token
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^
main.c: At top level:
main.c:1:174: error: return type defaults to 'int' [-Wimplicit-int]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~
main.c: In function 'main':
main.c:1:174: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:1:174: error: type of 'Y' defaults to 'int' [-Wimplicit-int]
main.c:1:188: warning: incompatible implicit declaration of built-in function 'memset' [-Wbuiltin-declaration-mismatch]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~~~
main.c:1:188: note: include '<string.h>' or provide a declaration of 'memset'
main.c:1:197: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
main.c:1:197: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~~
main.c:1:197: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:287: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
main.c:1:287: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
1 | n,g[21][21],i;x,X;D(S,G){int c[21],f[21]={0};for(memset(c,1,84),c[S]=0;S;){for(i=n+1;--i;c[i]=c[S]+g[S][i]<?c[i])f[S]=1;for(S=i=0;++i<=n;)S=f[i]|c[i]>c[S]?S:i;}return c[G];}main(y,Y){for(memset(g,scanf("%d%d",&n,&i),1764);~i--;~i&&(g[x][X]=y,g[X][x]=Y))scanf("%d,%d,%d,%d",&x,&X,&y,&Y);exit(!printf("%d\n",y-Y-D(x,X)-D(X,x)));}
| ^~~~
main.c:1:287: note: include '<stdlib.h>' |
s750521954 | p00117 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
struct edge { int to, cost; };
vector<edge> G[21];
int search(int start, int goal)
{
//first := cost, second := now vertex
priority_queue<P, vector<P>, greater<P>> que;
vector<int> dist(21, INF);
que.push(P(0, start));
dist[start] = 0;
while(not que.empty())
{
P now = que.top(); que.pop();
if(now.second == goal) break;
if(d[now.second] < now.first) continue;
for(int u = 0; u < G[now.second].size(); u++)
{
edge e = G[now.second][u];
if(now.first + e.cost < dist[e.to])
{
dist[e.to] = now.first + e.cost;
que.push(P(dist[e.to], e.to));
}
}
}
return dist[goal];
}
int main()
{
int n, m; cin >> n >> m;
for(int i = 0; i < m; i++)
{
int a, b, c, d;
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
G[a].push_back({b, c});
G[b].push_back({a, d});
}
int start, goal, v, p;
scanf("%d,%d,%d,%d", &start, &goal, &v, &p);
int ans = v - p;
int a = search(start, goal);
int b = search(goal, start);
cout << ans - a - b << endl;
return 0;
}
| a.cc: In function 'int search(int, int)':
a.cc:33:12: error: 'd' was not declared in this scope; did you mean 'dy'?
33 | if(d[now.second] < now.first) continue;
| ^
| dy
|
s979126162 | p00117 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
int n, m, start, goal, money, pole;
int roads[21][21];
int in[4];
std::string input;
int check( int pos, int hbt, unsigned int c ){
if( pos == goal ) return c;
unsigned int cost = -1;
for( int i = 1; i <= m; ++i ){
if( roads[pos][i] != -1 && !(hbt & 1 << i) ){
cost = std::min( cost, (unsigned int)check( i, hbt|1<<i, c + roads[pos][i] ) );
}
}
return cost;
}
int main(){
memset( roads, -1, sizeof( roads ) );
std::cin >> n >> m;
for( int i = 0; i < m; ++i ){
std::cin >> input;
sscanf( input.c_str(), "%d,%d,%d,%d", in, &in[1], &in[2], &in[3] );
roads[ in[0] ][ in[1] ] = in[2];
roads[ in[1] ][ in[0] ] = in[3];
}
std::cin >> input;
sscanf( input.c_str(), "%d,%d,%d,%d", &start, &goal, &money, &pole );
money -= pole;
int cost = check( start, 0, 0 );
std::swap( start, goal );
cost += check( start, 0, 0 );
std::cout << money - cost << std::endl;
} | a.cc: In function 'int main()':
a.cc:26:9: error: 'memset' was not declared in this scope
26 | memset( roads, -1, sizeof( roads ) );
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 |
|
s885074825 | p00117 | C++ | #include <iostream>
#include <algorithm>
#define MAX_N 20
#define INF 1e9
using namespace std;
int dp[MAX_N][MAX_N];
int dp[MAX_N][MAX_N];
int n,m;
void warshall_froyd(){
for(int k=0;k<n;k++){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
}
}
int main(){
cin >> n;
cin >> m;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
dp[i][j] = (i==j ? 0 : INF);
dp[i][j] = (i==j ? 0 : INF);
}
}
for(int i=0;i<m;i++){
int a,b,atob,btoa;
cin >> a >> b >> atob >> btoa;
a--; b--;
dp[a][b] = atob; dp[b][a] = btoa;
}
warshall_froyd();
cin >> start >> goal >> reward >> price;
cout << reward - dp[start][goal] - price << endl;
return 0;
} | a.cc:8:5: error: redefinition of 'int dp [20][20]'
8 | int dp[MAX_N][MAX_N];
| ^~
a.cc:7:5: note: 'int dp [20][20]' previously declared here
7 | int dp[MAX_N][MAX_N];
| ^~
a.cc: In function 'int main()':
a.cc:39:10: error: 'start' was not declared in this scope
39 | cin >> start >> goal >> reward >> price;
| ^~~~~
a.cc:39:19: error: 'goal' was not declared in this scope
39 | cin >> start >> goal >> reward >> price;
| ^~~~
a.cc:39:27: error: 'reward' was not declared in this scope; did you mean 'rewind'?
39 | cin >> start >> goal >> reward >> price;
| ^~~~~~
| rewind
a.cc:39:37: error: 'price' was not declared in this scope
39 | cin >> start >> goal >> reward >> price;
| ^~~~~
|
s260404866 | p00117 | C++ | #include <iostrem>
#include <cstdio>
using namspace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf =1001001001;
int main(){
for (int i = 0; i < 32; ++i)
{
for (int j = 0; j < 32; ++i)
{
K[i][j]= inf;
}
}
scanf("%d%d", &N, &M);
for(int i=0; i<M; ++i){
scanf("%d,%d,%d,%d", &A, &B, &C, &D);
// cerr << "read " << A << " " << B << " " << C << " " << D << endl;
K[A-1][B-1]=C;
K[B-1][A-1]=D;
}
for (int k=1;k<N;k++){
for (int i = 1; i < N; i++){
for (int j = 0; j < N; j++){
if(K[i][j]>(K[i][k]+K[k][j]){
K[i][j]=K[i][k]+K[k][j];
}
}
}
}
scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
cerr << y1-K[x1][x2]-y2 <<endl;
} | a.cc:1:10: fatal error: iostrem: No such file or directory
1 | #include <iostrem>
| ^~~~~~~~~
compilation terminated.
|
s489188983 | p00117 | C++ | #include <iostrem>
#include <cstdio>
using namspace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf =1001001001;
int main(){
for (int i = 0; i < 32; ++i)
{
for (int j = 0; j < 32; ++i)
{
K[i][j]= inf;
}
}
scanf("%d%d", &N, &M);
for(int i=0; i<M; ++i){
scanf("%d,%d,%d,%d", &A, &B, &C, &D);
cerr << "read " << A << " " << B << " " << C << " " << D << endl;
K[A-1][B-1]=C;
K[B-1][A-1]=D;
}
for (int k=1;k<N;k++){
for (int i = 1; i < N; i++){
for (int j = 0; j < N; j++){
if(K[i][j]>(K[i][k]+K[k][j]){
K[i][j]=K[i][k]+K[k][j];
}
}
}
}
scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
cerr << y1-K[x1][x2]-y2 <<endl;
} | a.cc:1:10: fatal error: iostrem: No such file or directory
1 | #include <iostrem>
| ^~~~~~~~~
compilation terminated.
|
s605044442 | p00117 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
int mini(int s,int t){
if(s>t){
return t;
}
return s
}
int main(){
scanf("%d%d", &N, &M);
for (int i=0; i<M;++i){
scanf("%d,%d,%d,%d", &A, &B, &C, &D);
K[A][B]=C;
K[B][A]=D;
// cerr << "read " <<A<<" " << B << " " << C <<" "<< D <<endl;
}
for (int i = 1; i < N+1 ; ++i)
{
for (int j = 0; j < N+1; ++j)
{
for(int k=0;k<N+1;++k)
{
K[j][k]=mini(K[j][i]+K[i][k],K[j][k]);
}
}
}
scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
cerr << y2-y1-K[x1][x2]<<endl;
} | a.cc:4:31: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
4 | int N, M, A, B, C, D, x1, x2, y1, y2;
| ^~
a.cc: In function 'int mini(int, int)':
a.cc:11:11: error: expected ';' before '}' token
11 | return s
| ^
| ;
12 | }
| ~
|
s203644567 | p00117 | C++ | #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int cityNum,roadNum;
int city[20];
int road[190][2];
int roadCost[190][2]; //0:0-1 1:1-0
int i,j;
int start,goal,money,hashira;
bool flg;
cin>>cityNum>>roadNum;
for(i=0;i<roadNum;i++){
scanf("%d,%d,%d,%d",&road[i][0],&road[i][1],&roadCost[i][0],&roadCost[i][1]);
road[i][0]--;road[i][1]--;
}
scanf("%d,%d,%d,%d",&start,&goal,&money,&hashira);
start--;goal--;
for(i=0;i<cityNum;i++) city[i]=1000000;
city[start]=0;
do{
flg=false;
for(i=0;i<roadNum;i++){
for(j=0;j<2;j++){
if(city[road[i][j]]+roadCost[i][j]<city[road[i][1-j]]){
city[road[i][1-j]]=city[road[i][j]]+roadCost[i][j];
flg=true;
}
}
}
}while(flg);
cout<<money-hashira-road[goal]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:39:28: error: invalid operands of types 'int' and 'int [2]' to binary 'operator-'
39 | cout<<money-hashira-road[goal]<<endl;
| ~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| int int [2]
|
s752378829 | p00117 | C++ | def show(m,a,b,c,d,x):
for i in xrange(m):
x[a[i]-1][b[i]-1] = c[i]
x[b[i]-1][a[i]-1] = d[i]
return x
def fw(n,x):
for r in xrange(n):
for p in xrange(n):
for q in xrange(n):
if x[p][q] > x[p][r] + x[r][q]:
x[p][q] = x[p][r] + x[r][q]
return x
n = int(input())
m = int(input())
a = []
b = []
c = []
d = []
for i in xrange(m):
e,f,g,h = map(int,raw_input().split(','))
a.append(e)
b.append(f)
c.append(g)
d.append(h)
x1,x2,y1,y2 = map(int,raw_input().split(','))
k = [[1000000000 for x in xrange(n)] for x in xrange(n)]
for i in xrange(n):
for j in xrange(n):
k[i][j] = inf
k = show(m,a,b,c,d,k)
k = fw(n,k)
ans1 = k[x1-1][x2-1]
ans2 = k[x2-1][x1-1]
print int(y1-ans1-y2-ans2) | a.cc:1:1: error: 'def' does not name a type
1 | def show(m,a,b,c,d,x):
| ^~~
|
s135259325 | p00117 | C++ | #include <iostream>
using namespace std;
int main(){
int cost[22][22]={0};
int n,m,i,j,k,a,b,c,d;
char cc;
cin>>n>>m;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cost[i][j] = 1<<28;
}
}
for(i=0;i<m;i++){
cin>>a>>cc>>b>>cc>>c>>cc>>d;
cost[a][b]=c;cost[b][a]=d;
}
for(k=1;k<=n;k++){
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
cin>>a>>cc>>b>>cc>>c>>cc>>d;
cout << c-d-cost[a][b]-cost[b][a] << endl;
} | a.cc:24:5: error: 'cin' does not name a type
24 | cin>>a>>cc>>b>>cc>>c>>cc>>d;
| ^~~
a.cc:25:5: error: 'cout' does not name a type
25 | cout << c-d-cost[a][b]-cost[b][a] << endl;
| ^~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s337725191 | p00117 | C++ | #include <iostream>
using namespace std;
int main(){
int cost[22][22]={0};
int n,m,i,j,k,a,b,c,d;
char cc;
cin>>n>>m;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cost[i][j] = 1<<28;
}
}
for(i=0;i<m;i++){
cin>>a>>cc>>b>>cc>>c>>cc>>d;
cost[a][b]=c;cost[b][a]=d;
}
for(k=1;k<=n;k++){
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
cin>>a>>cc>>b>>cc>>c>>cc>>d;
cout << c-d-cost[a][b]-cost[b][a] << endl;
} | a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s739797588 | p00117 | C++ | #include <list>
#include <queue>
#include <vector>
#include <algorithm>
#include <functional>
#define INF (1LL << 60)
using namespace std;
bool used[200000]; long long dist[200000];
void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q;
for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false;
dist[s] = 0; Q.push(make_pair(0, s));
int cnt = 0;
while (!Q.empty()) {
if (cnt > E) return; // NEGATIVE_CYCLE
pair<long long, int> p = Q.top(); used[p.second] = true; Q.pop();
for (int i = 0; i < X[p.second].size(); i++) {
int to = X[p.second][i].first; long long leng = X[p.second][i].second;
if (dist[to] > dist[p.second] + leng && !used[to]) {
dist[to] = dist[p.second] + leng;
Q.push(make_pair(dist[to], to));
}
}
}
}
int V, E, a, b, c, d, x1, x2, y1, y2; vector<pair<int, int> > G[200000];
int main() {
scanf("%d%d", &V, &E);
for(int i = 0; i < E; i++) {
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
G[a - 1].push_back(make_pair(b - 1, c));
G[b - 1].push_back(make_pair(a - 1, c));
}
scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
dijkstra(V, E, x1 - 1, G);
printf("%d\n", y1 - y2 - dist[x2 - 1]);
} | a.cc:26:31: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
26 | int V, E, a, b, c, d, x1, x2, y1, y2; vector<pair<int, int> > G[200000];
| ^~
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf' was not declared in this scope
28 | scanf("%d%d", &V, &E);
| ^~~~~
a.cc:35:32: error: cannot convert 'std::vector<std::pair<int, int> >*' to 'std::vector<std::pair<int, long long int> >*'
35 | dijkstra(V, E, x1 - 1, G);
| ^
| |
| std::vector<std::pair<int, int> >*
a.cc:9:66: note: initializing argument 4 of 'void dijkstra(int, int, int, std::vector<std::pair<int, long long int> >*)'
9 | void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:36:9: error: 'printf' was not declared in this scope
36 | printf("%d\n", y1 - y2 - dist[x2 - 1]);
| ^~~~~~
a.cc:6:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
5 | #include <functional>
+++ |+#include <cstdio>
6 | #define INF (1LL << 60)
|
s992523173 | p00117 | C++ | #include <list>
#include <queue>
#include <vector>
#include <algorithm>
#include <functional>
#define INF (1LL << 60)
using namespace std;
bool used[200000]; long long dist[200000];
void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q;
for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false;
dist[s] = 0; Q.push(make_pair(0, s));
int cnt = 0;
while (!Q.empty()) {
if (cnt > E) return; // NEGATIVE_CYCLE
pair<long long, int> p = Q.top(); used[p.second] = true; Q.pop();
for (int i = 0; i < X[p.second].size(); i++) {
int to = X[p.second][i].first; long long leng = X[p.second][i].second;
if (dist[to] > dist[p.second] + leng && !used[to]) {
dist[to] = dist[p.second] + leng;
Q.push(make_pair(dist[to], to));
}
}
}
}
int V, E, a, b, c, d, f1, f2, g1, g2; vector<pair<int, int> > G[200000];
int main() {
scanf("%d%d", &V, &E);
for(int i = 0; i < E; i++) {
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
G[a - 1].push_back(make_pair(b - 1, c));
G[b - 1].push_back(make_pair(a - 1, c));
}
scanf("%d,%d,%d,%d", &f1, &f2, &g1, &g2); g1 -= g2;
dijkstra(V, E, f1 - 1, G); g1 -= dist[f2 - 1];
dijkstra(V, E, f2 - 1, G); g1 -= dist[f1 - 1];
printf("%d\n", g1);
} | a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf' was not declared in this scope
28 | scanf("%d%d", &V, &E);
| ^~~~~
a.cc:35:32: error: cannot convert 'std::vector<std::pair<int, int> >*' to 'std::vector<std::pair<int, long long int> >*'
35 | dijkstra(V, E, f1 - 1, G); g1 -= dist[f2 - 1];
| ^
| |
| std::vector<std::pair<int, int> >*
a.cc:9:66: note: initializing argument 4 of 'void dijkstra(int, int, int, std::vector<std::pair<int, long long int> >*)'
9 | void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:36:32: error: cannot convert 'std::vector<std::pair<int, int> >*' to 'std::vector<std::pair<int, long long int> >*'
36 | dijkstra(V, E, f2 - 1, G); g1 -= dist[f1 - 1];
| ^
| |
| std::vector<std::pair<int, int> >*
a.cc:9:66: note: initializing argument 4 of 'void dijkstra(int, int, int, std::vector<std::pair<int, long long int> >*)'
9 | void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:37:9: error: 'printf' was not declared in this scope
37 | printf("%d\n", g1);
| ^~~~~~
a.cc:6:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
5 | #include <functional>
+++ |+#include <cstdio>
6 | #define INF (1LL << 60)
|
s336659011 | p00117 | C++ | #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
struct node
{
list<int> li;
list<int> cost;
};
int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
void sai(int N, int a,int f) {
if (N < m) {
if (f == a) { //&& flag == 0) {
if (min == -1 || min > sum) min = sum;
return;
}
else {
for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
if (min == -1 || min > sum) {
sum += *j;
sai(N + 1, *i, f);
sum -= *j;
}
}
}
}
}
int main()
{
int a, b, c, d, V, P;
scanf_s("%d", &n);
scanf_s("%d", &m);
for (int i = 0; i < m; ++i) {
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
x[a].li.push_back(b); x[a].cost.push_back(c);
x[b].li.push_back(a); x[b].cost.push_back(d);
}
for (int k = 1; k <= n; ++k) {
for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
}
}
scanf_s("%d,%d,%d,%d", &s, &g, &V, &P);
sai(0, s, g);
ans += min; min = -1; sum = 0;
sai(0, g, s);
ans += min;
ans = V - (ans + P);
printf("%d\n", ans);
} | a.cc: In function 'void sai(int, int, int)':
a.cc:18:29: error: reference to 'min' is ambiguous
18 | if (min == -1 || min > sum) min = sum;
| ^~~
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:3:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:18:42: error: reference to 'min' is ambiguous
18 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:18:53: error: reference to 'min' is ambiguous
18 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:22:39: error: 'x' was not declared in this scope
22 | for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
| ^
a.cc:22:106: error: 'j' was not declared in this scope
22 | for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
| ^
a.cc:23:37: error: reference to 'min' is ambiguous
23 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:23:50: error: reference to 'min' is ambiguous
23 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc: In function 'int main()':
a.cc:39:17: error: 'x' was not declared in this scope
39 | x[a].li.push_back(b); x[a].cost.push_back(c);
| ^
a.cc:43:31: error: 'x' was not declared in this scope
43 | for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
| ^
a.cc:43:98: error: 'j' was not declared in this scope
43 | for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
| ^
a.cc:48:16: error: reference to 'min' is ambiguous
48 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:48:21: error: reference to 'min' is ambiguous
48 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:50:16: error: reference to 'min' is ambiguous
50 | ans += min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
|
s475210348 | p00117 | C++ | #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
struct node
{
list<int> li;
list<int> cost;
};
int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
node x[MAX];
void sai(int N, int a,int f) {
if (N < m) {
if (f == a) { //&& flag == 0) {
if (min == -1 || min > sum) min = sum;
return;
}
else {
for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
if (min == -1 || min > sum) {
sum += *j;
sai(N + 1, *i, f);
sum -= *j;
}
}
}
}
}
int main()
{
int a, b, c, d, V, P;
scanf_s("%d", &n);
scanf_s("%d", &m);
for (int i = 0; i < m; ++i) {
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
x[a].li.push_back(b); x[a].cost.push_back(c);
x[b].li.push_back(a); x[b].cost.push_back(d);
}
for (int k = 1; k <= n; ++k) {
for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
}
}
scanf_s("%d,%d,%d,%d", &s, &g, &V, &P);
sai(0, s, g);
ans += min; min = -1; sum = 0;
sai(0, g, s);
ans += min;
ans = V - (ans + P);
printf("%d\n", ans);
} | a.cc: In function 'void sai(int, int, int)':
a.cc:19:29: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
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:3:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:19:42: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:19:53: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:24:37: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:24:50: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc: In function 'int main()':
a.cc:49:16: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:49:21: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:51:16: error: reference to 'min' is ambiguous
51 | ans += min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
|
s814324835 | p00117 | C++ | #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
struct node
{
list<int> li;
list<int> cost;
};
int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
node x[MAX];
void sai(int N, int a,int f) {
if (N < m) {
if (f == a) { //&& flag == 0) {
if (min == -1 || min > sum) min = sum;
return;
}
else {
for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
if (min == -1 || min > sum) {
sum += *j;
sai(N + 1, *i, f);
sum -= *j;
}
}
}
}
}
int main()
{
int a, b, c, d, V, P;
scanf_s("%d", &n);
scanf_s("%d", &m);
for (int i = 0; i < m; ++i) {
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
x[a].li.push_back(b); x[a].cost.push_back(c);
x[b].li.push_back(a); x[b].cost.push_back(d);
}
for (int k = 1; k <= n; ++k) {
for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
}
}
scanf_s("%d,%d,%d,%d", &s, &g, &V, &P);
sai(0, s, g);
ans += min; min = -1; sum = 0;
sai(0, g, s);
ans += min;
ans = V - (ans + P);
printf("%d\n", ans);
} | a.cc: In function 'void sai(int, int, int)':
a.cc:19:29: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
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:3:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:19:42: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:19:53: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:24:37: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:24:50: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc: In function 'int main()':
a.cc:49:16: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:49:21: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
a.cc:51:16: error: reference to 'min' is ambiguous
51 | ans += min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:40: note: 'int min'
14 | int sum = 0, n, m, s, g, ans,flag = 0,min = -1;
| ^~~
|
s913592368 | p00117 | C++ | #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
struct node
{
list<int> li;
list<int> cost;
};
int sum = 0, n, m, s, g, ans, min = -1;
node x[MAX];
void sai(int N, int a,int f) {
if (N < m) {
if (f == a) {
if (min == -1 || min > sum) min = sum;
return;
}
else {
for (auto i = x[a].li.begin(), j = x[a].cost.begin(); i != x[a].li.end(); ++i, ++j) {
if (min == -1 || min > sum) {
sum += *j;
sai(N + 1, *i, f);
sum -= *j;
}
}
}
}
}
int main()
{
int a, b, c, d, V, P;
scanf_s("%d", &n);
scanf_s("%d", &m);
for (int i = 0; i < m; ++i) {
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
x[a].li.push_back(b); x[a].cost.push_back(c);
x[b].li.push_back(a); x[b].cost.push_back(d);
}
for (int k = 1; k <= n; ++k) {
for (auto i = x[k].li.begin(), j = x[k].cost.begin(); i != x[k].li.end(); ++i, ++j) {
}
}
scanf_s("%d,%d,%d,%d", &s, &g, &V, &P);
sai(0, s, g);
ans += min; min = -1; sum = 0;
sai(0, g, s);
ans += min;
ans = V - (ans + P);
printf("%d\n", ans);
} | a.cc: In function 'void sai(int, int, int)':
a.cc:19:29: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
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:3:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:19:42: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:19:53: error: reference to 'min' is ambiguous
19 | if (min == -1 || min > sum) min = sum;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:24:37: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:24:50: error: reference to 'min' is ambiguous
24 | if (min == -1 || min > sum) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc: In function 'int main()':
a.cc:49:16: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:49:21: error: reference to 'min' is ambiguous
49 | ans += min; min = -1; sum = 0;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
a.cc:51:16: error: reference to 'min' is ambiguous
51 | ans += min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: '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:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:14:32: note: 'int min'
14 | int sum = 0, n, m, s, g, ans, min = -1;
| ^~~
|
s121196648 | p00117 | C++ | #include <bits/stdc++.h>
using namespace std;
int n,m;
int place[21][21];
int road[21][21];
int co[21][21];
int maxnum[21],minnum[21];
int serch(int start,int finish,int money,int go,int now)
{
if(money<0)return 0;
if(go==1&&start==now)return money;
if(finish==now)go=1;
int ans=0;
for(int i=minnum[now];i<=maxnum[now];i++){
if(place[now][i]>-1&&co[now][i]<2){
co[now][i]++;
ans=max(ans,serch(start,finish,money-place[now][i],go,i,now));
co[now][i]--;
}
}
return ans;
}
int main() {
cin>>n>>m;
char a;
memset(place,-1,sizeof(place));
for(int i=1;i<21;i++)minnum[i]=22;
for(int i=0,num[4];i<m;i++){
for(int j=0;j<3;j++)cin>>num[j]>>a;
cin>>num[3];
place[num[0]][num[1]]=num[2];
place[num[1]][num[0]]=num[3];
maxnum[num[0]]=max(maxnum[num[0]],num[1]);
maxnum[num[1]]=max(maxnum[num[1]],num[0]);
minnum[num[0]]=min(minnum[num[0]],num[1]);
minnum[num[1]]=min(minnum[num[1]],num[0]);
}
int get[4];
for(int i=0;i<3;i++)cin>>get[i]>>a;
cin>>get[3];
cout<<serch(get[0],get[1],get[2]-get[3],0,get[0])<<endl;
} | a.cc: In function 'int serch(int, int, int, int, int)':
a.cc:17:30: error: too many arguments to function 'int serch(int, int, int, int, int)'
17 | ans=max(ans,serch(start,finish,money-place[now][i],go,i,now));
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: declared here
8 | int serch(int start,int finish,int money,int go,int now)
| ^~~~~
|
s490517194 | p00117 | C++ | #include<iostream>
#include<algorithm>
#define INF 50000000
using namespace std;
int graf[20][20];
int kyo[20];
bool use[20];
void dijk(int ve, int st) {
fill(kyo, kyo + ve, INF);
fill(use, use + ve, false);
kyo[st - 1] = 0;
while (1) {
int v = -1;
for (int i = 0;i < ve; i++) {
if (!use[i] && (v == -1 || kyo[i] < kyo[v]))v = i;
}
if (v == -1)break;
use[v] = true;
for (int i = 0;i < ve;i++) {
kyo[i] = min(kyo[i], kyo[v] + graf[v][i]]);
}
}
return;
}
int main() {
int n, m;
cin >> n >> m;
for (int i = 0;i < n;i++) {
for (int j = 0;j < n;j++)graf[i][j] = INF;
}
for (int i = 0;i < m;i++) {
int a, b, c, d;
scanf("%d,%d,%d,%d", &a, &b, &c, &d);
graf[a - 1][b - 1] = c;
graf[b - 1][a - 1] = d;
}
int s, g, V, P;
scanf("%d,%d,%d,%d", &s, &g, &V, &P);
int m = 0;
dijk(n, s - 1);
m += kyo[g - 1];
dijk(n, g - 1);
m += kyo[s - 1];
cout << V - P - m << endl;
return 0;
} | a.cc: In function 'void dijk(int, int)':
a.cc:23:65: error: expected ')' before ']' token
23 | kyo[i] = min(kyo[i], kyo[v] + graf[v][i]]);
| ~ ^
| )
a.cc: In function 'int main()':
a.cc:46:13: error: redeclaration of 'int m'
46 | int m = 0;
| ^
a.cc:31:16: note: 'int m' previously declared here
31 | int n, m;
| ^
|
s408386866 | p00117 | C++ | #if 0
accept?????????
30?????????????????£???
??????????????????????????????????§£???????????£?????????
??????????????????????????????????§£???????????£????????§
??????????????????????§£????????????????????¨????????????
Floyd-Warshall????????¨??????
#endif
#include <iostream>
using namespace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf=1001001001;
int main() {
long long pay,ans;
for(int i=0;i<32;i++)
for(int j=0;j<32;j++)
K[i][j]=inf;
scanf("%d%d", &N, &M);
for (int i=0; i<M; ++i) {
scanf("%d,%d,%d,%d", &A, &B, &C, &D);
//cerr << "read " << A <<" "<< B <<" " << C <<" " << D<< endl;
//?????????
K[A][B]=C; // A ??? B ????????????C
K[B][A]=D;// B ??? A ????????????D
}
/*
for(int i=1;i<N+1;i++){//?????§?????????
for(int j=1;j<N+1;j++){
if(K[i][j]==inf){
cout<<"i"<<" ";
}else{
cout<<K[i][j]<<" ";
}
}
cout<<endl;
}
*/
for(int k=1;k<N+1;k++){
for(int i=1;i<N+1;i++){
for(int j=1;j<N+1;j++){
if(K[i][j]>K[i][k]+K[k][j]){
K[i][j]=K[i][k]+K[k][j];
}
}
}/*
for(int l=1;l<N+1;l++){//?????§??????2???
for(int m=1;m<N+1;m++){
if(K[l][m]==inf){
cout<<"i"<<" ";
}else{
cout<<K[l][m]<<" ";
}
}
cout<<endl;
}
cout<<endl;*/
}
scanf("%d,%d,%d,%d", &A, &B, &C, &D);
pay=K[A][B]+K[B][A];
ans=C-D-pay;
cout<<ans<<endl;
} | a.cc:3:20: error: extended character £ is not valid in an identifier
3 | 30?????????????????£???
| ^
a.cc:5:35: error: extended character § is not valid in an identifier
5 | ??????????????????????????????????§£???????????£?????????
| ^
a.cc:5:35: error: extended character £ is not valid in an identifier
a.cc:5:48: error: extended character £ is not valid in an identifier
5 | ??????????????????????????????????§£???????????£?????????
| ^
a.cc:6:35: error: extended character § is not valid in an identifier
6 | ??????????????????????????????????§£???????????£????????§
| ^
a.cc:6:35: error: extended character £ is not valid in an identifier
a.cc:6:48: error: extended character £ is not valid in an identifier
6 | ??????????????????????????????????§£???????????£????????§
| ^
a.cc:6:57: error: extended character § is not valid in an identifier
6 | ??????????????????????????????????§£???????????£????????§
| ^
a.cc:7:23: error: extended character § is not valid in an identifier
7 | ??????????????????????§£????????????????????¨????????????
| ^
a.cc:7:23: error: extended character £ is not valid in an identifier
a.cc:16:31: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
16 | int N, M, A, B, C, D, x1, x2, y1, y2;
| ^~
|
s309805664 | p00117 | C++ |
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;
struct edge {
int cost;
int to;
};
ll INF = 1000000000;
int N,M,s,g,v,p;
ll d[110];
vector<edge> G[110];
void dijkstra(int s) {
priority_queue<pl, vector<pl>, greater<pl>> q;
fill(d, d + N, INF);
d[s] = 0;
q.push(pl(0, s));
while (!q.empty()) {
pl p = q.top(); q.pop();
int v = p.second;
if (d[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (d[e.to] > d[v] + e.cost) {
d[e.to] = d[v] + e.cost;
q.push(pl(d[e.to], e.to));
}
}
}
}
int main()
{
ll ans = 0;
cin >> N >> M;
for (int i = 0; i < M; i++) {
int a, b, c, d;
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
a--, b--;
G[a].push_back({c,b});
G[b].push_back({d,a});
}
scanf_s("%d,%d,%d,%d",&s,&g,&v,&p);
s--, g--;
dijkstra(s);
ans += d[g];
dijkstra(g);
ans += d[s];
cout << v - p - ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:63:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
63 | scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
| ^~~~~~~
| scanf
a.cc:68:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
68 | scanf_s("%d,%d,%d,%d",&s,&g,&v,&p);
| ^~~~~~~
| scanf
|
s656851453 | p00117 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;
struct edge {
int cost;
int to;
};
ll INF = 1000000000;
int N,M,s,g,v,p;
ll d[110];
vector<edge> G[110];
void dijkstra(int s) {
priority_queue<pl, vector<pl>, greater<pl> > q;
fill(d, d + N, INF);
d[s] = 0;
q.push(pl(0, s));
while (!q.empty()) {
pl p = q.top(); q.pop();
int v = p.second;
if (d[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (d[e.to] > d[v] + e.cost) {
d[e.to] = d[v] + e.cost;
q.push(pl(d[e.to], e.to));
}
}
}
}
int main()
{
ll ans = 0;
cin >> N >> M;
for (int i = 0; i < M; i++) {
int a, b, c, d;
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
a--, b--;
G[a].push_back({c,b});
G[b].push_back({d,a});
}
scanf_s("%d,%d,%d,%d",&s,&g,&v,&p);
s--, g--;
dijkstra(s);
ans += d[g];
dijkstra(g);
ans += d[s];
cout << v - p - ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:62:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
62 | scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
| ^~~~~~~
| scanf
a.cc:67:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
67 | scanf_s("%d,%d,%d,%d",&s,&g,&v,&p);
| ^~~~~~~
| scanf
|
s406296275 | p00117 | C++ | #include<iostream>
using namespace std;
#define REP(i, n) for(int i=0; i<n; i++)
#define REP1(i, n) for(int i=0; i<n; i++)
int INF = 10e8;
int n, m;
int dis[21][21];
int s, g, v, p;
int main(){
cin >> n >> m;
REP(i, n+1){
REP(j, n+1){
if(i!=0 && i==j){
dis[i][j] = 0;
} else {
dis[i][j] = INF; dis[j][i] = INF;
}
}
}
REP(i, m){
int a, b, c, d;
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
dis[a][b] = c;
dis[b][a] = d;
}
scanf_s("%d,%d,%d,%d", &s, &g, &v, &p);
REP1(k, n+1){
REP1(i, n+1){
REP1(j, n+1){
dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
}
}
}
int output = v - (p + dis[s][g] + dis[g][s]);
cout << output << endl;
} | a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
28 | scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
| ^~~~~~~
| scanf
a.cc:33:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
33 | scanf_s("%d,%d,%d,%d", &s, &g, &v, &p);
| ^~~~~~~
| scanf
|
s464686913 | p00117 | C++ | #include<iostream>
#include<cstdio>
using namespace std;
#define REP(i, n) for(int i=0; i<n; i++)
#define REP1(i, n) for(int i=0; i<n; i++)
int INF = 10e8;
int n, m;
int dis[21][21];
int s, g, v, p;
int main(){
cin >> n >> m;
REP(i, n+1){
REP(j, n+1){
if(i!=0 && i==j){
dis[i][j] = 0;
} else {
dis[i][j] = INF; dis[j][i] = INF;
}
}
}
REP(i, m){
int a, b, c, d;
scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
dis[a][b] = c;
dis[b][a] = d;
}
scanf_s("%d,%d,%d,%d", &s, &g, &v, &p);
REP1(k, n+1){
REP1(i, n+1){
REP1(j, n+1){
dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
}
}
}
int output = v - (p + dis[s][g] + dis[g][s]);
cout << output << endl;
} | a.cc: In function 'int main()':
a.cc:29:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
29 | scanf_s("%d,%d,%d,%d", &a, &b, &c, &d);
| ^~~~~~~
| scanf
a.cc:34:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
34 | scanf_s("%d,%d,%d,%d", &s, &g, &v, &p);
| ^~~~~~~
| scanf
|
s407669204 | p00117 | C++ | #include<bits/stdc++.h>
#define SIZE 100005
#define MAX_V 100001
#define INF (1e9 + 1)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int g[20][20];
int main(){
int n,m;
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
g[i][j]=INF;
}
}
for(int i=0;i<m;i++){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
g[a-1][b-1]=c;
g[b-1][a-1]=d;
}
int s,g,V,P;
scanf("%d%d%d%d",&s,&g,&V,&P);
for(int k=0;k<n;k++)
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
printf("%d\n",V-P-g[s][g]);
}
| a.cc: In function 'int main()':
a.cc:29:34: error: invalid types 'int[int]' for array subscript
29 | g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
| ^
a.cc:29:46: error: invalid types 'int[int]' for array subscript
29 | g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
| ^
a.cc:29:54: error: invalid types 'int[int]' for array subscript
29 | g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
| ^
a.cc:29:62: error: invalid types 'int[int]' for array subscript
29 | g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
| ^
a.cc:30:28: error: invalid types 'int[int]' for array subscript
30 | printf("%d\n",V-P-g[s][g]);
| ^
|
s794330781 | p00117 | C++ | #include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;
int main(){
int n,m;
int a[20][20];
cin>>n>>m;
fill(&a[0][0],&a[20][20],INT_MAX/2);
for(int i=0;i<m;i++){
int b,c,d,e;
cin>>b>>c>>d>>e;
a[b][c]=d;
a[c][b]=e;
}
int s,g,gold,p;
cin>>s>>g>>gold>>p;
for(int k=0;k<n;k++){
for(int i=0;i<n;i++){
for(int t=0;t<n;t++){
if(a[i][t]>a[i][k]+a[k][t]){a[i][t]=a[i][k]+a[k][t];}
}
}
}
cout<<gold-p-a[s][g];
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:30: error: 'INT_MAX' was not declared in this scope
24 | fill(&a[0][0],&a[20][20],INT_MAX/2);
| ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
12 | #include<numeric>
+++ |+#include <climits>
13 | using namespace std;
|
s575997281 | p00117 | C++ | #include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;
int main(){
int n,m;
int a[20][20];
cin>>n>>m;
fill(&a[0][0],&a[20][20],INT_MAX/2);
for(int i=0;i<m;i++){
int b,c,d,e;
scanf("%d%d%d%d",&b,&c,&d,&e);
a[b][c]=d;
a[c][b]=e;
}
int s,g,gold,p;
scanf("%d%d%d%d",&s,&g,&gold,&p);
for(int k=0;k<n;k++){
for(int i=0;i<n;i++){
for(int t=0;t<n;t++){
if(a[i][t]>a[i][k]+a[k][t]){a[i][t]=a[i][k]+a[k][t];}
}
}
}
cout<<gold-p-a[s][g];
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:30: error: 'INT_MAX' was not declared in this scope
24 | fill(&a[0][0],&a[20][20],INT_MAX/2);
| ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
12 | #include<numeric>
+++ |+#include <climits>
13 | using namespace std;
|
s359964447 | p00117 | C++ | #include <stdio.h>
#include <math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;
int main(){
int n,m;
int a[20][20];
cin>>n>>m;
fill(&a[0][0],&a[20][20],INT_MAX/2);
for(int i=0;i<m;i++){
int b,c,d,e;
scanf("%d,%d,%d,%d",&b,&c,&d,&e);
a[b][c]=d;
a[c][b]=e;
}
int s,g,gold,p;
scanf("%d,%d,%d,%d",&s,&g,&gold,&p);
for(int k=0;k<n;k++){
for(int i=0;i<n;i++){
for(int t=0;t<n;t++){
if(a[i][t]>a[i][k]+a[k][t]){a[i][t]=a[i][k]+a[k][t];}
}
}
}
cout<<gold-p-a[s][g];
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:30: error: 'INT_MAX' was not declared in this scope
24 | fill(&a[0][0],&a[20][20],INT_MAX/2);
| ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
12 | #include<numeric>
+++ |+#include <climits>
13 | using namespace std;
|
s759065937 | p00117 | C++ | #include<iostream>
#include<vector>
#include<string.h>
#include<stdlib.h>
using namespace std;
struct Node{
int num;
vector<int> edge_to;
vector<int> edge_cost;
bool done;
int cost;
};
vector<string> splitAll(string s, string t) {
vector<string> v;
for (int p = 0; (p = s.find(t)) != s.npos; ) {
v.push_back(s.substr(0, p));
s = s.substr(p + t.size());
}
v.push_back(s);
return v;
}
int dijkstra (vector<Node> g,int start,int goal){
int d;
g[start].cost=0;
while(1){
d=-1;
for(int i=1;i<=g.size();i++){
if( g[i].done || g[i].cost < 0 ) continue;
if( d==-1 || g[i].cost < g[d].cost ) d=i;
}
if(d==-1) break;
g[d].done=true;
for(int i=0; i< g[d].edge_to.size(); i++){
int to = g[d].edge_to[i];
int cost = g[d].cost + g[d].edge_cost[i];
if(g[to].cost < 0 || cost < g[to].cost)
g[to].cost = cost;
}
}
return g[goal].cost;
}
int main(){
int n,m;
cin>>n;
vector<Node> graph;
graph.reserve(n+1);
graph.resize(n+1);
for(int i=1; i<=n; i++){
graph[i].num=(i+1);
graph[i].cost=-1;
graph[i].done=false;
}
string s;
cin>>m;
getline(cin,s);
int a,b,c,d;
vector<string> vv;
vv.reserve(4);
vv.resize(4);
while(m--){
getline(cin,s);
vv = splitAll(s,",");
a = atoi( vv[0].c_str() );
b = atoi( vv[1].c_str() );
c = atoi( vv[2].c_str() );
d = atoi( vv[3].c_str() );
graph[a].edge_to.push_back(b);
graph[a].edge_cost.push_back(c);
graph[b].edge_to.push_back(a);
graph[b].edge_cost.push_back(d);
}
int x1,x2,y1,y2;
getline(cin,s);
vv = splitAll(s,",");
x1 = atoi( vv[0].c_str() );
x2 = atoi( vv[1].c_str() );
y1 = atoi( vv[2].c_str() );
y2 = atoi( vv[3].c_str() );
vector<Node> n;
n.reserve(n+1);
n.assign(graph.begin(),graph.end());
int rcost = dijkstra(graph,x2,x1);
int gcost = dijkstra(n,x1,x2);
cout<<y1-y2-rcost-gcost<<endl;
} | a.cc: In function 'int main()':
a.cc:103:16: error: conflicting declaration 'std::vector<Node> n'
103 | vector<Node> n;
| ^
a.cc:55:7: note: previous declaration as 'int n'
55 | int n,m;
| ^
a.cc:104:5: error: request for member 'reserve' in 'n', which is of non-class type 'int'
104 | n.reserve(n+1);
| ^~~~~~~
a.cc:105:5: error: request for member 'assign' in 'n', which is of non-class type 'int'
105 | n.assign(graph.begin(),graph.end());
| ^~~~~~
a.cc:108:24: error: could not convert 'n' from 'int' to 'std::vector<Node>'
108 | int gcost = dijkstra(n,x1,x2);
| ^
| |
| int
|
s546324903 | p00117 | C++ | #include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;
int d[21][21];
int main(){
char ch;
int n, m;
memset(d, -1, sizeof(d));
int x1, x2, y1, y2;
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b, c, d2;
cin >> a >> ch >> b >> ch >> c >> ch >> d2;
d[a][b] = c;
d[b][a] = d2;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(d[j][i] < 0) continue;
for(int k = 1; k <= n; k++){
if(d[i][k] >= 0 && (d[j][k] < 0 || d[j][k] > d[j][i] + d[i][k])){
d[j][k] = d[j][i] + d[i][k];
}
}
}
}
cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;
cout << y1 - y2 - d[x1][x2] - d[x2][x1] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
12 | memset(d, -1, sizeof(d));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <queue>
+++ |+#include <cstring>
4 | #include <string>
|
s506336553 | p00117 | C++ | #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
void f(int a[][21],int b[],int c,int e,int m){
int i;
if(c==e){
if(b[c]==-1||b[c]>m)
b[c]=m;
}else if(b[c]==-1||b[c]>m){
b[c]=m;
for(i=1;i<21;i++){
if(a[c][i])
f(a,b,i,e,m+a[c][i]);
}
}
return;
}
int main(){
int i;
int a[21][21],b[21],m,n,v,w,x,y;
memset(a,0,sizeof(a));
cin>>n>>m;
for(i=0;i<m;i++){
int p,q,r,s;
scanf("%d,%d,%d,%d",&p,&q,&r,&s);
a[p][q]=r;
a[q][p]=s;
}
scanf("%d,%d,%d,%d",&v,&w,&x,&y);
memset(b,-1,sizeof(b));
f(a,b,v,w,0);
x-=b[w];
memset(b,-1,sizeof(b));
f(a,b,w,v,0);
x-=b[v];
cout<<x-y>0?x-y:0<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:43:12: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int')
43 | cout<<x-y>0?x-y:0<<endl;
| ~~~~~~~~~^~
| | |
| | int
| std::basic_ostream<char>
a.cc:43:12: note: candidate: 'operator>(int, int)' (built-in)
43 | cout<<x-y>0?x-y:0<<endl;
| ~~~~~~~~~^~
a.cc:43:12: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::vector<_Tp, _Alloc>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/vector:87:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
In file included from /usr/include/c++/14/list:65,
from a.cc:2:
/usr/include/c++/14/bits/stl_list.h:2203:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const __cxx11::list<_Tp, _Alloc>&, const __cxx11::list<_Tp, _Alloc>&)'
2203 | operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_list.h:2203:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::list<_Tp, _Alloc>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:4:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:43:13: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
43 | cout<<x-y>0?x-y:0<<endl;
| ^
a.cc:43:20: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
43 | cout<<x-y>0?x-y:0<<endl;
| ~^~~~~~
|
s249127128 | p00117 | C++ | }
int x1, x2, y1, y2;
scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
//processing
int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
res = y1 - y2 - lowest;
std::cout << wfloyd(n,x1,x2) << std::endl;
std::cout << wfloyd(n,x2,x1) << std::endl;
std::cout << res << std::endl;
return 0;
} | a.cc:1:9: error: expected declaration before '}' token
1 | }
| ^
a.cc:3:21: warning: built-in function 'y1' declared as non-function [-Wbuiltin-declaration-mismatch]
3 | int x1, x2, y1, y2;
| ^~
a.cc:4:14: error: expected constructor, destructor, or type conversion before '(' token
4 | scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
| ^
a.cc:8:29: error: 'n' was not declared in this scope
8 | int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
| ^
a.cc:8:22: error: 'wfloyd' was not declared in this scope
8 | int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
| ^~~~~~
a.cc:8:47: error: 'n' was not declared in this scope
8 | int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
| ^
a.cc:8:40: error: 'wfloyd' was not declared in this scope
8 | int lowest = wfloyd(n,x1,x2) + wfloyd(n,x2,x1),
| ^~~~~~
a.cc:11:14: error: 'cout' in namespace 'std' does not name a type
11 | std::cout << wfloyd(n,x1,x2) << std::endl;
| ^~~~
a.cc:1:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | }
a.cc:12:14: error: 'cout' in namespace 'std' does not name a type
12 | std::cout << wfloyd(n,x2,x1) << std::endl;
| ^~~~
a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
12 | std::cout << wfloyd(n,x2,x1) << std::endl;
| ^~~
a.cc:13:14: error: 'cout' in namespace 'std' does not name a type
13 | std::cout << res << std::endl;
| ^~~~
a.cc:13:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
13 | std::cout << res << std::endl;
| ^~~
a.cc:14:9: error: expected unqualified-id before 'return'
14 | return 0;
| ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
15 | }
| ^
|
s695568949 | p00117 | C++ | #include <iostream>
using namespace std;
#define INF (1<<30)
int dist[30][30];
int main(){
int n, m;
cin >> n >> m;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i == j)dist[i][j] = 0;
else dist[i][j] = INF;
}
}
for(int i=0;i<m;i++){
int a, b, c, d;
cin >> a >> b >> c >> d;
dist[a-1][b-1] = c;
dist[b-1][a-1] = d;
}
for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)
dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
int x1, x2, y1, y2;
cin >> x1 >> x2 >> y1 >> y2;
cout << (y1 - y2 - dist[x1-1][x2-1] - dist[x2-1][x1-1]) << endl;
return 0;
} | a.cc:32:44: error: extended character is not valid in an identifier
32 | cout << (y1 - y2 - dist[x1-1][x2-1] - dist[x2-1][x1-1]) << endl;
| ^
a.cc: In function 'int main()':
a.cc:32:44: error: expected ')' before '\U00003000'
32 | cout << (y1 - y2 - dist[x1-1][x2-1] - dist[x2-1][x1-1]) << endl;
| ~ ^~
| )
|
s026063959 | p00117 | C++ | #include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;
const int INF = 987654321;
const double EPS = 1e-10;
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
os<<'[';
rep(i,a.size()) os<<(i?" ":"")<<a[i];
return os<<']';
}
int G[20][20];
int dp[20][20];
int V;
void warshall_floyd() {
rep(k, V) rep(i, V) rep(j, V) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
int main() {
int n; cin >> n;
int m; cin >> m;
rep(i, 20) rep(j, 20) G[i][j] = INF;
rep(i, m) {
int a, b, c, d; scanf("%d,%d,%d,%d", &a, &b, &c, &d);
G[a - 1][b - 1] = c;
G[b - 1][a - 1] = d;
}
int x1, x2, y1, y2; scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
V = n;
rep(i, n) rep(j, n) dp[i][j] = G[i][j];
"rep(i, n) dp[i][i] = 0;
warshall_floyd();
cout << y1 - dp[x1 - 1][x2 - 1] - dp[x2 - 1][x1 - 1] - y2 << endl;
return 0;
} | a.cc:77:5: warning: missing terminating " character
77 | "rep(i, n) dp[i][i] = 0;
| ^
a.cc:77:5: error: missing terminating " character
77 | "rep(i, n) dp[i][i] = 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~
|
s527306172 | p00117 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, m;
int x1, x2, y1, y2;
char dummy;
cin >> n;
cin >> m;
vector<int> a(m), b(m), c(m), d(m);
vector< vector <int> > map(n + 1, vector<int>(n + 1, INT_MAX / 4));
for(int i = 0; i < m; i++) {
cin >> a[i] >> dummy >> b[i] >> dummy >> c[i] >> dummy >> d[i];
}
cin >> x1 >> dummy >> x2 >> dummy >> y1 >> dummy >> y2;
for(int i = 0; i < m; i++) {
map[a[i]][b[i]] = c[i];
map[b[i]][a[i]] = d[i];
}
for(int i = 0; i < n; i++) {
map[i][i] = 0;
}
for(int k = 0; k < n + 1; k++) {
for(int i = 0; i < n + 1; i++) {
for(int j = 0; j < n + 1; j++) {
map[i][j] = min(map[i][j], map[i][k] + map[k][j]);
}
}
}
y1 -= map[x1][x2] + map[x2][x1] + y2;
cout << y1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:62: error: 'INT_MAX' was not declared in this scope
17 | vector< vector <int> > map(n + 1, vector<int>(n + 1, INT_MAX / 4));
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <algorithm>
+++ |+#include <climits>
5 |
|
s601815399 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new int[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:7: error: incompatible types: int[][] cannot be converted to String[][]
String[][] k=new int[H][W];
^
Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
^
symbol: variable next
location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=k[x][y];
^
symbol: variable k
location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable H
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable W
location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
^
symbol: variable H
location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
^
symbol: variable W
location: class Main
10 errors
|
s786659743 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
public int H=sc.nextInt();
public int W=sc.nextInt();
public String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:5: error: illegal start of expression
public int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
void kukaku(int x,int y){
^
(use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
|
s078467358 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
public int H=sc.nextInt();
public int W=sc.nextInt();
public String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:5: error: illegal start of expression
public int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
void kukaku(int x,int y){
^
(use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
|
s695177329 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
^
symbol: variable next
location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=k[x][y];
^
symbol: variable k
location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable H
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable W
location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
^
symbol: variable H
location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
^
symbol: variable W
location: class Main
9 errors
|
s573825234 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
}
void kukaku(int x,int y){
String p=this.k[x][y];
this.k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<this.H;i++){
for(int j=0;j<this.W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:10: error: cannot find symbol
k[i][j]=sc.next;
^
symbol: variable next
location: variable sc of type Scanner
Main.java:13: error: non-static method solve() cannot be referenced from a static context
solve();
^
Main.java:16: error: cannot find symbol
String p=this.k[x][y];
^
symbol: variable k
Main.java:17: error: cannot find symbol
this.k[x][y]=".";
^
symbol: variable k
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
^
symbol: variable k
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
^
symbol: variable H
Main.java:21: error: cannot find symbol
if(p!="."&&p==this.k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<this.H&&y+dy[i]>=0&&y+dy[i]<this.W){
^
symbol: variable W
Main.java:29: error: cannot find symbol
for(int i=0;i<this.H;i++){
^
symbol: variable H
Main.java:30: error: cannot find symbol
for(int j=0;j<this.W;j++){
^
symbol: variable W
9 errors
|
s340411090 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
} | Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:26: error: illegal start of expression
public void solve(){
^
Main.java:37: error: class, interface, enum, or record expected
}
^
6 errors
|
s681996585 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
} | Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:26: error: illegal start of expression
void solve(){
^
Main.java:26: error: ';' expected
void solve(){
^
6 errors
|
s479343715 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next;
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
} | Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:26: error: illegal start of expression
void solve(){
^
Main.java:26: error: ';' expected
void solve(){
^
6 errors
|
s195819185 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
}
} | Main.java:14: error: illegal start of expression
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:14: error: <identifier> expected
void kukaku(int x,int y){
^
Main.java:14: error: ';' expected
void kukaku(int x,int y){
^
Main.java:26: error: illegal start of expression
void solve(){
^
Main.java:26: error: ';' expected
void solve(){
^
6 errors
|
s653051600 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
protected int H=sc.nextInt();
protected int W=sc.nextInt();
protected String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:5: error: illegal start of expression
protected int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
void kukaku(int x,int y){
^
(use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
|
s801179958 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
protected int H=sc.nextInt();
protected int W=sc.nextInt();
protected String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
public static void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public static void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:5: error: illegal start of expression
protected int H=sc.nextInt();
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:13: error: invalid method declaration; return type required
solve();
^
Main.java:15: error: unnamed classes are a preview feature and are disabled by default.
public static void kukaku(int x,int y){
^
(use --enable-preview to enable unnamed classes)
Main.java:37: error: class, interface, enum, or record expected
}
^
7 errors
|
s812359658 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
solve();
}
public static void kukaku(int x,int y){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
kukaku(x+dx[i],y+dy[i]);
}
}
return;
}
public static void solve(){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j);
num++;
}
}
System.out.println(num);
}
} | Main.java:16: error: cannot find symbol
String p=k[x][y];
^
symbol: variable k
location: class Main
Main.java:17: error: cannot find symbol
k[x][y]=".";
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable k
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable H
location: class Main
Main.java:21: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<H&&y+dy[i]>=0&&y+dy[i]<W){
^
symbol: variable W
location: class Main
Main.java:29: error: cannot find symbol
for(int i=0;i<H;i++){
^
symbol: variable H
location: class Main
Main.java:30: error: cannot find symbol
for(int j=0;j<W;j++){
^
symbol: variable W
location: class Main
7 errors
|
s993187823 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
return;
}
} | Main.java:21: error: illegal start of expression
public static void kukaku(int x,int y,int h,int w){
^
1 error
|
s739555405 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
return;
}
}
} | Main.java:21: error: illegal start of expression
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
^
6 errors
|
s059059328 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
}
} | Main.java:21: error: illegal start of expression
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: <identifier> expected
void kukaku(int x,int y,int h,int w){
^
Main.java:21: error: ';' expected
void kukaku(int x,int y,int h,int w){
^
6 errors
|
s907335518 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
} | Main.java:32: error: reached end of file while parsing
}
^
1 error
|
s803222388 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
} | Main.java:16: error: non-static method kukaku(int,int,int,int) cannot be referenced from a static context
kukaku(i,j,H,W);
^
Main.java:23: error: cannot find symbol
String p=k[x][y];
^
symbol: variable k
location: class Main
Main.java:24: error: cannot find symbol
k[x][y]=".";
^
symbol: variable k
location: class Main
Main.java:28: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
^
symbol: variable k
location: class Main
4 errors
|
s354705825 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
} | Main.java:23: error: cannot find symbol
String p=k[x][y];
^
symbol: variable k
location: class Main
Main.java:24: error: cannot find symbol
k[x][y]=".";
^
symbol: variable k
location: class Main
Main.java:28: error: cannot find symbol
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
^
symbol: variable k
location: class Main
3 errors
|
s529445396 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
public String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(int x,int y,int h,int w){
String p=k[x][y];
k[x][y]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[x+dx[i]][y+dy[i]]&&x+dx[i]>=0&&x+dx[i]<h&&y+dy[i]>=0&&y+dy[i]<w){
kukaku(x+dx[i],y+dy[i],h,w);
}
}
}
} | Main.java:7: error: illegal start of expression
public String[][] k=new String[H][W];
^
Main.java:8: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:8: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:8: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:14: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:14: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:14: error: <identifier> expected
for(int i=0;i<H;i++){
^
Main.java:20: error: <identifier> expected
System.out.println(num);
^
Main.java:20: error: <identifier> expected
System.out.println(num);
^
Main.java:22: error: unnamed classes are a preview feature and are disabled by default.
public static void kukaku(int x,int y,int h,int w){
^
(use --enable-preview to enable unnamed classes)
Main.java:33: error: class, interface, enum, or record expected
}
^
11 errors
|
s869663684 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(k,i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(String[] k,int I,int J,int h,int w){
String p=k[I][J];
k[I][J]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
kukaku(k,I+dx[i],J+dy[i],h,w);
}
}
}
} | Main.java:16: error: incompatible types: String[][] cannot be converted to String[]
kukaku(k,i,j,H,W);
^
Main.java:23: error: array required, but String found
String p=k[I][J];
^
Main.java:24: error: array required, but String found
k[I][J]=".";
^
Main.java:28: error: array required, but String found
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
|
s518571028 | p00118 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
kukaku(k,i,j,H,W);
num++;
}
}
System.out.println(num);
}
public static void kukaku(String k[],int I,int J,int h,int w){
String p=k[I][J];
k[I][J]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
kukaku(k,I+dx[i],J+dy[i],h,w);
}
}
}
} | Main.java:16: error: incompatible types: String[][] cannot be converted to String[]
kukaku(k,i,j,H,W);
^
Main.java:23: error: array required, but String found
String p=k[I][J];
^
Main.java:24: error: array required, but String found
k[I][J]=".";
^
Main.java:28: error: array required, but String found
if(p!="."&&p==k[I+dx[i]][J+dy[i]]&&i+dx[i]>=0&&I+dx[i]<h&&J+dy[i]>=0&&J+dy[i]<w){
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
|
s170638090 | p00118 | Java | import java.util.*;
public class Main{
Scanner sc=new Scanner(System.in);
int H=sc.nextInt();
int W=sc.nextInt();
String[][] k=new String[H][W];
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
k[i][j]=sc.next();
}
}
public static void main(String[] args){
int num=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(k[i][j]!="."){
kukaku(k,i,j,H,W);
num++;
}
}
}
System.out.println(num);
}
public static void kukaku(int I,int J){
String p=k[I][J];
k[I][J]=".";
int[] dx={-1,0,0,1};
int[] dy={0,-1,1,0};
for(int i=0;i<4;i++){
if(p==k[I+dx[i]][J+dy[i]]&&I+dx[i]>=0&&I+dx[i]<H&&J+dy[i]>=0&&J+dy[i]<W){
kukaku(I+dx[i],J+dy[i]);
}
return;
}
}
} | Main.java:14: error: illegal start of type
for(int i=0;i<H;i++){
^
Main.java:14: error: > or ',' expected
for(int i=0;i<H;i++){
^
Main.java:14: error: <identifier> expected
for(int i=0;i<H;i++){
^
3 errors
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.