submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s035354999 | p00186 | C++ | #include <iostream>
#include <csdio>
using namespace std;
int main(void)
{
int q1, b, c1, c2, q2;
while(1){
scanf("%d", &q1);
if (q1 == 0) break;
scanf("%d %d %d %d", &b, &c1, &c2, &q2);
if (c1 <= c2){
int x = min(b/c1, q2);
int y = ((b - x) * c1) / c2;
if ((x + y) < q1){
printf("NA\n");
}
else {
printf("%d %d\n", x, y);
}
}
else {
int x = min(min(((b - c2) * q1) / (c1 - c2), q2), (b / c1));
int y = ((b - x) * c1) / c2;
if(x <= 0){
printf("NA\n");
}
else {
printf("%d %d\n", x, y);
}
}
}
return 0;
} | a.cc:2:10: fatal error: csdio: No such file or directory
2 | #include <csdio>
| ^~~~~~~
compilation terminated.
|
s948640742 | p00186 | C++ | g#include <iostream>
using namespace std;
int main() {
int q1, b, c1, c2, q2;
while(cin >> q1, q1) {
cin >> b >> c1 >> c2 >> q2;
int aizu = min(b / c1, q2);
if (aizu == 0) {
cout << "NA" << endl;
continue;
}
int money = b - aizu * c1;
int ordinal = money / c2;
bool possible = true;
while (aizu + ordinal < q1) {
aizu--;
if (aizu == 0) {
cout << "NA" << endl;
possible = false;
break;
}
money = b - aizu * c1;
ordinal = money / c2;
money = b - aizu * c1 - ordinal * c2;
}
if (possible) cout << aizu << ' ' << ordinal << endl;
}
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | g#include <iostream>
| ^
a.cc:1:1: error: 'g' does not name a type
1 | g#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:7:15: error: 'cin' was not declared in this scope
7 | while(cin >> q1, q1) {
| ^~~
a.cc:9:23: error: 'min' was not declared in this scope; did you mean 'main'?
9 | int aizu = min(b / c1, q2);
| ^~~
| main
a.cc:11:20: error: 'cout' was not declared in this scope
11 | cout << "NA" << endl;
| ^~~~
a.cc:11:36: error: 'endl' was not declared in this scope
11 | cout << "NA" << endl;
| ^~~~
a.cc:21:28: error: 'cout' was not declared in this scope
21 | cout << "NA" << endl;
| ^~~~
a.cc:21:44: error: 'endl' was not declared in this scope
21 | cout << "NA" << endl;
| ^~~~
a.cc:29:26: error: 'cout' was not declared in this scope
29 | if (possible) cout << aizu << ' ' << ordinal << endl;
| ^~~~
a.cc:29:60: error: 'endl' was not declared in this scope
29 | if (possible) cout << aizu << ' ' << ordinal << endl;
| ^~~~
|
s305755668 | p00186 | C++ | #include<ios>
main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}} | a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
| ^~~~
a.cc: In function 'int main()':
a.cc:2:35: error: 'cin' is not a member of 'std'
2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<ios>
+++ |+#include <iostream>
2 | main(){for(int q,b,c,d,r,A,N;std::cin>>q>>b>>c>>d>>r,q;A?printf("%d %d\n",A,N):printf("NA\n"))for(A=0;r;r--){N=(b-r*c)/d;if(b>=r*c&&N+r>=q){A=r;r=1;}}}
|
s732779468 | p00186 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef unsigned long long ull;
class AOJ0186{
private:
int q1,b,c1,c2,q2;
public:
AOJ0186(int a,int b,int c,int d,int f):q1(a),b(b),c1(c),c2(d),q2(f){}
~AOJ0186(){}
void run(){
int aizu_meet,meet;
bool ok = false;
int preb = b;
for(int i=q2;i>=1;i--){
aizu_meet = meet = 0,b = preb;
if(i*c1 > b)continue;
aizu_meet = i;
b -= (c1*i);
meet = b/c2;
//cout << "i =" << i << endl;
//cout << aizu_meet << ' ' << meet << ", b = " << b << endl;
if(aizu_meet+meet < q1)continue;
if(aizu_meet == 0)continue;
ok = true;
cout << aizu_meet << ' ' << meet << endl;
//cout << "i = " << i << endl;
break;
}
if(!ok)cout << "NA" << endl; | a.cc:38:30: error: expected '}' at end of input
38 | if(!ok)cout << "NA" << endl;
| ^
a.cc:7:14: note: to match this '{'
7 | class AOJ0186{
| ^
a.cc: In member function 'void AOJ0186::run()':
a.cc:38:30: error: expected '}' at end of input
38 | if(!ok)cout << "NA" << endl;
| ^
a.cc:16:13: note: to match this '{'
16 | void run(){
| ^
a.cc: At global scope:
a.cc:38:30: error: expected unqualified-id at end of input
38 | if(!ok)cout << "NA" << endl;
| ^
|
s318838649 | p00186 | C++ | #include <iostream>
using namespace std;
int main(){
int b,c1,c2,q1,q2,aizu,ord;
while(cin>>q1,q1){
cin>>b>>c1>>c2>>q2;
if(b/c1>q2){
aizu=q2;
ord=(b-c1*q2)/c2;
}else{
aizu=b/c1;
ord=(b%c1)/c2;
}
//cout<<aizu<<" "<<ord<<endl;
if(c1>b){cout<<"NA"<<endl;}
else if((aizu+ord)<q1){
for(int i=aizu-1;i>0;i--){
bool flag=false;
if((c1*i+c2*(q1-i))<b){
flag=true;
cout<<i<<" "<<(b-c1*i)/c2<<endl;
break;
}
}
if(!flag){
cout<<"NA"<<endl;
}
}else{
cout<<aizu<<" "<<ord<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:29: error: 'flag' was not declared in this scope
26 | if(!flag){
| ^~~~
|
s180621031 | p00186 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <sstream>
using namespace std;
void failed() {
cout << "NA" << endl;
}
int main() {
int Q1, B, C1, C2, Q2;
while(cin >> Q1) {
if(Q1 == 0) break;
cin >> B >> C1 >> C2 >> Q2;
stringstream ss; ss << "Q: " << Q1 << " B: " << B << " C1: " << C1 << " C2: " << C2 << " Q2: " << Q2;
assert(Q2 >= 1 && ss.str());
/*
if(B/C1 == 0) {
failed(); continue;
}
*/
int AizuCh = min(B/C1, Q2);
if(AizuCh <= 0) { failed(); continue; }
int NCh = 0;
for(;;) {
NCh = (B - AizuCh*C1)/C2;
/*
if(B - (NCh+1)*C2 - AizuCh*C1 >= 0) {
NCh = (B - AizuCh*C1)/C2;
}
*/
if(AizuCh + NCh >= Q1) {
cout << AizuCh << ' ' << NCh << endl; break;
}
/*
else if(B - (NCh+1)*C2 - (AizuCh-1)*C1 >= 0) {
NCh ++, AizuCh --;
}
*/
else AizuCh --;
if(AizuCh <= 0) { failed(); break; }
}
}
return 0;
} | In file included from /usr/include/c++/14/cassert:44,
from a.cc:4:
a.cc: In function 'int main()':
a.cc:25:20: error: no match for 'operator&&' (operand types are 'bool' and 'std::__cxx11::basic_stringstream<char>::__string_type' {aka 'std::__cxx11::basic_string<char>'})
25 | assert(Q2 >= 1 && ss.str());
| ~~~~~~~ ^~ ~~~~~~~~
| | |
| bool std::__cxx11::basic_stringstream<char>::__string_type {aka std::__cxx11::basic_string<char>}
a.cc:25:20: note: candidate: 'operator&&(bool, bool)' (built-in)
25 | assert(Q2 >= 1 && ss.str());
| ~~~~~~~~^~~~~~~~~~~
a.cc:25:20: note: no known conversion for argument 2 from 'std::__cxx11::basic_stringstream<char>::__string_type' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
|
s274373485 | p00187 | C | #include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
Point p[3], q[3], x[3];
double S;
while (1){
for (int i = 0; i < 3; i++){
int x1, y1, x2, y2;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
if (i == 0 && x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) return (0);
p[i] = Point(x1, y1); q[i] = Point(x2, y2);
}
int k = 0;
for (int i = 0; i < 3; i++){
for (int j = i + 1; j < 3; j++){
if (!isIntersect(p[i], q[i], p[j], q[j])){
printf("kyo\n");
goto next;
}
x[k++] = interPointS(p[i], q[i], p[j], q[j]);
}
}
if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
printf("kyo\n");
goto next;
}
S = area(x[0], x[1], x[2]);
if (S >= 1900000) printf("dai-kichi\n");
else if (S >= 1000000) printf("chu-kichi\n");
else if (S >= 100000) printf("kichi\n");
else printf("syo-kichi\n");
next:;
}
return (0);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s434343968 | p00187 | C++ | #include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
Point p[3], q[3], x[3];
double S;
while (1){
for (int i = 0; i < 3; i++){
int x1, y1, x2, y2;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
if (i == 0 && x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) return (0);
p[i] = Point(x1, y1); q[i] = Point(x2, y2);
}
int k = 0;
for (int i = 0; i < 3; i++){
for (int j = i + 1; j < 3; j++){
if (!isIntersect(p[i], q[i], p[j], q[j])){
printf("kyo\n");
goto next;
}
x[k++] = interPointS(p[i], q[i], p[j], q[j]);
}
}
if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
printf("kyo\n");
goto next;
}
S = area(x[0], x[1], x[2]);
if (S >= 1900000) printf("dai-kichi\n");
else if (S >= 1000000) printf("chu-kichi\n");
else if (S >= 100000) printf("kichi\n");
else printf("syo-kichi\n");
next:;
}
return (0);
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'Point' was not declared in this scope
10 | Point p[3], q[3], x[3];
| ^~~~~
a.cc:20:25: error: 'p' was not declared in this scope
20 | p[i] = Point(x1, y1); q[i] = Point(x2, y2);
| ^
a.cc:20:47: error: 'q' was not declared in this scope
20 | p[i] = Point(x1, y1); q[i] = Point(x2, y2);
| ^
a.cc:26:50: error: 'p' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^
a.cc:26:56: error: 'q' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^
a.cc:26:38: error: 'isIntersect' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^~~~~~~~~~~
a.cc:30:33: error: 'x' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:54: error: 'p' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:60: error: 'q' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:42: error: 'interPointS' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^~~~~~~~~~~
a.cc:34:21: error: 'x' was not declared in this scope
34 | if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
| ^
a.cc:39:26: error: 'x' was not declared in this scope
39 | S = area(x[0], x[1], x[2]);
| ^
a.cc:39:21: error: 'area' was not declared in this scope
39 | S = area(x[0], x[1], x[2]);
| ^~~~
|
s365019064 | p00187 | C++ | #include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
Point p[3], q[3], x[3];
double S;
while (1){
for (int i = 0; i < 3; i++){
int x1, y1, x2, y2;
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
if (i == 0 && x1 == 0 && x2 == 0 && y1 == 0 && y2 == 0) return (0);
p[i] = Point(x1, y1); q[i] = Point(x2, y2);
}
int k = 0;
for (int i = 0; i < 3; i++){
for (int j = i + 1; j < 3; j++){
if (!isIntersect(p[i], q[i], p[j], q[j])){
printf("kyo\n");
goto next;
}
x[k++] = interPointS(p[i], q[i], p[j], q[j]);
}
}
if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
printf("kyo\n");
goto next;
}
S = area(x[0], x[1], x[2]);
if (S >= 1900000) printf("dai-kichi\n");
else if (S >= 1000000) printf("chu-kichi\n");
else if (S >= 100000) printf("kichi\n");
else printf("syo-kichi\n");
next:;
}
return (0);
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'Point' was not declared in this scope
10 | Point p[3], q[3], x[3];
| ^~~~~
a.cc:20:25: error: 'p' was not declared in this scope
20 | p[i] = Point(x1, y1); q[i] = Point(x2, y2);
| ^
a.cc:20:47: error: 'q' was not declared in this scope
20 | p[i] = Point(x1, y1); q[i] = Point(x2, y2);
| ^
a.cc:26:50: error: 'p' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^
a.cc:26:56: error: 'q' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^
a.cc:26:38: error: 'isIntersect' was not declared in this scope
26 | if (!isIntersect(p[i], q[i], p[j], q[j])){
| ^~~~~~~~~~~
a.cc:30:33: error: 'x' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:54: error: 'p' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:60: error: 'q' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^
a.cc:30:42: error: 'interPointS' was not declared in this scope
30 | x[k++] = interPointS(p[i], q[i], p[j], q[j]);
| ^~~~~~~~~~~
a.cc:34:21: error: 'x' was not declared in this scope
34 | if (x[0] == x[1] || x[1] == x[2] || x[0] == x[2]){
| ^
a.cc:39:26: error: 'x' was not declared in this scope
39 | S = area(x[0], x[1], x[2]);
| ^
a.cc:39:21: error: 'area' was not declared in this scope
39 | S = area(x[0], x[1], x[2]);
| ^~~~
|
s063848519 | p00187 | C++ | #include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
using namespace std;
double EPS = 1e-10;
const double PI = acos(-1);
double add(double a, double b){
if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
return a+b;
}
struct point{
double x, y;
point(){}
point(double x,double y) : x(x) , y(y){}
point operator + (point p){
return point(add(x,p.x), add(y,p.y));
}
point operator - (point p){
return point(add(x,-p.x), add(y,-p.y));
}
point operator * (double d){
return point(x*d,y*d);
}
point operator / (double d){
return point(x/d,y/d);
}
bool operator == ( const point &p ) const {
return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
}
};
struct segment{
point a,b;
};
double cross(point a, point b) {
return (a.x * b.y - a.y * b.x);
}
double dist(point a,point b){
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
int is_intersected_ls(point a1, point a2, point b1, point b2) {
return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}
point intersection_ls(point a1, point a2, point b1, point b2) {
point b = b2-b1;
double d1 = abs(cross(b, a1-b1));
double d2 = abs(cross(b, a2-b1));
double t = d1 / (d1 + d2);
return a1 + (a2-a1) * t;
}
int main(void){
segment s[3];
while(true){
for(int i=0;i<3;i++){
cin >> s[i].a.x >> s[i].a.y >> s[i].b.x >> s[i].b.y;
if( s[i].a.x==0 && s[i].a.y==0 && s[i].b.x==0 && s[i].b.y==0)return 0;
}
int fg[3]={0};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(i!=j)
fg[i]+=is_intersected_ls(s[i].a,s[i].b,s[j].a,s[j].b);
}
}
if(fg[0]==2 && fg[1]==2 && fg[2]==2){
point p[3];
for(int i=0;i<2;i++)
p[i]=intersection_ls(s[i].a,s[i].b,s[i+1].a,s[i+1].b);
p[2]=intersection_ls(s[2].a,s[2].b,s[0].a,s[0].b);
double z=(dist(p[0],p[1])+dist(p[1],p[2])+dist(p[2],p[0]))/2;
double res=sqrt(z*(z-dist(p[0],p[1]))*(z-dist(p[1],p[2]))*(z-dist(p[2],p[0])));
if(res>1900000-EPS)cout <<"dai-kichi"<<endl;
else if(res>1000000-EPS)cout <<"chu-kichi"<<endl;
else if(res>100000-EPS)cout <<"kichi"<<endl;
else if(res>0+EPS)cout << "syo-kichi"<<endl;
else cout <<"kyo"<<endl;
}
else cout <<"kyo"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:104:2: error: expected '}' at end of input
104 | }
| ^
a.cc:69:15: note: to match this '{'
69 | int main(void){
| ^
|
s455248429 | p00187 | C++ | # -*- coding: utf-8 -*-
EPS = 1e-9
class Point
attr_reader :x, :y
def initialize(x, y=nil)
@x, @y = x, y if y
@x, @y = x[0], x[1] unless y
end
def +(other)
Point.new(@x + other.x, @y + other.y)
end
def -(other)
Point.new(@x - other.x, @y - other.y)
end
def *(other)
Point.new(@x * other, @y * other)
end
end
class Line
attr_reader :s, :t
def initialize(s, t=nil)
@s, @t = s, t if t
@s, @t = Point.new(s[0..1]), Point.new(s[2..3]) unless t
end
end
def dot(a, b); a.x * b.x + a.y * b.y; end
def cross(a, b); a.x * b.y - b.x * a.y; end
def is_intersected_ls(a, b)
cross(a.t - a.s, b.s - a.s) * cross(a.t - a.s, b.t - a.s) < EPS and
cross(b.t - b.s, a.s - b.s) * cross(b.t - b.s, a.t - b.s) < EPS
end
def intersection_ls(a, b)
tmp = b.t - b.s
d1 = cross(tmp, a.s - b.s).abs
d2 = cross(tmp, a.t - b.s).abs
t = d1 / (d1 + d2)
a.s + (a.t - a.s) * t
end
def area(points)
cross(points[0] - points[2], points[1] - points[2]).abs / 2
end
def fortune(x)
case x
when 0; "kyo"
when 0..100000; "syo-kichi"
when 0..1000000; "kichi"
when 0..1900000; "chu-kichi"
else; "dai-kichi"
end
end
while input = gets.split.map(&:to_i) and input.count(0) != 4
l = [ Line.new(input) ]
2.times{ l << Line.new(gets.split.map(&:to_i)) }
res = nil
points = []
for i in 0..2
res = "kyo" unless is_intersected_ls(l[i], l[(i + 1) % 3])
points << intersection_ls(l[i], l[(i + 1) % 3]) unless res
end
res = fortune(area(points)) unless res
puts res
end | a.cc:1:3: error: invalid preprocessing directive #-
1 | # -*- coding: utf-8 -*-
| ^
a.cc:7:5: error: stray '@' in program
7 | @x, @y = x, y if y
| ^
a.cc:7:9: error: stray '@' in program
7 | @x, @y = x, y if y
| ^
a.cc:8:5: error: stray '@' in program
8 | @x, @y = x[0], x[1] unless y
| ^
a.cc:8:9: error: stray '@' in program
8 | @x, @y = x[0], x[1] unless y
| ^
a.cc:11:15: error: stray '@' in program
11 | Point.new(@x + other.x, @y + other.y)
| ^
a.cc:11:29: error: stray '@' in program
11 | Point.new(@x + other.x, @y + other.y)
| ^
a.cc:14:15: error: stray '@' in program
14 | Point.new(@x - other.x, @y - other.y)
| ^
a.cc:14:29: error: stray '@' in program
14 | Point.new(@x - other.x, @y - other.y)
| ^
a.cc:17:15: error: stray '@' in program
17 | Point.new(@x * other, @y * other)
| ^
a.cc:17:27: error: stray '@' in program
17 | Point.new(@x * other, @y * other)
| ^
a.cc:24:5: error: stray '@' in program
24 | @s, @t = s, t if t
| ^
a.cc:24:9: error: stray '@' in program
24 | @s, @t = s, t if t
| ^
a.cc:25:5: error: stray '@' in program
25 | @s, @t = Point.new(s[0..1]), Point.new(s[2..3]) unless t
| ^
a.cc:25:9: error: stray '@' in program
25 | @s, @t = Point.new(s[0..1]), Point.new(s[2..3]) unless t
| ^
a.cc:25:26: error: too many decimal points in number
25 | @s, @t = Point.new(s[0..1]), Point.new(s[2..3]) unless t
| ^~~~
a.cc:25:46: error: too many decimal points in number
25 | @s, @t = Point.new(s[0..1]), Point.new(s[2..3]) unless t
| ^~~~
a.cc:54:8: error: too many decimal points in number
54 | when 0..100000; "syo-kichi"
| ^~~~~~~~~
a.cc:55:8: error: too many decimal points in number
55 | when 0..1000000; "kichi"
| ^~~~~~~~~~
a.cc:56:8: error: too many decimal points in number
56 | when 0..1900000; "chu-kichi"
| ^~~~~~~~~~
a.cc:67:12: error: too many decimal points in number
67 | for i in 0..2
| ^~~~
a.cc:2:1: error: 'EPS' does not name a type
2 | EPS = 1e-9
| ^~~
a.cc:29:16: error: 'a' does not name a type
29 | def dot(a, b); a.x * b.x + a.y * b.y; end
| ^
a.cc:29:39: error: 'end' does not name a type
29 | def dot(a, b); a.x * b.x + a.y * b.y; end
| ^~~
a.cc:30:19: error: 'a' does not name a type
30 | def cross(a, b); a.x * b.y - b.x * a.y; end
| ^
a.cc:30:42: error: 'end' does not name a type
30 | def cross(a, b); a.x * b.y - b.x * a.y; end
| ^~~
a.cc:53:11: error: expected unqualified-id before string constant
53 | when 0; "kyo"
| ^~~~~
a.cc:54:19: error: expected unqualified-id before string constant
54 | when 0..100000; "syo-kichi"
| ^~~~~~~~~~~
a.cc:55:20: error: expected unqualified-id before string constant
55 | when 0..1000000; "kichi"
| ^~~~~~~
a.cc:56:20: error: expected unqualified-id before string constant
56 | when 0..1900000; "chu-kichi"
| ^~~~~~~~~~~
a.cc:57:9: error: expected unqualified-id before string constant
57 | else; "dai-kichi"
| ^~~~~~~~~~~
a.cc:65:3: error: 'res' does not name a type
65 | res = nil
| ^~~
|
s642707514 | p00188 | Java | import java.util.Scanner;
//Search
public class AOJ0188 {
static int c;
static int[] a;
static int comp(int k, int x){
c++;
return a[k]-x;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0)break;
a = new int[n];
for(int i=0;i<n;i++)a[i]=sc.nextInt();
int x = sc.nextInt();
c = 0;
int l = 0;
int r = n-1;
int k = (l+r)/2;
while(l<=r){
int com = comp(k, x);
if(r<=l)break;
if(com<0)l=k+1;
else if(com>0)r=k-1;
else break;
k=(l+r)/2;
}
System.out.println(c);
}
}
} | Main.java:4: error: class AOJ0188 is public, should be declared in a file named AOJ0188.java
public class AOJ0188 {
^
1 error
|
s307419862 | p00188 | Java | import java.util.Scanner;
class Main
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
while (true)
{
int n = sc.nextInt();
if (n == 0) break;
int num[] = new int[n];
for (int i = 0; i < n; i++)
num[i] = sc.nextInt();
int x = sc.nextInt();
int left = 0, right = n - 1, i = (left + right) / 2, count = 0;
while (true)
{
if (num[i] == x)
count++;
{
System.out.println(count);
break;
}
else if (right - left < 2)
{
System.out.println(count + 1);
break;
}
else if (num[i] < x)
{
left = i + 1;
i = (left + right) / 2;
}
else if (num[i] > x)
{
right = i - 1;
i = (left + right) / 2;
}
}
}
}
} | Main.java:25: error: 'else' without 'if'
else if (right - left < 2)
^
1 error
|
s284184488 | p00188 | Java | import java.util.*;
public class Main{
Main(){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int r = sc.nextInt(), t, cnt=1, l=0;
if(r == 0) break;
int[] ary = new int[r+1];
for(int i = 0; i < r; i++)
ary[i] = sc.nextInt();
t = sc.nextInt();
r--;
for(;l <= r; cnt++){
int v = (l+r)/2;
if(ary[v] == t) break;
if(ary[v] < t) l = v+1;
else r = v-1;
if(l >= r) break
}
System.out.println(Integer.toString(cnt));
}
}
public static void main(String[] args){
new Main();
}
} | Main.java:24: error: ';' expected
if(l >= r) break
^
1 error
|
s283042598 | p00188 | C | #include<stdio.h>
int main(){
int n, a[100], i, target, mid, max, min, p, t = 0;
scanf("%d", &n);
if (n == 0)break;
p = n;
max = n - 1;
min = 0;
for (i = 0; i < n; i++){
scanf("%d", &a[i]);
}
scanf("%d", &target);
mid = (min + max) / 2;
while (1){
if (a[mid] == target){
t++;
break;
}
else if (max == min) {
t++;
break;
}
else if (a[mid] < target){
min = mid + 1;
mid = (min + max) / 2;
t++;
}
else if (a[mid] > target){
max = mid - 1;
mid = (min + max) / 2;
t++;
}
}
printf("%d\n", t);
return 0;
} | main.c: In function 'main':
main.c:6:28: error: break statement not within loop or switch
6 | if (n == 0)break;
| ^~~~~
|
s072112862 | p00188 | C | #include <stdio.h>
main(){
int a,n[100],i,key,l=0,r=100,mid,c=1;
while(1){
scanf("%d",&a);
if(a==0) break;
for(i=0;i<=a;i++){
scanf("%d",&n[i]);
}
key=n[a];
r=a-1;
if(l!=r){
while(l<r){
c++;
mid=(l+r)/2;
if(n[mid]==key) break;
else if(n[mid]<key) l=mid+1;
else r=mid-1;
}
}
else count=0;
printf("%d\n",c);
}
return 0;
} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(){
| ^~~~
main.c: In function 'main':
main.c:21:10: error: 'count' undeclared (first use in this function)
21 | else count=0;
| ^~~~~
main.c:21:10: note: each undeclared identifier is reported only once for each function it appears in
|
s546709859 | p00188 | C | #include <iostream>
using namespace std;
int n[101];
int m;
int ans;
int N;
void func(int j,int k){
ans++;
if (n[(j+k)/2]==m||j>=k) {
return;
}
else {
if (n[(j+k)/2]<m) {
func((j+k)/2+1,k);
}
else if (n[(j+k)/2]>m) {
func(j,(j+k)/2-1);
}
}
return;
}
int main(){
while (1) {
cin>>N;
if (N==0) {
break;
}
ans=0;
for (int i=0; i<N; i++) {
cin>>n[i];
}
cin>>m;
func(0,N-1);
cout << ans << endl;
}
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s417491226 | p00188 | C | #define $ scanf("%d",
a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}} | main.c:2:1: warning: data definition has no type or storage class
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:2:8: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:10: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:12: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:14: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:16: error: return type defaults to 'int' [-Wimplicit-int]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^~~~
main.c: In function 'main':
main.c:2:16: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:11: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | #define $ scanf("%d",
| ^~~~~
main.c:2:31: note: in expansion of macro '$'
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #define $ scanf("%d",
main.c:1:11: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | #define $ scanf("%d",
| ^~~~~
main.c:2:31: note: in expansion of macro '$'
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:1:11: note: include '<stdio.h>' or provide a declaration of 'scanf'
1 | #define $ scanf("%d",
| ^~~~~
main.c:2:31: note: in expansion of macro '$'
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:38: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^~~~~~
main.c:2:38: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:38: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:2:38: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:81: error: expected ')' before ';' token
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
| )
main.c:1:16: note: to match this '('
1 | #define $ scanf("%d",
| ^
main.c:2:78: note: in expansion of macro '$'
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:107: error: expected ';' before 'a'
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
| ;
main.c:2:126: error: expected expression before '}' token
2 | a[100],l,r,p,n;main(c){for(;l=$&r)*r;printf("%d\n",c)){for(;c=l;)$--l+a);for($&n;l<r&&!++c|a[p=l+r>>1]-n;)a[p]<n?r=p:(l=p+1);}}
| ^
main.c:2:126: error: expected expression before '}' token
main.c:2:126: error: expected expression before '}' token
|
s419836993 | p00188 | C | #include <stdio.h>
int main(void)
{
int i, n;
int x[101];
int search;
int l, r, c;
int cnt;
while (scanf("%d", &n); && n){
for (i = 0; i < n; i++){
scanf("%d", &x[i]);
}
scanf("%d", &search);
l = 0;
r = n - 1;
while (l <= r){
c = (l + r) / 2;
cnt++;
if (c == search){
break;
}
else if(x[c] > search){
r = l - 1;
}
else {
l = r + 1;
}
}
}
printf("%d\n", cnt);
return (0);
} | main.c: In function 'main':
main.c:10:31: error: expected ')' before ';' token
10 | while (scanf("%d", &n); && n){
| ~ ^
| )
|
s118905127 | p00188 | C++ | #include <bits/stdc++.h>
テつ?
using namespace std;
テつ?
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
typedef long long ll;
テつ?
int n = -1;
int a[101];
int k;
テつ?
void serch(int k)
{
テつ?つ?つ?つ?つ?
テつ?つ?つ?つ?nt ans = 1;
テつ?
テつ?つ?つ?つ?nt lb = 0; int ub = n-1;
テつ?つ?つ?つ?hile (ub - lb>1)
テつ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?nt mid = (lb + ub) / 2;
テつ?つ?つ?つ?つ?つ?つ?つ?f (a[mid] == k) {
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++; break;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?lse if (a[mid] > k){
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?b = mid;
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?lse {
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?b = mid;
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?ns++;
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?
テつ?つ?つ?つ?out <<ans << endl;
テつ?つ?つ?つ?つ?
テつ?つ?つ?つ?eturn;
}
int main()
{
テつ?つ?つ?つ?hile (cin>>n&& n!=0)
テつ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?EP(i, n){
テつ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?つ?in >> a[i];
テつ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?つ?
テつ?つ?つ?つ?つ?つ?つ?つ?in >> k;
テつ?つ?つ?つ?つ?つ?つ?つ?erch(k);
テつ?つ?つ?つ?
テつ?
テつ?
テつ?つ?つ?つ?eturn 0;
} | a.cc:2:1: error: '\U000030c6\U00003064' does not name a type
2 | テつ?
| ^~~~
a.cc:4:1: error: '\U000030c6\U00003064' does not name a type
4 | テつ?
| ^~~~
a.cc:11:1: error: '\U000030c6\U00003064' does not name a type
11 | テつ?
| ^~~~
a.cc:15:1: error: '\U000030c6\U00003064' does not name a type
15 | テつ?
| ^~~~
|
s747775164 | p00188 | C++ | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner scan =new Scanner(System.in);
while(true){
int n=scan.nextInt();
if(n==0)break;
int []a=new int[101];
for(int i=0;i<n;i++){
a[i]=scan.nextInt();
}
int m=scan.nextInt();
int r=0,l=n-1,cnt=0;
while(r<=l){
++cnt;
int h =(r+l)/2;
if(a[h]==m)break;
if(a[h]>m){
r=h+1;
}
else{
l=h;
}
}
System.out.println(cnt);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Arrays;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s975806389 | p00188 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run(){
Scanner sc = new Scanner(System.in);
while(true){
int b = sc.nextInt();
if(b == 0){
//System.out.println("break");
break;
}
int[] a = new int[b];
int left,right,searchvalue;
for(int i=0; i < a.length; i++){
a[i] = sc.nextInt();
}
searchvalue = sc.nextInt();
left = 0; right = a.length-1;
System.out.println(solve(left, right, searchvalue, a));
}
}
int solve(int left, int right,int sv,int[] a){
int index = (left + right) / 2;
int cnt;
//System.out.println("left:"+left+" right:"+right+" sv:"+sv+" a[index]:"+a[index]);
if(a[index] == sv){
return 1;
}else if(left == right){
return 1;
}else if(a[index] < sv){
left = index;
return 1 + solve(++left, right, sv, a);
}else if(a[index] > sv){
right = index;
return 1 + solve(left, --right, sv, a);
}
return 0;
/*
if(cnt == a.length-1){
System.out.println(cnt);
return;
}
if(a[(left + right) / 2] < sv){
System.out.println("left:"+left+" right:"+right);
if(left <= right){
left = (left + right) / 2 + 1;
solve(left, right,sv, a, ++cnt);
}else{
System.out.println(++cnt);
}
}else if(a[(left + right) / 2] > sv){
System.out.println("left:"+left+" right:"+right);
if(left < right){
right = (left + right) / 2 - 1;
solve(left, right,sv, a, ++cnt);
}else{
System.out.println(++cnt);
}
}else{
System.out.println(++cnt);
}
*/
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s865089376 | p00188 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run(){
Scanner sc = new Scanner(System.in);
while(true){
int b = sc.nextInt();
if(b == 0){
//System.out.println("break");
break;
}
int[] a = new int[b];
int left,right,searchvalue;
for(int i=0; i < a.length; i++){
a[i] = sc.nextInt();
}
searchvalue = sc.nextInt();
left = 0; right = a.length-1;
System.out.println(solve(left, right, searchvalue, a));
}
}
int solve(int left, int right,int sv,int[] a){
int index = (left + right) / 2;
int cnt;
//System.out.println("left:"+left+" right:"+right+" sv:"+sv+" a[index]:"+a[index]);
if(a[index] == sv){
return 1;
}else if(left == right){
return 1;
}else if(a[index] < sv){
left = index;
return 1 + solve(++left, right, sv, a);
}else if(a[index] > sv){
right = index;
return 1 + solve(left, --right, sv, a);
}
return 0;
/*
if(cnt == a.length-1){
System.out.println(cnt);
return;
}
if(a[(left + right) / 2] < sv){
System.out.println("left:"+left+" right:"+right);
if(left <= right){
left = (left + right) / 2 + 1;
solve(left, right,sv, a, ++cnt);
}else{
System.out.println(++cnt);
}
}else if(a[(left + right) / 2] > sv){
System.out.println("left:"+left+" right:"+right);
if(left < right){
right = (left + right) / 2 - 1;
solve(left, right,sv, a, ++cnt);
}else{
System.out.println(++cnt);
}
}else{
System.out.println(++cnt);
}
*/
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s678356749 | p00188 | C++ | import math
def f(check, n, L, count):
count += 1
median = int(math.floor(float(n-1)/2))
if len(L) == 1:
return count
elif L[median] == check:
return count
elif L[median] < check:
L = L[median+1:]
elif check < L[median]:
L = L[:median]
n = len(L)
return f(check, n, L, count)
while True:
n = int(raw_input())
if n == 0: break
L = [int(raw_input()) for i in range(n)]
check = int(raw_input())
print f(check, n, L, 0) | a.cc:1:1: error: 'import' does not name a type
1 | import math
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s959327184 | p00188 | C++ | import java.util.*;
class Main{
public static void main(String args[]){
Solve s = new Solve();
s.solve();
}
}
class Solve{
Scanner in = new Scanner(System.in);
void solve(){
while(in.hasNext()){
int n = in.nextInt();
if(n == 0) return;
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = in.nextInt();
int b = in.nextInt();
int l = 0, r = n, s = 0;
while(true){
s++;
int m = (l + r) / 2;
if(r - l == 1) break;
//System.out.println(l + " " + r);
if(a[m] < b) l = m;
else if(a[m] > b) r = m;
else break;
}
System.out.println(s);
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected ':' before 'static'
4 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:4:33: error: 'String' has not been declared
4 | public static void main(String args[]){
| ^~~~~~
a.cc:8:2: error: expected ';' after class definition
8 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:5:17: error: 'Solve' was not declared in this scope
5 | Solve s = new Solve();
| ^~~~~
a.cc:6:17: error: 's' was not declared in this scope
6 | s.solve();
| ^
a.cc: At global scope:
a.cc:11:9: error: 'Scanner' does not name a type
11 | Scanner in = new Scanner(System.in);
| ^~~~~~~
a.cc:36:2: error: expected ';' after class definition
36 | }
| ^
| ;
a.cc: In member function 'void Solve::solve()':
a.cc:14:23: error: 'in' was not declared in this scope; did you mean 'int'?
14 | while(in.hasNext()){
| ^~
| int
a.cc:17:28: error: structured binding declaration cannot have type 'int'
17 | int[] a = new int[n];
| ^~
a.cc:17:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:17:28: error: empty structured binding declaration
a.cc:17:31: error: expected initializer before 'a'
17 | int[] a = new int[n];
| ^
a.cc:18:52: error: 'a' was not declared in this scope
18 | for(int i = 0; i < n; i++) a[i] = in.nextInt();
| ^
a.cc:27:36: error: 'a' was not declared in this scope
27 | if(a[m] < b) l = m;
| ^
a.cc:32:25: error: 'System' was not declared in this scope
32 | System.out.println(s);
| ^~~~~~
|
s978056639 | p00188 | C++ | #include <stdio.h>
int a, b, c;
int main() {
while(true) {
scanf("%d", &a);
if(a == 0) break;
for(int i = 0; i < n; i++) scanf("%d", &b);
c = 0;
while (a != 0) {
a /= 2; c++;
}
printf("%d\n", c);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:36: error: 'n' was not declared in this scope
7 | for(int i = 0; i < n; i++) scanf("%d", &b);
| ^
|
s162787889 | p00188 | C++ | #include<utility>
#include<iostream>
using namespace std;
int n,num[100],aid,sum;
void reading();
void binary();
int main(){
while(1){
sum=0;
cin >> n;
if(n==0)break;
reading();
sort();
binary();
cout << sum << endl;
}
return 0;
}
void reading(){
for(int i=0;i<n;++i)cin >> num[i];
cin >> aid;
}
void binary(){
int a=0,b=n-1,c;
while(1){
++sum;
c = (a+b)/2;
if(num[c]==aid || a==b)break;
if(num[c]>aid)b = c-1;
else a = c+1;
}
} | a.cc: In function 'int main()':
a.cc:17:17: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort();
| ^~~~
| short
|
s011884257 | p00188 | C++ | //
#include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, times;
int i1, tyuusinn, yousosuu, yousosuu2;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
times=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a)break;
}
sort(w, w+a);
cin >> b;
yousosuu=a;
tyuusinn=yousosuu/2;
while(1){
times++;
yousosuu2=yousosuu/2;
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]>b){
tyuusinn=tyuusinn-yousosuu/2+yousosuu2/2;
yousosuu=yousosuu2;
}
else{
if(yousosuu%2==0){
tyuusinn=tyuusinn+yousosuu2/2;
yousosuu=yousosuu2-1;
}
else{
tyuusinn=tyuusinn+yousosuu2/2+1;
yousosuu=yousosuu2;
}
}
if(yousosuu==0){break;}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
24 | sort(w, w+a);
| ^~~~
| sqrt
|
s865135088 | p00188 | C++ | //
#include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, times;
int i1, tyuusinn, yousosuu, yousosuu2;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
times=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a)break;
}
sort(w, w+a);
cin >> b;
yousosuu=a;
tyuusinn=yousosuu/2;
while(1){
times++;
yousosuu2=yousosuu/2;
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]>b){
tyuusinn=tyuusinn-yousosuu/2+yousosuu2/2;
yousosuu=yousosuu2;
}
else{
if(yousosuu%2==0){
tyuusinn=tyuusinn+yousosuu2/2;
yousosuu=yousosuu2-1;
}
else{
tyuusinn=tyuusinn+yousosuu2/2+1;
yousosuu=yousosuu2;
}
}
if(yousosuu==0){break;}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
24 | sort(w, w+a);
| ^~~~
| sqrt
|
s415864790 | p00188 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, i1, times, max, min, tyuusinn;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a){break;}
}
max=a-1;
min=0;
times=0;
sort(w, w+a);
cin >> b;
while(1){
times++;
tyuusinn=(max+min)/2;
if(max==min){break;}
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]<b){
min=tyuusinn+1;
}
else{
max=tyuusinn-1;
}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
20 | sort(w, w+a);
| ^~~~
| sqrt
|
s361603868 | p00188 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, times;
int i1, tyuusinn, yousosuu, yousosuu2;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
times=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a)break;
}
sort(w, w+a);
cin >> b;
yousosuu=a;
tyuusinn=(yousosuu-1)/2;
while(1){
times++;
yousosuu2=(yousosuu-1)/2;
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]>b){
tyuusinn=tyuusinn-yousosuu+yousosuu2/2;
yousosuu=yousosuu2+1;
}
else{
if(yousosuu%2==0){
tyuusinn=tyuusinn+yousosuu2/2-1;
yousosuu=yousosuu2+1;
}
else{
tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
yousosuu=yousosuu2;
}
}
if(yousosuu==0){break;}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
19 | sort(w, w+a);
| ^~~~
| sqrt
|
s548148460 | p00188 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, times;
int i1, tyuusinn, yousosuu, yousosuu2;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
times=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a)break;
}
sort(w, w+a);
cin >> b;
yousosuu=a;
tyuusinn=(yousosuu-1)/2;
while(1){
times++;
yousosuu2=(yousosuu-1)/2;
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]>b){
tyuusinn=tyuusinn-yousosuu+yousosuu2/2;
yousosuu=tyuusinn-yousosuu+yousosuu2+1;
}
else{
if(yousosuu%2==0){
tyuusinn=tyuusinn+yousosuu2/2-1;
yousosuu=tyuusinn+yousosuu2+1;
}
else{
tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
yousosuu=tyuusinn+yousosuu2;
}
}
if(yousosuu==0){break;}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
19 | sort(w, w+a);
| ^~~~
| sqrt
|
s709837429 | p00188 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int main(){
int a, b, times;
int i1, tyuusinn, yousosuu, yousosuu2;
while(1){
cin >> a;
if(a==0){break;}
i1=0;
times=0;
int w[a];
while(1){
cin >> b;
w[i1]=b;
i1++;
if(i1==a)break;
}
sort(w, w+a);
cin >> b;
yousosuu=a;
tyuusinn=(yousosuu-1)/2;
while(1){
times++;
yousosuu2=(yousosuu-1)/2;
if(w[tyuusinn]==b){break;}
else if(w[tyuusinn]>b){
tyuusinn=tyuusinn-yousosuu2+(yousosuu2-1)/2;
yousosuu=yousosuu2;
}
else{
if(yousosuu%2==0){
tyuusinn=tyuusinn+(yousosuu2+1)/2;
yousosuu=yousosuu2+1;
}
else{
tyuusinn=tyuusinn+(yousosuu2+1)/2+1;
yousosuu=yousosuu2;
}
}
if(yousosuu==0){break;}
}
cout << times << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
19 | sort(w, w+a);
| ^~~~
| sqrt
|
s724322662 | p00188 | C++ | #include <cstdio>
#define buf 1000001
using namespace std;
int cnt,b[buf];
void binary_search(int d,int a);
int main(void){
int i,j,a,n;
char str[200];
for( ; ; ){
fgets(str,sizeof(str),stdin);
sscanf(str,"%d",&a);
if(a==0) break;
for(i=0;i<a;i++){
fgets(str,sizeof(str),stdin);
sscanf(str,"%d",&n);
b[i]=n;
}
for(i=0;i<a;i++)
printf("%d ",b[i]);
printf("\n");
cnt=1;
fgets(str,sizeof(str),stdin);
sscanf(str,"%d",&n);
binary_search(n,a);
printf("%d\n",cnt);
}
return 0;
}
void binary_search(int n,int a){
int left,right,mid;
left = 0; right = a1;
while(left < right){
mid = (left + right)/2;
if(b[mid] == n)
break;
else if(n < b[mid])
right = mid;
else if(n > b[mid])
left = mid+1;
cnt++;
}
} | a.cc: In function 'void binary_search(int, int)':
a.cc:34:21: error: 'a1' was not declared in this scope; did you mean 'a'?
34 | left = 0; right = a1;
| ^~
| a
|
s441999285 | p00188 | C++ | #include <iostream>
using namespace std;
int nibn(int a[], int s, int e, int k);
int nibn(int a[], int s, int e, int k){
if(s>e) return 1;
if(a[(s+e)/2] == k){
return 1;
}
else if(a[(s+e)/2] < k){
return 1 + nibn(a,(s+e)/2+1,e,k);
}
else if(a[(s+e)/2] > k){
return 1 + nibn(a,s,(s+e)/2-1,k);
}
}
int main(){
int n, a[150], k;
while(cin >> n){
if(!n) break;
ans = 0;
for(int i = 0;i<n;i++){
cin >> a[i];
}
cin >> k;
cout << nibn(a,0,n-1,k) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
23 | ans = 0;
| ^~~
| abs
a.cc: In function 'int nibn(int*, int, int, int)':
a.cc:16:1: warning: control reaches end of non-void function [-Wreturn-type]
16 | }
| ^
|
s978563166 | p00188 | C++ | #include<iostream>
#include<map>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
int main(){
int set[101],n,k,cnt,a,b;
while(1){
cin >> n;
if(n==0)break;
for(int i=0;i<n;i++){
cin >> set[i];
}
cin >> k;
cnt=0;
n--;
a=n/2;
for(int i=0,j=n;i<=j&&set[a]!=k;cnt++){
a=(i+j)/2;
if(set[a]<k) i=a+1;
else j=a-1;
}
cout << cnt << endl;
}
} | a.cc:25:17: error: extended character is not valid in an identifier
25 | cout << cnt << endl;
| ^
a.cc: In function 'int main()':
a.cc:25:17: error: 'cnt\U00003000' was not declared in this scope
25 | cout << cnt << endl;
| ^~~~~
|
s924715726 | p00188 | C++ | #include <stdio.h>
int main(void)
{
int n;
int i;
int a[128], key;
int left, right, center;
int count;
while (scanf("%d", &n) && n){
for (i = 0; i < n; i++){
scanf("%d", &a[i]);
}
scanf("%d", &key); //探す数
left = 0;
right = n - 1;
count = 0;
while (l <= r){
center = (l + r) / 2;
count++;
if (a[center] == key){
break;
}
else if (a[center] > key){
right = center - 1;
}
else {
left = center + 1;
}
}
printf("%d\n", count);
}
return (0);
} | a.cc: In function 'int main()':
a.cc:20:24: error: 'l' was not declared in this scope
20 | while (l <= r){
| ^
a.cc:20:29: error: 'r' was not declared in this scope
20 | while (l <= r){
| ^
|
s557777459 | p00189 | Java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main{
public static void main(String[] args)throws Exception{
new Main().solve();
}
void solve(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();//the number of roads
Dijkstra ds=new Dijkstra(10);
for(int i=0;i<n;i++){
int from=sc.nextInt();
int to=sc.nextInt();
int cost=sc.nextInt();
ds.addEdge(from, to, cost);
ds.addEdge(to, from, cost);
}
long ans=99999999999L;
long ans2=0;
for(int i=0;i<n;i++){
long a=ds.getShortestPath(i);
if(a==0)continue;
if(ans>a){
ans=a;
ans2=i;
}
}
System.out.println(ans2+" "+ans);
}
}
class Dijkstra{
int n;
long[] d;
int s;
PriorityQueue<Vertice> pq;
final long INF=Long.MAX_VALUE/4;
Dijkstra(int n){
this.n=n;
d=new long[n];
@SuppressWarnings("unchecked")
List<Edge>[]edges=new List[n];
for(int i=0;i<n;i++){
edges[i]=new ArrayList<Edge>();
}
s=-1;
}
public long getShortestPath(int i){
if(i!=s){
s=i;
Arrays.fill(d, INF);
d[i]=0;
pq=new PriorityQueue<Vertice>();
pq.add(new Vertice(i,d[i]));
while(!pq.isEmpty()){
Vertice u=pq.poll();
if(d[u.me]<u.cost){
continue;//skip old vertex
}
for(int ii=0;ii<edges[u.me].size();ii++){
Edge e=edges[u.me].get(ii);
if(d[e.from]!=INF&&e.cost+d[e.from]<d[e.to]){
d[e.to]=e.cost+d[e.from];
pq.add(new Vertice(e.to,d[e.to]));
}else{
}
}
}
s=i;
}
int sum=0;
for(int ii=0;ii<d.length;ii++){
if(d[ii]==INF)continue;
sum+=d[ii];
}
return sum;
}
void addEdge(int from,int to,long cost){
edges[from].add(new Edge(from,to,cost));
}
}
class Edge{
int from;
int to;
long cost;
Edge(int i,int j,long cost){
this.from=i;
this.to=j;
this.cost=cost;
}
}
class Vertice implements Comparable<Vertice>{
int me;
long cost;
Vertice(int me,long cost){
this.me=me;
this.cost=cost;
}
@Override
public int compareTo(Vertice o){
return Long.compare(this.cost, o.cost);
}
}
void tr(Object...o){System.out.println(Arrays.deepToString(o));}
} | Main.java:67: error: cannot find symbol
for(int ii=0;ii<edges[u.me].size();ii++){
^
symbol: variable edges
location: class Main.Dijkstra
Main.java:68: error: cannot find symbol
Edge e=edges[u.me].get(ii);
^
symbol: variable edges
location: class Main.Dijkstra
Main.java:86: error: cannot find symbol
edges[from].add(new Edge(from,to,cost));
^
symbol: variable edges
location: class Main.Dijkstra
3 errors
|
s953760423 | p00189 | Java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Q0189 {
public static void main(String[] args)throws Exception{
new Q0189().solve();
}
void solve(){
Scanner sc=new Scanner(System.in);
while(true){
int n=sc.nextInt();//the number of roads
if(n==0){
sc.close();
break;
}
Dijkstra ds=new Dijkstra(10);
for(int i=0;i<n;i++){
int from=sc.nextInt();
int to=sc.nextInt();
int cost=sc.nextInt();
ds.addEdge(from, to, cost);
ds.addEdge(to, from, cost);
}
long ans=99999999999L;
long ans2=0;
for(int i=0;i<n;i++){
long a=ds.getShortestPath(i);
if(a==0)continue;
if(ans>a){
ans=a;
ans2=i;
}
}
System.out.println(ans2+" "+ans);
}
}
class Dijkstra{
int n;
long[] d;
int s;
List<Edge>[]edges;
PriorityQueue<Vertice> pq;
final long INF=Long.MAX_VALUE/4;
Dijkstra(int n){
this.n=n;
d=new long[n];
@SuppressWarnings("unchecked")
List<Edge>[]edges=new List[n];
this.edges=edges;
for(int i=0;i<n;i++){
edges[i]=new ArrayList<Edge>();
}
s=-1;
}
public long getShortestPath(int i){
if(i!=s){
s=i;
Arrays.fill(d, INF);
d[i]=0;
pq=new PriorityQueue<Vertice>();
pq.add(new Vertice(i,d[i]));
while(!pq.isEmpty()){
Vertice u=pq.poll();
if(d[u.me]<u.cost){
continue;//skip old vertex
}
for(int ii=0;ii<edges[u.me].size();ii++){
Edge e=edges[u.me].get(ii);
if(d[e.from]!=INF&&e.cost+d[e.from]<d[e.to]){
d[e.to]=e.cost+d[e.from];
pq.add(new Vertice(e.to,d[e.to]));
}else{
}
}
}
s=i;
}
int sum=0;
for(int ii=0;ii<d.length;ii++){
if(d[ii]==INF)continue;
sum+=d[ii];
}
return sum;
}
void addEdge(int from,int to,long cost){
edges[from].add(new Edge(from,to,cost));
}
}
class Edge{
int from;
int to;
long cost;
Edge(int i,int j,long cost){
this.from=i;
this.to=j;
this.cost=cost;
}
}
class Vertice implements Comparable<Vertice>{
int me;
long cost;
Vertice(int me,long cost){
this.me=me;
this.cost=cost;
}
@Override
public int compareTo(Vertice o){
return Long.compare(this.cost, o.cost);
}
}
void tr(Object...o){System.out.println(Arrays.deepToString(o));}
} | Main.java:7: error: class Q0189 is public, should be declared in a file named Q0189.java
public class Q0189 {
^
1 error
|
s803140804 | p00189 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
??
import static java.lang.Integer.parseInt;
??
/**
??* Convenient Location
??*/
public class Main {
??
????????static final int MAX_LOC = 10;
??
????????public static void main(String[] args) throws IOException {
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
????????????????String line;
????????????????String[] words;
??
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
??
????????????????????????int n = parseInt(line);
????????????????????????if (n == 0) break;
??
????????????????????????//init
????????????????????????long[][] g = new long[MAX_LOC][MAX_LOC];
????????????????????????int N = 0;
??
????????????????????????for (int i = 0; i < g.length; i++) {
????????????????????????????????for (int j = 0; j < g[i].length; j++) {
????????????????????????????????????????if (i != j) g[i][j] = Integer.MAX_VALUE;
????????????????????????????????}
????????????????????????}
????????????????????????for (int i = 0; i < n; i++) {
????????????????????????????????words = br.readLine().split(" ");
????????????????????????????????int x, y, d;
????????????????????????????????x = parseInt(words[0]);
????????????????????????????????y = parseInt(words[1]);
????????????????????????????????d = parseInt(words[2]);
????????????????????????????????N = Math.max(N, Math.max(x, y));
????????????????????????????????g[y][x] = g[x][y] = d;
????????????????????????}
??
????????????????????????//solve
????????????????????????for (int k = 0; k <= N; k++) {
????????????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????????????g[i][j] = Math.min(g[i][j], g[i][k] + g[k][j]);
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
??
????????????????????????int pos = Integer.MAX_VALUE;
????????????????????????int min = Integer.MAX_VALUE;
????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????int tmp = 0;
????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????tmp += g[i][j];
????????????????????????????????}
????????????????????????????????if (tmp < min) {
????????????????????????????????????????pos = i;
????????????????????????????????????????min = tmp;
????????????????????????????????}
????????????????????????}
??
????????????????????????System.out.println(pos + " " + min);
??
????????????????}//end while
????????}// end main
} | Main.java:4: error: class, interface, enum, or record expected
??
^
Main.java:6: error: class, interface, enum, or record expected
??
^
Main.java:11: error: illegal start of type
??
^
Main.java:13: error: illegal start of type
??
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: '.class' expected
????????????????String[] words;
^
Main.java:17: error: : expected
????????????????String[] words;
^
Main.java:18: error: illegal start of expression
??
^
Main.java:18: error: illegal start of expression
??
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:20: error: illegal start of expression
??
^
Main.java:20: error: illegal start of expression
??
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
??????????? |
s372877060 | p00189 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
??
import static java.lang.Integer.parseInt;
??
/**
??* Convenient Location
??*/
public class Main {
??
????????static final int MAX_LOC = 10;
??
????????public static void main(String[] args) throws IOException {
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
????????????????String line;
????????????????String[] words;
??
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
??
????????????????????????int n = parseInt(line);
????????????????????????if (n == 0) break;
??
????????????????????????//init
????????????????????????long[][] g = new long[MAX_LOC][MAX_LOC];
????????????????????????int N = 0;
??
????????????????????????for (int i = 0; i < g.length; i++) {
????????????????????????????????for (int j = 0; j < g[i].length; j++) {
????????????????????????????????????????if (i != j) g[i][j] = Integer.MAX_VALUE;
????????????????????????????????}
????????????????????????}
????????????????????????for (int i = 0; i < n; i++) {
????????????????????????????????words = br.readLine().split(" ");
????????????????????????????????int x, y, d;
????????????????????????????????x = parseInt(words[0]);
????????????????????????????????y = parseInt(words[1]);
????????????????????????????????d = parseInt(words[2]);
????????????????????????????????N = Math.max(N, Math.max(x, y));
????????????????????????????????g[y][x] = g[x][y] = d;
????????????????????????}
??
????????????????????????//solve
????????????????????????for (int k = 0; k <= N; k++) {
????????????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????????????g[i][j] = Math.min(g[i][j], g[i][k] + g[k][j]);
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
??
????????????????????????int pos = Integer.MAX_VALUE;
????????????????????????int min = Integer.MAX_VALUE;
????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????int tmp = 0;
????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????tmp += g[i][j];
????????????????????????????????}
????????????????????????????????if (tmp < min) {
????????????????????????????????????????pos = i;
????????????????????????????????????????min = tmp;
????????????????????????????????}
????????????????????????}
??
????????????????????????System.out.println(pos + " " + min);
??
????????????????}//end while
????????}// end main
} | Main.java:4: error: class, interface, enum, or record expected
??
^
Main.java:6: error: class, interface, enum, or record expected
??
^
Main.java:11: error: illegal start of type
??
^
Main.java:13: error: illegal start of type
??
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: '.class' expected
????????????????String[] words;
^
Main.java:17: error: : expected
????????????????String[] words;
^
Main.java:18: error: illegal start of expression
??
^
Main.java:18: error: illegal start of expression
??
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:20: error: illegal start of expression
??
^
Main.java:20: error: illegal start of expression
??
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
??????????? |
s619073589 | p00189 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
??
import static java.lang.Integer.parseInt;
??
/**
??* Convenient Location
??*/
public class Main {
??
????????static final int MAX_LOC = 10;
??
????????public static void main(String[] args) throws IOException {
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
????????????????String line;
????????????????String[] words;
??
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
??
????????????????????????int n = parseInt(line);
????????????????????????if (n == 0) break;
??
????????????????????????//init
????????????????????????long[][] g = new long[MAX_LOC][MAX_LOC];
????????????????????????int N = 0;
??
????????????????????????for (int i = 0; i < g.length; i++) {
????????????????????????????????for (int j = 0; j < g[i].length; j++) {
????????????????????????????????????????if (i != j) g[i][j] = Integer.MAX_VALUE;
????????????????????????????????}
????????????????????????}
????????????????????????for (int i = 0; i < n; i++) {
????????????????????????????????words = br.readLine().split(" ");
????????????????????????????????int x, y, d;
????????????????????????????????x = parseInt(words[0]);
????????????????????????????????y = parseInt(words[1]);
????????????????????????????????d = parseInt(words[2]);
????????????????????????????????N = Math.max(N, Math.max(x, y));
????????????????????????????????g[y][x] = g[x][y] = d;
????????????????????????}
??
????????????????????????//solve
????????????????????????for (int k = 0; k <= N; k++) {
????????????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????????????g[i][j] = Math.min(g[i][j], g[i][k] + g[k][j]);
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
??
????????????????????????int pos = Integer.MAX_VALUE;
????????????????????????int min = Integer.MAX_VALUE;
????????????????????????for (int i = 0; i <= N; i++) {
????????????????????????????????int tmp = 0;
????????????????????????????????for (int j = 0; j <= N; j++) {
????????????????????????????????????????tmp += g[i][j];
????????????????????????????????}
????????????????????????????????if (tmp < min) {
????????????????????????????????????????pos = i;
????????????????????????????????????????min = tmp;
????????????????????????????????}
????????????????????????}
??
????????????????????????System.out.println(pos + " " + min);
??
????????????????}//end while
????????}// end main
} | Main.java:4: error: class, interface, enum, or record expected
??
^
Main.java:6: error: class, interface, enum, or record expected
??
^
Main.java:11: error: illegal start of type
??
^
Main.java:13: error: illegal start of type
??
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: illegal start of expression
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:15: error: : expected
????????????????BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: illegal start of expression
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:16: error: : expected
????????????????String line;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: illegal start of expression
????????????????String[] words;
^
Main.java:17: error: '.class' expected
????????????????String[] words;
^
Main.java:17: error: : expected
????????????????String[] words;
^
Main.java:18: error: illegal start of expression
??
^
Main.java:18: error: illegal start of expression
??
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:19: error: illegal start of expression
????????????????while ((line = br.readLine()) != null && !line.isEmpty()) {
^
Main.java:20: error: illegal start of expression
??
^
Main.java:20: error: illegal start of expression
??
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
????????????????????????int n = parseInt(line);
^
Main.java:21: error: illegal start of expression
??????????? |
s930432575 | p00189 | Java | import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;
public class Vol0189 {
final static int INF = 100000000;
final static int abmax = 10;
public static void warshallFloyd(int v, int[][] d) {
for (int k = 0; k < v; k++) {
for (int i = 0; i < v; i++) {
for (int j = 0; j < v; j++) {
d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);
}
}
}
}
public static int length(int v, int p, int[][] d) {
int sum = 0;
for (int i = 0; i < v; i++) {
sum += d[p][i];
}
return sum;
}
public static int[][] initialization() {
int[][] d = new int[abmax][abmax];
for (int i = 0; i < abmax; i++) {
for (int j = 0; j < abmax; j++) {
if (i == j)
d[i][j] = 0;
else
d[i][j] = INF;
}
}
return d;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine().split(" ")[0]);
while (n != 0) {
int[][] d = initialization();
int v = 0;
for (int i = 0; i < n; i++) {
String str[] = sc.nextLine().split(" ");
int a = Integer.parseInt(str[0]);
int b = Integer.parseInt(str[1]);
int c = Integer.parseInt(str[2]);
d[a][b] = c;
d[b][a] = c;
v = Math.max(Math.max(v, a), b);
}
v = v + 1;
warshallFloyd(v, d);
int minv = 0;
int minsum = INF;
for (int i = 0; i < v; i++) {
if (minsum > length(v, i, d)) {
minv = i;
minsum = length(v, i, d);
}
}
System.out.println(minv + " " + minsum);
n = Integer.parseInt(sc.nextLine().split(" ")[0]);
}
sc.close();
}
}
| Main.java:6: error: class Vol0189 is public, should be declared in a file named Vol0189.java
public class Vol0189 {
^
1 error
|
s654875507 | p00189 | Java | import java.util.Scanner;
public class aoj0189 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
int cyoten = sc.nextInt();
if(cyoten==0) break;
int mati=0;
int miti[][] = new int[cyoten][3];
for(int i=0; i<cyoten; i++){
for(int j=0; j<3; j++){
miti[i][j] = sc.nextInt();
if(j<2){
mati=Math.max(mati, miti[i][j]);
}
}
}
/*↑のfor分の処理は街の数を算出する為の手順*/
mati++;
int num[][]= new int[mati][mati];
for(int i=0; i<mati; i++){
for(int j=0; j<mati; j++){
num[i][j] = 100000000;
}
num[i][i]=0;
}
/*↑のfor文の処理は使う部分に0を入れてそれ以外の部分に大きい値を入力する。
準備段階*/
for(int i=0; i<mati; i++){
int a = miti[i][0];
int b = miti[i][1];
int c = miti[i][2];
num[a][b] = c;
num[b][a] = c;
}
/*入力したものをそれぞれの変数に格納する
準備段階*/
for(int k=0; k<mati; k++){
for(int i=0; i<mati; i++){
for(int j=i; j<mati; j++){
num[i][j] = Math.min(num[i][j], num[i][k]+num[k][j]);
}
}
}
/*↑のfor1文はワーシャルフロイド法まんまコピペ*/
int ans = Integer.MAX_VALUE;
int ans2 = 0;
for(int i=0; i<mati; i++){
int total =0;
for(int j=0; j<mati; j++){
total += num[i][j];
}
if(total<ans){
ans = total;
ans2 = i;
}
}
System.out.println(ans2+" "+ans);
}
}
} | Main.java:3: error: class aoj0189 is public, should be declared in a file named aoj0189.java
public class aoj0189 {
^
1 error
|
s163591009 | p00189 | C | #include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
int maze[50][50];
int tag[20];
int main()
{
int n;
while(~scanf("%d",&n) && n){
memset(tag,0,sizeof(tag));
memset(maze,0x3f,sizeof(maze));
for(int i = 0;i <= 9;++i) maze[i][i] = 0;
int u,v,l;
for(int i = 1;i <= n;++i){
scanf("%d%d%d",&u,&v,&l);
tag[u] = tag[v] = 1;
maze[u][v] = maze[v][u] = min(maze[u][v],l);
}
for(int k = 0;k <= 9;++k){
for(int i = 0;i <= 9;++i){
for(int j = 0;j <= 9;++j){
maze[j][i] = maze[i][j] = min(maze[i][j],maze[i][k] + maze[k][j]);
}
}
}
int pos = 0;
long long ans = 0x3f3f3f3f3f3f;
for(int i = 0;i <= 9;++i){
long long tmp = 0;
for(int j = 0;j <= 9;++j){
if(!tag[j]) continue;
tmp += maze[i][j];
}
if(ans > tmp){
ans = tmp;
pos = i;
}
}
cout << pos << ' ' << ans << endl;
}
return 0;
}
| main.c:1:10: fatal error: algorithm: No such file or directory
1 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s762985827 | p00189 | C | #include<iostream>
using namespace std;
int map[15][15];
int INF=999999;
int main()
{
int number;
for(;;)
{
cin>>number;
if(number==0)break;
for(int i=0;i<=14;i++)
{
for(int k=0;k<=14;k++)
{
if(i==k)map[i][k]=-1;
else map[i][k]=INF;
}
}
for(int i=1;i<=number;i++)
{
int num1,num2,dis;
cin>>num1>>num2>>dis;
map[num1][num2]=map[num2][num1]=dis;
}
for(int k=0;k<=15-1;k++)
{
for(int i=0;i<=15-1;i++)
{
for(int j=0;j<=15-1;j++)
{
if(i!=j&&i!=k&&j!=k)
{
if(map[i][k]+map[k][j]<map[i][j])map[i][j]=map[i][k]+map[k][j];
}
}
}
}
/* for(int i=0;i<=15-1;i++)
{
for(int k=0;k<=15-1;k++)cout<<map[i][k]<<" ";
cout<<endl;
}*/
int flag=0,sum=INF;
for(int i=0;i<=15-1;i++)
{
int temp=0;
for(int k=0;k<=15-1;k++)
{
if(i!=k&&map[i][k]!=INF)
temp+=map[i][k];
}
if(temp>0&&sum>temp)
{
flag=i;
sum=temp;
}
}
cout<<flag<<" "<<sum<<endl;
}
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s275068838 | p00189 | C | #include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int map[15][15];
int x,y;
void init()
{
for(int i=0; i<15; i++)
{
for(int j=0; j<15; j++)
{
map[i][j]=99999999;
if(i==j)
{
map[i][j]=0;
}
}
}
}
int main()
{
int n;
while(~scanf("%d",&n)&&n)
{
int m=0;
init();
for(int i=0; i<n; i++)
{
scanf("%d%d",&x,&y);
m=max(m,x);
m=max(m,y);
scanf("%d",&map[x][y]);
map[y][x]=map[x][y];
}
m++;
for(int k=0; k<m; k++)
{
for(int i=0; i<m; i++)
{
for(int j=0; j<m; j++)
{
if((map[i][k]+map[k][j])<map[i][j])
{
map[i][j]=map[j][i]=map[i][k]+map[k][j];
}
}
}
}
int ans=99999999;
int ansi=0;
for(int i=0; i<m; i++)
{
int t=0;
for(int j=0; j<m; j++)
{
t+=map[i][j];
}
if(t<ans)
{
ansi=i;
ans=t;
}
}
printf("%d %d\n",ansi,ans);
}
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s929753102 | p00189 | C | #include<iostream>
#include<cmath>
#include<set>
using namespace std;
int map[90][90];
int ar[90]={0};
const int INF=99999999;
int main()
{ int n;
while(cin>>n&&n){
for(int i=0;i<90;i++){
ar[i]=0;
}
for(int i=0;i<=2*n;i++){
for(int j=0;j<=2*n;j++){
if(i==j){
map[i][j]=0;
}
else{
map[i][j]=INF;
}
}
}
set<int>myset;
for(int i=0;i<n;i++){
int a,b,c;
cin>>a>>b>>c;
myset.insert(a);
myset.insert(b);
map[a][b]=c;
map[b][a]=c;
}
int num=myset.size();
for(int k=0;k<num;k++){
for(int i=0;i<num;i++){
for(int j=0;j<num;j++){
if(i!=j&&i!=k&&j!=k){
map[i][j]=min(map[i][j],map[i][k]+map[k][j]);
}
}
}
}
for(int i=0;i<num;i++){
for(int j=0;j<num;j++){
ar[i]+=map[i][j];
}
}
int mi=0;int minum=9999999;
for(int i=0;i<num;i++){
if(ar[i]<minum){
mi=i;
minum=ar[i];
}
}
cout<<mi<<" "<<minum<<endl;
}
return 0;
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s639133270 | p00189 | C | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
typedef struct edge
{
int s;
int e;
int l;
bool operator<(const edge n)const
{
return l<n.l;
}
} edge;
edge a[50];
int fa[15];
int num[15];
int getFather(int u)
{
if(fa[u]!=u) fa[u]=getFather(fa[u]);
return fa[u];
}
void Union(int x,int y)
{
int fx=getFather(x),fy=getFather(y);
if(fx!=fy) fa[fx]=fy;
}
int main()
{
int n,x;
while(scanf("%d",&n)&&n)
{
for(int i=0;i<n;i++)
{
scanf("%d%d%d",&a[i].s,&a[i].e,&a[i].l);
}
sort(a,a+n);
memset(num,0,sizeof(num));
int length=0;
for(int i=0;i<10;i++) fa[i]=i;
for(int i=0;i<n;i++)
{
if(getFather(a[i].s)!=getFather(a[i].e))
{
Union(a[i].s,a[i].e);
length+=a[i].l;
num[a[i].s]++;
num[a[i].e]++;
}
}
int max=0;
for(int i=0;i<10;i++)
if(num[i]>max)
{
max=num[i];
x=i;
}
cout << x << " " << length << endl;
}
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s780955648 | p00189 | C | //
// main.cpp
// 7.16练习
//
// Created by Rain on 2018/7/16.
// Copyright © 2018年 Rain. All rights reserved.
//
#include<stdio.h>
#include<string.h>
#include<math.h>
//#include<map>
//#include<set>
#include "stdlib.h"
#include "time.h"
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define clean(a,b) memset(a,b,sizeof(a))
using namespace std;
int a[105][105];
int vis[105];
int d[105];
int n=0,m;
int t[100];
void Dijkstra(int s)
{
memset(vis, 0, sizeof vis);
memset(d, inf, sizeof d);
d[s]=0;
for(int i=1;i<=n;i++)
{
int minn=inf;
int u=-1;
for(int j=1;j<=n;j++)
{
if(vis[j]==0&&d[j]<minn)
{
minn=d[j];
u=j;
}
}
if(u==-1)
return;
vis[u]=1;
for(int v=1;v<=n;v++)
{
if(vis[v]==0&&d[u]+a[u][v]<d[v])
d[v]=d[u]+a[u][v];
}
// for(int i=1;i<=n;i++)
// {
// printf("%d ",d[i]);
// if(i==n)
// printf("\n");
// }
}
}
int main(int argc, const char * argv[]) {
int q,w,e;
while(cin>>m)
{
if(m==0)
break;
memset(t, 0, sizeof t);
memset(a, inf, sizeof a);
for(int i=1;i<=m;i++)
{
cin>>q>>w>>e;
q++;w++;
t[q]=1;t[w]=1;
if(a[q][w]>e)
a[q][w]=a[w][q]=e;
}
for(int i=0;i<=11;i++)
{
if(t[i])
n++;
}
ll ans=0;
ll minn=inf;
int flag=0;
for(int i=1;i<=n;i++)
{
Dijkstra(i);
for(int j=1;j<=n;j++)
{
if(d[j]!=inf)
ans+=d[j];
}
if(minn>ans)
{
minn=ans;
flag=i;
}
ans=0;
}
printf("%d %lld\n",flag-1,minn);
n=0;
}
return 0;
}
| main.c:15:9: fatal error: deque: No such file or directory
15 | #include<deque>
| ^~~~~~~
compilation terminated.
|
s096371020 | p00189 | C | #include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
#define INF 0x3f3f3f
int dis[110][110];
void floyd(int n)
{
for(int k=0;k<n;k++)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
dis[i][j]=min(dis[i][j],(dis[i][k]+dis[k][j]));
}
}
}
}
void into(int n)//初始化
{
memset(dis,INF,sizeof(dis));
for(int i=0;i<n;i++)
dis[i][i]=0;
}
int main()
{
int n,m;
int a,b,k;
while(cin>>n)
{
into(12);
m=0;
for(int i=0;i<n;i++){
scanf("%d %d %d",&a,&b,&k);
dis[a][b]=dis[b][a]=k;
m=max(max(a,b),m);//位置个数
}
floyd(m+1);
int minn=INF;
int k=0;
for(int i=0;i<=m;i++){//最短路
int ans=0;
for(int j=0;j<=m;j++){
ans+=dis[i][j];
}
if(ans<minn){
minn=ans;
k=i;
}
}
printf("%d %d\n",k,minn);
}
return 0;
}
| main.c:3:9: fatal error: algorithm: No such file or directory
3 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s167634796 | p00189 | C | #include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;
int map[50][50];
int n;
int min(int a,int b){
return a>b?b:a;
}
void floyd(int n){
int i,j,k;
for(k=0;k<n;++k){
for(j=0;j<n;++j){
for(i=0;i<n;++i){
map[j][k]=min(map[j][k],map[j][i]+map[i][k]);
}
}
}
}
int max(int x,int y){
return x>y?x:y;
}
int main()
{
while(cin>>n&&n){
for(int i=0;i<n;++i){
for(int j=0;j<i;++j){
map[i][j]=map[j][i]=inf;
}
map[i][i]=0;
}
int m=0;
for(int i=0;i<n;i++){
int a,b,c;
cin>>a>>b>>c;
map[a][b]=map[b][a]=min(map[a][b],c);
m=max(max(m,a),b);
}
floyd(m+1);
int res=inf,dian=0;
for(int i=0;i<=m;++i){
int p=0;
for(int j=0;j<=m;++j){
if(map[i][j]!=inf){
p+=map[i][j];
}
}
if(p<res){
res=p;
dian=i;
}
}
cout<<dian<<" "<<res<<endl;
}
return 0;
}
| main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s116046706 | p00189 | C | #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
#define baba 0x3f3f3f3f
int main()
{
int n,m;
while (cin >>m) {
int l[20];
int asdf;
memset(l,0x3f3f3f3f,sizeof(l));
int a[12][12];
memset(a,baba,sizeof(a));
n=0;
for(int i=0;i<m;i++)
{
int x,y;
cin>>x>>y;
n=n>x?n>y?n:y:x>y?x:y;
int z;
cin>>z;
if(a[x][y]>z)
{
a[x][y]=z;
a[y][x]=a[x][y];
}
//cout<<" a "<<n;
}
int mx=0x3f3f3f3f;
for(int i=0;i<=n;i++)
{
memset(l,0x3f3f3f3f,sizeof(l));
int ji[20];///记录该位置的上一个点
int null=0;
int mi=i;
l[i]=0;
int f[20];
memset(f,-1,sizeof(f));
f[mi]=0;
int f3=0;
for(int i1=0;i1<n;i1++)
{
for(int i2=0;i2<=n;i2++)
{
if(f[i2])
{
if(l[i2]>a[mi][i2])
{
l[i2]=a[mi][i2];
ji[i2]=mi;
}
}
}
int f1=0;
int f2=baba;
for(int i2=0;i2<=n;i2++)
{
if(f[i2])
{
if(f2>l[i2]&&l[i2]<0x3f3f3f3f)
{
f2=l[i2];
f1=i2;
}
}
}
f[f1]=0;
l[f1]+=l[ji[f1]];
f3=f2;
null+=l[f1];
mi=f1;
}
if(mx>null)
{
mx=null;
asdf=i;
}
}
printf("%d %d\n",asdf,mx );
}
return 0;
}
| main.c:3:9: fatal error: iostream: No such file or directory
3 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s558484913 | p00189 | C | //
// Create by Running Photon on 2015-03-27
//
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <algorithm>
#include <cctype>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include <set>
#include <vector>
using namespace std;
#define CLR(x) memset(x,0,sizeof x)
#define ll long long
const int inf=0x3f3f3f3f;
const int maxn=1e5+5;
const int MOD=5e5+5;
int n, m;
int dp[15][15];
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
ios_base::sync_with_stdio(0);
while(scanf("%d", &n) != EOF && n){
m = 0;
for(int i = 0; i <= 10; i++) for(int j = 0; j <= 10; j++){
if(i == j) dp[i][j] = 0;
else dp[i][j] = inf;
}
for(int i = 1; i <= n; i++){
int u, v, val;
scanf("%d%d%d", &u, &v, &val);
m = max(m, max(u, v));
dp[u][v] = dp[v][u] = val;
}
int ans = inf, id;
for(int k = 0; k <= m; k++)for(int i = 0; i <= m; i++) for(int j = 0; j <= m; j++){
dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
}
for(int i = 0; i <= m; i++){
int sum = 0;
for(int j = 0; j <= m; j++){
sum += dp[i][j];
}
if(ans > sum){
ans = sum;
id = i;
}
}
printf("%d %d\n", id, ans);
}
return 0;
} | main.c:5:10: fatal error: iostream: No such file or directory
5 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s791756055 | p00189 | C | #include<bits/stdc++.h>
using namespace std;
int city[1000][1000],vis[1000],ans[1000];
void dfs(int root,int total)
{
// cout<<"root= "<<root<<"total="<<total<<endl;
vis[root]=1;
if(ans[root]==0||ans[root]>total)
{
ans[root]=total;
}
for(int i=0;i<=10;i++)
if(!vis[i]&&city[root][i])
{
vis[i]=1;
dfs(i,total+city[root][i]);
vis[i]=0;
}
}
int main()
{
int t;
while(~scanf("%d",&t))
{
int a,b,val;
memset(city,0,sizeof(city));
memset(ans,0,sizeof(ans));
memset(vis,0,sizeof(vis));
if(t==0)
break;
for(int i=0;i<t;i++)
{
cin>>a>>b>>val;
city[a][b]=val;
city[b][a]=val;
}
// for(int i=0;i<t;i++)
// {
// for(int j=0;j<t;j++)
// cout<<city[i][j]<<" ";
// cout<<endl;
// }
int total,minV=0,flagI;
for(int i=0;i<=10;i++)
{
total=0;
memset(ans,0,sizeof(ans));
memset(vis,0,sizeof(vis));
dfs(i,0);
for(int j=0;j<=10;j++)
if(ans[j]!=0){
total+=ans[j];
// cout<<ans[j]<<"out ";
}
if((minV==0||minV>total)&&total!=0)
{
flagI=i;
minV=total;
}
}
cout<<flagI<<" "<<minV<<endl;
}
return 0;
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s230848958 | p00189 | C | #include <stdio.h>
#include <string.h>
#define INF 0x3f3f3f
int map[15][15], sum;
int min(int a, int b)
{
return a < b ? a : b;
}
int zdl(int start)
{
int list[13];
bool next[13];
memset(next, false, sizeof(next));
for(int i=0; i<=sum; i++)
{
list[i] = map[start][i];
}
next[start] = true;
int ans = 0, st = INF;
for(int i=0; i<=sum; i++)
{
int k;
for(int j=0; j<=sum; j++)
{
if(!next[j])
{
if(st > list[j])
{
st = list[j];
k = j;
}
}
}
next[k] = true;
for(int j=0; j<=sum; j++)
{
if(st + map[k][j] < list[j])
{
list[j] = st + map[k][j];
}
}
}
for(int i=0; i<=sum; i++)
{
ans += list[i];
}
return ans;
}
int main()
{
int n, m, a, b, s;
while(scanf("%d", &n) != EOF && n)
{
sum = 0;
for(int i=0; i<13; i++)
{
for(int j=0; j<13; j++)
{
if(i == j)
map[i][j] = 0;
else
map[i][j] = INF;
}
}
for(int i=0; i<n; i++)
{
scanf("%d%d%d", &a, &b, &s);
if(sum < a) sum = a;
if(sum < b) sum = b;
if(map[a][b] > s)
{
map[a][b] = map[b][a] = s;
}
}
int ans = INF, k;
for(int i=0; i<=sum; i++)
{
int ww = zdl(i);
if(ans > ww)
{
ans = ww;
k = i;
}
}
printf("%d %d\n", k, ans);
}
return 0;
} | main.c: In function 'zdl':
main.c:13:9: error: unknown type name 'bool'
13 | bool next[13];
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include <string.h>
+++ |+#include <stdbool.h>
3 | #define INF 0x3f3f3f
main.c:14:22: error: 'false' undeclared (first use in this function)
14 | memset(next, false, sizeof(next));
| ^~~~~
main.c:14:22: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:14:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:23: error: 'true' undeclared (first use in this function)
19 | next[start] = true;
| ^~~~
main.c:19:23: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s389594561 | p00189 | C | #include<iostream>
#include<cstring>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
const int maxn=10200;
#define oo 1100000
int low[maxn];
int Map[1200][1200];
int v[maxn];
int ans[maxn];
int n;
#define N 111
void init()
{
for(int i=0; i<=N; i++)
for(int j=0; j<=N; j++)
{
if(i!=j)
Map[i][j] = oo;
else
Map[i][j] = 0;
}
}
void dij(int x)
{
memset(v,0,sizeof(v));
for(int i=0; i<=n; i++)
low[i] = Map[x][i];
v[x] = 1;
for(int i=1; i<=n; i++)
{
int Min = oo;
int index;
for(int j=1; j<=n; j++)
{
if(!v[j]&&low[j]<Min)
{
Min = low[j];
index = j;
}
}
v[index] = 1;
for(int j=1; j<=n; j++)
if(!v[j]&&low[j]>Min+Map[index][j])
low[j] = Min + Map[index][j];
}
}
int main()
{
int a,b,c,m;
while(scanf("%d",&m),m)
{
init();
memset(low,0,sizeof(low));
n = -1;
for(int i=1; i<=m; i++)
{
scanf("%d%d%d",&a,&b,&c);
Map[a][b] = Map[b][a] = min(c,Map[a][b]);
if(a>n) n = a;
if(b>n) n = b;
}
int k = oo;
int h;
memset(ans,0,sizeof(ans));
for(int i=0; i<=n; i++)
{
dij(i);
for(int j=0; j<=n; j++)
{
ans[i] += low[j];
}
if(k > ans[i])
{
k = ans[i];
h = i;
}
}
printf("%d %d\n",h,k);
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s971683931 | p00189 | C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;
#define oo 0x3f3f3f3f
#define maxn 66
int maps[maxn][maxn], vis[maxn], dist[maxn];
int ans;
int dij(int x)
{
memset(vis, 0, sizeof(vis));
for(int i=0; i<=ans; i++)
{
dist[i]=maps[i][x];
}
vis[x]=1;
int sum=0, t=ans;
for(int i=1; i<=ans; i++)
{
int index;
int minn=oo;
for(int j=0; j<=ans; j++)
{
if(!vis[j]&&dist[j]<minn)
{
minn=dist[j];
index=j;
}
}
sum+=minn;
vis[index]=1;
for(int j=0; j<=ans; j++)
{
if(!vis[j]&&dist[j]>minn+maps[index][j])
{
dist[j]=minn+maps[index][j];
}
}
}
return sum;
}
int main()
{
int n, a, b, c;
while(scanf("%d", &n), n)
{
ans=0;
for(int i=0; i<maxn; i++)
{
for(int j=0; j<maxn; j++)
{
maps[i][j]=maps[j][i]=(i==j?0:oo);
}
}
for(int i=0; i<n; i++)
{
scanf("%d %d %d", &a, &b, &c);
maps[a][b]=maps[b][a]=min(maps[a][b], c);
ans=max(ans, max(a, b));
}
int cnt[maxn];
for(int i=0; i<=ans; i++)
{
cnt[i]=dij(i);
}
int minn=oo, k;
for(int i=0; i<=ans; i++)
{
if(cnt[i]<minn)
{
minn=cnt[i];
k=i;
}
}
printf("%d %d\n", k,cnt[k]);
}
return 0;
} | main.c:5:9: fatal error: algorithm: No such file or directory
5 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s059126259 | p00189 | C | #include<cstdio>
#include<iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#define mem(name,value) memset(name,value,sizeof(name))
#define pb push_back
using namespace std;
typedef long long ll;
int N,n,d[12][12],sum[12],ans,MIN;
int main()
{
while(~scanf("%d",&N),N){
n=0;
mem(d,0x3f3f3f3f);
for(int i=0;i<N;i++){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
d[a][b]=d[b][a]=c;
n=a>n?a:n;
n=b>n?b:n;
}
for(int i=0;i<n;i++)
d[i][i]=0;
for(int k=0;k<=n;k++)
for(int i=0;i<=n;i++)
for(int j=0;j<=n;j++)
d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
mem(sum,0);
MIN=(1<<31)-1;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++)
sum[i]+=d[i][j];
if(sum[i]<MIN){
MIN=sum[i];
ans=i;
}
}
cout<<ans<<' '<<MIN<<endl;
}
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s912167269 | p00189 | C | #include<stdio.h>
#include<stdlib.h>
#define INF 100000
int m[10][10];
int main(void)
{
int n,a,b,time,t_num,min,index;
int i,j,k;
while (1) {
scanf("%d", &n);
if (n == 0)break;
int sum[10] = { 0 };
int town[10] = { 0 };
t_num = 0;
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++)
if (i == j)m[i][j] = 0;
else
m[i][j] = INF;
}
for (i = 0; i < n; i++) {
scanf("%d %d %d", &a, &b, &time);
town[a] = 1,town[b]=1;
m[a][b] = time;
m[b][a] = time;
}
for (i = 0; i < 10; i++) {
if (town[i] == 1)t_num++;
}
for (i = 0; i < t_num; i++) {
for (j = 0; j < t_num; j++)
for (k = 0; k < t_num; k++)
m[j][k] = min(m[j][k], m[j][i] + m[i][k]);
}
for (i = 0; i < t_num; i++) {
for (j = 0; j < t_num; j++)
sum[i] += m[i][j];
}
index = 0;
min = sum[0];
for (i = 1; i < t_num; i++) {
if (min > sum[i]) {
min = sum[i];
index = i;
}
}
printf("%d %d\n",index,min);
}
return 0;
} | main.c: In function 'main':
main.c:39:51: error: called object 'min' is not a function or function pointer
39 | m[j][k] = min(m[j][k], m[j][i] + m[i][k]);
| ^~~
main.c:9:30: note: declared here
9 | int n,a,b,time,t_num,min,index;
| ^~~
|
s533426843 | p00189 | C | #include <iostream>
#include <algorithm>
#include <cstdio>
#define INF 200000
using namespace std;
const int MAX=11;
int d[MAX][MAX];
int V=11;
int main()
{
int n;
while(~scanf("%d", &n) && n)
{
for(int i=0; i<V; i++)
{
for(int j=0; j<V; j++)
{
if(i!=j)
d[i][j]=INF;
else if(i==j)
d[i][j]=0;
}
}
for(int i=0; i<n; i++)
{
int x,y,m;
scanf("%d %d %d", &x, &y, &m);
d[x][y]=m;
d[y][x]=m;
}
// for(int i=0; i<V; i++)
// {
// for(int j=0; j<V; j++)
// {
// printf("%d ", d[i][j]);
// }
// printf("\n");
// }
// printf("\n");
for(int k=0; k<V; k++)
{
for(int i=0; i<V; i++)
{
for(int j=0; j<V; j++)
d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
}
}
int u=0;
for(int i=0; i<V; i++)
{
for(int j=1; j<V; j++)
{
if(d[i][j] != INF)
d[i][0]+=d[i][j];
}
if(d[i][0]<d[u][0])
u=i;
}
printf("%d %d\n", u, d[u][0]);
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s982062032 | p00189 | C | #include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
#include<string>
#include<iostream>
#include<stack>
#include<queue>
#include<map>
#define pi 3.1415926
#define INF 0x3f3f3f3f
using namespace std;
int Map[50][50];
int vis[15];
int main()
{
int n;
while(~scanf("%d",&n))
{
if(n==0)
break;
memset(vis,0,sizeof(vis));
for(int i=0;i<=9;i++)
for(int j=0;j<=9;j++)
{
if(i==j)
Map[i][j]=0;
else
Map[i][j]=INF;
}
// for(int i=0;i<=9;i++)
// {
// for(int j=0;j<=9;j++)
// printf("%d ",Map[i][j]);
// printf("\n");
//
// }
for(int i=1;i<=n;i++)
{
int u,v,ti;
scanf("%d%d%d",&u,&v,&ti);
Map[u][v]=Map[v][u]=ti;
vis[u]=vis[v]=1;
}
for(int k=0;k<=9;k++)
for(int i=0;i<=9;i++)
for(int j=0;j<=9;j++)
{
if(vis[i]&&vis[j]&&vis[k]&&Map[i][j]>Map[i][k]+Map[k][j])
Map[i][j]=Map[i][k]+Map[k][j];
}
int ans=INF,r;
for(int i=0;i<=9;i++)
{
int t=0;
if(vis[i])
for(int j=0;j<=9;j++)
{
if(vis[j])
t+=Map[i][j];
}
if(t<ans&&t)
{
r=i;
ans=t;
}
}
printf("%d %d\n",r,ans);
}
} | main.c:2:9: fatal error: algorithm: No such file or directory
2 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s554464010 | p00189 | C | #include<iostream>
using namespace std;
const int maxn = 20;
const int INF = 0x3f3f3f3f;
int d[maxn][maxn];
int n;
int m;
int res;
int floyd()
{
int start;
for(int i = 0; i <= m; i++)
d[i][i] = 0;
for(int k =0; k<=m; k++)
for(int i = 0; i <= m; i++)
for(int j = 0; j <= m; j++)
{
if(d[i][j] > d[i][k] + d[k][j])
d[i][j] = d[i][k] + d[k][j];
}
for(int i = 0; i <= m; i++)
{
int cnt = 0;
for(int j = 0; j <= m; j++)
cnt += d[i][j];
if(cnt < res)
{
res = cnt;
start = i;
}
}
return start;
}
int main()
{
//freopen("c:\\users\\administrator\\desktop\\in.txt","r",stdin);
while(cin >> n,n)
{
memset(d,INF,sizeof(d));
res = INF,m = 0;
for(int i = 0; i <n; i++)
{
int u,v,w;
cin >> u >> v >>w;
d[u][v] = w;
d[v][u] = w;
m = max(m,max(u,v));
}
cout<< floyd()<<" "<<res<<endl;
}
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s193892682 | p00189 | C | #include<iostream>
#include<cstdio>
#include<cmath>
#include<set>
#include<cstring>
#include<algorithm>
#include<queue>
#include<sstream>
#define N 99999999
using namespace std;
int mp[20][20],vis[20],d[20];
void init()
{
for(int i=0; i<20; i++)
for(int j=0; j<20; j++)
mp[i][j]=N;
memset(vis,0,sizeof(vis));
for(int i=0; i<20; i++)
d[i]=N;
}
int dijk(int s,int n)
{
int sum=0,i,j;
memset(vis,0,sizeof(vis));
for(i=0; i<20; i++)
d[i]=N;
d[s]=0;
while(1)
{
int k=-1;
for(i=0; i<=n; i++)
if(!vis[i]&&(k==-1||d[i]<d[k]))
k=i;
if(k==-1)break;
vis[k]=1;
for(j=0; j<=n; j++)
if(d[j]>d[k]+mp[k][j])
d[j]=d[k]+mp[k][j];
}
for(i=0; i<=n; i++)
sum+=d[i];
return sum;
}
int main()
{
int n;
while(scanf("%d",&n)&&n)
{
init();
int x,y,w,mx=-1;
while(n--)
{
scanf("%d%d%d",&x,&y,&w);
mp[x][y]=mp[y][x]=w;
mx=max(mx,x);
mx=max(mx,y);
}
int mi=N,o,i,t;
for(i=0; i<=mx; i++)
{
t=dijk(i,mx);
if(mi>t)
{
mi=t;
o=i;
}
}
printf("%d %d\n",o,mi);
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s047708974 | p00189 | C | #include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define MAX 6666666
using namespace std;
int map[10][10],p,v[10],V[10];
void floyd(int n);
int main()
{
int n,x,y,w,i,j,s,max;
while(cin>>n,n!=0)
{
s=0;
max=-1;
memset(v,0,sizeof(v));
memset(V,0,sizeof(V));
memset(map,0,sizeof(map));
for(i=0;i<n;i++)
{
cin>>x>>y>>w;
if(map[x][y]<w)
{
map[x][y]=w;
map[y][x]=w;
}
if(x>max)
max=x;
if(y>max)
max=y;
}
for(i=0;i<=max;i++)
for(j=0;j<=max;j++)
{
if(map[i][j]==0)
map[i][j]=MAX;
}
floyd(max);
for(i=0;i<=max;i++)
{
if(i!=1)
s+=v[i];
}
cout<<p<<" "<<s<<endl;
}
}
void floyd(int n)
{
int i,k;
p=MAX;
for(i=0;i<=n;i++)
for(k=0;k<=n;k++)
{
p=min(p,map[1][k]);
if(!V[k])
v[k]=map[1][k];
if(map[1][i]+map[i][k]<map[1][k])
{
map[1][k]=map[1][i]+map[i][k];
v[k]=map[i][k];
V[k]=1;
}
}
} | main.c:3:9: fatal error: iostream: No such file or directory
3 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s321803404 | p00189 | C | #include<stdio.h>
#define INF 1000000
#define rep(i,n) for((i)=0;(i)<=(int)(n);(i)++)
void warshall_floyd(void);
int min(int,int);
int graph[10][10],n;
int main(void){
int a,b,c,i,j,sum[10],ans1,ans2;
while(scanf("%d",&n),n){
for(i=0;i<9;i++)sum[i]=0;
ans1=INF;
rep(i,9){
rep(j,9){
graph[i][j]=INF;
}
graph[i][i]=0;
}
rep(i,n-1){
scanf("%d %d %d",&a,&b,&c);
graph[a][b]=graph[b][a]=c;
}
warshall_floyd();
rep(i,9)
rep(j,9)
if(graph[i][j]<INF)sum[i]+=graph[i][j];
rep(i,9){
if(ans1>sum[i] && sum[i]>0){
ans1=sum[i];
ans2=i;
}
}
printf("%d %d\n",ans2,ans1);
}
return 0;
}
void warshall_floyd(void){
int i,j,k;
rep(k,9)
for(i,9)
for(j,9)
graph[i][j]=min(graph[i][j],graph[i][k]+graph[k][j]);
}
int min(int x,int y){
return x<y?x:y;
} | main.c: In function 'warshall_floyd':
main.c:50:12: error: expected ';' before ')' token
50 | for(i,9)
| ^
| ;
main.c:50:12: error: expected expression before ')' token
main.c:51:14: error: expected ';' before ')' token
51 | for(j,9)
| ^
| ;
main.c:51:14: error: expected expression before ')' token
|
s286110801 | p00189 | C | #include <stdio.h>
struct road{
int from;
int to;
int distance;
};
int calc_shortestDistance(int, int, int, int, struct *road, int);
int main(void)
{
int n;
int a, b, c;
struct road[45];
int city_size;
int max_distance;
int min_amount, amount;
int min_city;
int i, j;
while(true){
scanf("%d", n);
if(n==0) break;
city_size=0;
max_distance=0;
for(i=0; i<n; i++){
scanf("%d %d %d", &a, &b, &c);
road[i].from=a;
road[i].to=b;
road[i].distance=c;
if(a<b && b>=city_size) city_size=b+1;
else if(a>b && a>=city_size) city_size=a+1;
if(max_distance>c) max_distance=c;
}
min_amount=city_size*(max_distance*n+1);
for(i=0; i<city_size; i++){
amount=0;
for(j=0; j<city_size; j++){
if(i==j) continue;
amount+=calc_shortestDistance(i, j, city_size, n, road, max_distance);
}
if(min_amount>amount){
min_amount=amount;
min_city=i;
}
}
printf("%d %d\n", min_city, min_amount);
}
return 0;
}
int calc_shortestDistance(int from, int to, int city_size, int road_size, struct *road, int max_distance)
{
int d[10];
int is_searched[10]; //0:is not searched, 1:is searched.
int min_d, min_city;
int i;
for(i=0; i<city_size; i++) is_searched[i]=0;
for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
d[from]=0;
while(true){
min_d=max_distance*n+1;
for(i=0; i<city_size; i++){
if(!is_searched[i] && d[i]<min_d){
min_d=d[i];
min_city=i;
}
}
if(min_city==to) break;
for(i=0; i<n; i++){
if(road[i].from==min_city){
if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
}
else if(road[i].to==min_city){
if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
}
}
is_searched[min_city]=1;
}
return d[to];
} | main.c:9:54: error: expected '{' before '*' token
9 | int calc_shortestDistance(int, int, int, int, struct *road, int);
| ^
main.c:55:82: error: expected '{' before '*' token
55 | int calc_shortestDistance(int from, int to, int city_size, int road_size, struct *road, int max_distance)
| ^
main.c: In function 'calc_shortestDistance':
main.c:63:30: error: 'd' undeclared (first use in this function)
63 | for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
| ^
main.c:63:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:63:48: error: 'n' undeclared (first use in this function)
63 | for(i=0; i<city_size; i++) d[i]=max_distance*n+1;
| ^
main.c:66:9: error: 'true' undeclared (first use in this function)
66 | while(true){
| ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
1 | #include <stdio.h>
+++ |+#include <stdbool.h>
2 |
main.c:77:17: error: request for member 'from' in something not a structure or union
77 | if(road[i].from==min_city){
| ^
main.c:78:21: error: request for member 'to' in something not a structure or union
78 | if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
| ^
main.c:78:39: error: request for member 'distance' in something not a structure or union
78 | if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
| ^
main.c:78:59: error: request for member 'to' in something not a structure or union
78 | if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
| ^
main.c:78:77: error: request for member 'distance' in something not a structure or union
78 | if(d[road[i].to]>min_d+road[i].distance) d[road[i].to]=min_d+road[i].distance;
| ^
main.c:80:22: error: request for member 'to' in something not a structure or union
80 | else if(road[i].to==min_city){
| ^
main.c:81:21: error: request for member 'from' in something not a structure or union
81 | if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
| ^
main.c:81:41: error: request for member 'distance' in something not a structure or union
81 | if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
| ^
main.c:81:61: error: request for member 'from' in something not a structure or union
81 | if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
| ^
main.c:81:81: error: request for member 'distance' in something not a structure or union
81 | if(d[road[i].from]>min_d+road[i].distance) d[road[i].from]=min_d+road[i].distance;
| ^
|
s107175282 | p00189 | C++ | #include<iostream>
#include<cstring>
using namespace std;
int time[10][10];
int town;
int INF = 9999;
void fw(){
for(int k = 0; k <= town; k++){
for(int i = 0; i <= town; i++){
for(int j = 0; j <= town; j++){
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
}
void solve(){
int ret, mintime = 1<<21;
for(int i = 0; i <= town; i++){
int candidate = 0;
for(int j = 0; j <= town; j++){
candidate += time[i][j];
}
if(candidate < mintime){
mintime = candidate;
ret = i;
}
}
cout << ret << " " << mintime << endl;
}
int main(){
while(1){
int n;
cin >> n;
if(n == 0) break;
town = 0;
memset(time, INF, sizeof(time));
for(int i = 0; i < 10; i++) time[i][i] = 0;
int a, b, c;
while(n-- > 0){
cin >> a >> b >> c;
time[a][b] = time[b][a] = c;
town = max(town, max(a,b));
}
fw();
solve();
}
return 0;
}
| a.cc:5:16: error: 'int time [10][10]' redeclared as different kind of entity
5 | int time[10][10];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void fw()':
a.cc:13:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:68: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:57: error: invalid operands of types 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator+'
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ~~~~~~~~~~ ^ ~~~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| time_t(time_t*) noexcept {aka long int(long int*) noexcept}
a.cc: In function 'void solve()':
a.cc:24:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ^
a.cc:24:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ^
a.cc:24:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ~~~~~~~~~~^~~~~~~~~~~~~
a.cc:24:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
24 | candidate += time[i][j];
| ~~~~~~~~~~^~~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc: In function 'int main()':
a.cc:43:34: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
43 | memset(time, INF, sizeof(time));
| ~^~~~~
a.cc:43:16: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
43 | memset(time, INF, sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:2:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:44:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ^
a.cc:44:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ^
a.cc:44:48: error: assignment of read-only location '*(time + (((sizetype)i) * 2))'
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ~~~~~~~~~~~^~~
a.cc:49:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:37: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
49 | time[a][b] = time[b][a] = c;
| ~~~~~~~~~~~^~~
|
s633789902 | p00189 | C++ | #include<iostream>
#include<cstring>
using namespace std;
int time[10][10];
int town;
int INF = 9999;
void fw(){
for(int k = 0; k <= town; k++){
for(int i = 0; i <= town; i++){
for(int j = 0; j <= town; j++){
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
}
void solve(){
int ret, mintime = 1<<21;
for(int i = 0; i <= town; i++){
int candidate = 0;
for(int j = 0; j <= town; j++){
candidate += time[i][j];
}
if(candidate < mintime){
mintime = candidate;
ret = i;
}
}
cout << ret << " " << mintime << endl;
}
int main(){
while(1){
int n;
cin >> n;
if(n == 0) break;
town = 0;
memset(time, INF, sizeof(time));
for(int i = 0; i < 10; i++) time[i][i] = 0;
int a, b, c;
while(n-- > 0){
cin >> a >> b >> c;
time[a][b] = time[b][a] = c;
town = max(town, max(a,b));
}
fw();
solve();
}
return 0;
}
| a.cc:5:16: error: 'int time [10][10]' redeclared as different kind of entity
5 | int time[10][10];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void fw()':
a.cc:13:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:68: warning: pointer to a function used in arithmetic [-Wpointer-arith]
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:13:57: error: invalid operands of types 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator+'
13 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ~~~~~~~~~~ ^ ~~~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| time_t(time_t*) noexcept {aka long int(long int*) noexcept}
a.cc: In function 'void solve()':
a.cc:24:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ^
a.cc:24:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ^
a.cc:24:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | candidate += time[i][j];
| ~~~~~~~~~~^~~~~~~~~~~~~
a.cc:24:23: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
24 | candidate += time[i][j];
| ~~~~~~~~~~^~~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc: In function 'int main()':
a.cc:43:34: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
43 | memset(time, INF, sizeof(time));
| ~^~~~~
a.cc:43:16: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
43 | memset(time, INF, sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:2:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:44:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ^
a.cc:44:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ^
a.cc:44:48: error: assignment of read-only location '*(time + (((sizetype)i) * 2))'
44 | for(int i = 0; i < 10; i++) time[i][i] = 0;
| ~~~~~~~~~~~^~~
a.cc:49:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
49 | time[a][b] = time[b][a] = c;
| ^
a.cc:49:37: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
49 | time[a][b] = time[b][a] = c;
| ~~~~~~~~~~~^~~
|
s017138595 | p00189 | C++ | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
using namespace std;
const int maxn=110;
const int INF=99999999;
int n,m;
int Map[maxn][maxn];
int Min(int x,int y)
{return x<y ? x:y;}
int main()
{
while(cin>>m&&m!=0)
{
for(int i=1;i<maxn;i++)
for(int j=1;j<maxn;j++)
if(i==j)Map[i][j]=0;
else Map[i][j]=INF;
n=0;
for(int i=0;i<m;i++)
{
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if(a+1>n)n=a+1;
if(b+1>n)n=b+1;
Map[a+1][b+1]=Map[b+1][a+1]=c;
}
for(int k=1;k<=n;k++)
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(i!=j&&j!=k&&k!=i)
Map[i][j]=Min(Map[i][j],Map[i][k]+Map[k][j]);
int mm=INT_MAX;
int ans;
for(int i=1;i<=n;i++)
{
int step=0;
for(int j=1;j<=n;j++)
step+=Map[i][j];
if(step<mm)
{
mm=step;
ans=i;
}
}
cout<<ans-1<<' '<<mm<<endl;
}
}
| a.cc: In function 'int main()':
a.cc:40:16: error: 'INT_MAX' was not declared in this scope
40 | int mm=INT_MAX;
| ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
7 | #include <set>
+++ |+#include <climits>
8 |
|
s532498236 | p00189 | C++ | #include<algorithm>
#include<stdio.h>
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
#define N 15
int n;
int dis[N],maps[N][N];
int main()
{
int i,a,b,c,j,k;
while(scanf("%d",&n),n)
{
for(i=0;i<N;i++)
{
for(j=0;j<N;j++)
{
maps[i][j]=(i==j)?0:INF;
}
}
int m=-1;
for( i=0; i<n; i++)
{
scanf("%d%d%d",&a,&b,&c);
m=max(a,m);
m=max(b,m);
maps[a][b]=maps[b][a]=c;
}
for(k=0;k<=m;k++)
{
for(i=0;i<=m;i++)
{
for(j=0;j<=m;j++)
{
if(maps[i][j]>maps[i][k]+maps[k][j])
maps[i][j]=maps[i][k]+maps[k][j];
}
}
}
int Min=INF;
int index=-1;
memset(dis,0,sizeof(dis));
for(i=0;i<=m;i++)
{
for(j=0;j<=m;j++)
{
dis[i]=dis[i]+maps[i][j];
}
if(Min>dis[i])
{
index=i;
Min=dis[i];
}
}
printf("%d %d\n",index,Min);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:46:9: error: 'memset' was not declared in this scope
46 | memset(dis,0,sizeof(dis));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<stdio.h>
+++ |+#include <cstring>
3 | #define INF 0x3f3f3f3f
|
s027506606 | p00189 | C++ | #include <algorithm>
#include <cstdio>
#include <limits>
#include <queue>
#include <vector>
using namespace std;
int d[10][10];
int main() {
for (;;) {
int n; scanf("%d", &n);
if (n == 0) break;
for (int u = 0; u < 10; u++)
for (int v = 0; v < 10; v++)
d[u][v] = (u == v) ? 0 : (INT_MAX / 2);
int N = 0;
for (; n > 0; n--) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
d[a][b] = c;
d[b][a] = c;
N = max(N, max(a + 1, b + 1));
}
for (int k = 0; k < N; k++)
for (int u = 0; u < N; u++)
for (int v = 0; v < N; v++)
d[u][v] = min(d[u][v], d[u][k] + d[k][v]);
int umin = 0, dmin = INT_MAX;
for (int u = 0; u < N; u++) {
int dsum = 0;
for (int v = 0; v < N; v++)
dsum += d[u][v];
if (dsum < dmin) {
umin = u;
dmin = dsum;
}
}
printf("%d %d\n", umin, dmin);
}
} | a.cc: In function 'int main()':
a.cc:16:59: error: 'INT_MAX' was not declared in this scope
16 | d[u][v] = (u == v) ? 0 : (INT_MAX / 2);
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <queue>
+++ |+#include <climits>
5 | #include <vector>
a.cc:29:38: error: 'INT_MAX' was not declared in this scope
29 | int umin = 0, dmin = INT_MAX;
| ^~~~~~~
a.cc:29:38: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s647397199 | p00189 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
typedef struct edge {
int from;
int to;
int time;
} edge;
int main(){
int n;
while (cin >> n && n != 0) {
int min_ = INT_MAX;
int min_num = 1;
vector<edge> town;
int cost[50][50];
int max_ = 0;
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
cost[i][j] = INT_MAX / 10;
}
}
for (int i = 0; i < 50; i++) {
cost[i][i] = 0;
}
for (int i = 0; i < n; i++) {
edge tmp;
cin >> tmp.from >> tmp.to >> tmp.time;
cost[tmp.from][tmp.to] = tmp.time;
cost[tmp.to][tmp.from] = tmp.time;
max_ = max(max(tmp.from, tmp.to), max_);
}
max_++;
for (int i = 0; i < max_; i++) {
for (int j = 0; j < max_; j++) {
for (int k = 0; k < max_; k++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (int i = 0; i < max_; i++) {
int total = 0;
for (int j = 0; j < max_; j++) {
total += cost[i][j];
}
if (total < min_) {
min_ = total;
min_num = i;
}
}
cout << min_num << " " << min_ << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:28: error: 'INT_MAX' was not declared in this scope
29 | int min_ = INT_MAX;
| ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
13 | #include<utility>
+++ |+#include <climits>
14 |
|
s300578831 | p00189 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
typedef struct edge {
int from;
int to;
int time;
} edge;
int main(){
int n;
while (cin >> n && n != 0) {
int min_ = INT_MAX;
int min_num = 1;
vector<edge> town;
int cost[50][50];
int max_ = 0;
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
cost[i][j] = INT_MAX / 10;
}
}
for (int i = 0; i < 50; i++) {
cost[i][i] = 0;
}
for (int i = 0; i < n; i++) {
edge tmp;
cin >> tmp.from >> tmp.to >> tmp.time;
cost[tmp.from][tmp.to] = tmp.time;
cost[tmp.to][tmp.from] = tmp.time;
max_ = max(max(tmp.from, tmp.to), max_);
}
max_++;
for (int i = 0; i < max_; i++) {
for (int j = 0; j < max_; j++) {
for (int k = 0; k < max_; k++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (int i = 0; i < max_; i++) {
int total = 0;
for (int j = 0; j < max_; j++) {
total += cost[i][j];
}
if (total < min_) {
min_ = total;
min_num = i;
}
}
cout << min_num << " " << min_ << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:28: error: 'INT_MAX' was not declared in this scope
29 | int min_ = INT_MAX;
| ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
13 | #include<utility>
+++ |+#include <climits>
14 |
|
s551553315 | p00189 | C++ | 6
0 1 80
1 2 20
0 2 60
2 3 50
3 4 60
1 4 90
2
0 1 1
1 2 1
0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 6
| ^
|
s382738749 | p00189 | C++ | //繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };
int n, s, g, c;
VVI _map;
//繝ッ繝シ繧キ繝」繝ォ繝輔Ο繧、繝?void warshall_floyd( VVI &root ) {
for ( int i = 0; i < root.size(); i++ ) {
for ( int j = 0; j < root.size(); j++ ) {
for ( int k = 0; k < root.size(); k++ ) {
root[ j ][ k ] = root[ k ][ j ] = min( root[ j ][ k ], root[ j ][ i ] + root[ i ][ k ] );
}
}
}
}
//繝ヲ繝シ繧ー繝ェ繝?ラ莠帝勁豕?int gcd( int n, int m ) {
if ( m == 0 ) {
return n;
}
return gcd( m, n % m );
}
//邏?焚縺ョ驟榊?繧剃ス懈?
void make_prime( VI &pm, int max ) {
vector<bool> is_pm( max + 1, true );
is_pm[ 0 ] = is_pm[ 1 ] = false;
for ( int i = 2; i * i <= max; i += 2 ) {
if ( is_pm[ i ] ) {
for ( int j = i * i; j <= max; j += i ) {
is_pm[ j ] = false;
if ( i != 2 ) {
j += i;
}
}
if ( i == 2 ) {
--i;
}
}
}
for ( int i = 2; i <= max; i += 2 ) {
if ( is_pm[ i ] ) {
pm.push_back( i );
if ( i == 2 ) {
--i;
}
}
}
}
int main() {
while ( ~scanf( "%d", &n ) && n ) {
_map.resize( 100 );
for ( int i = 0; i < 100; i++ ) {
_map[ i ].resize( 100 );
for ( int j = 0; j < 100; j++ ) {
if ( i == j ) {
_map[ i ][ j ] = 0;
}
else {
_map[ i ][ j ] = INF;
}
}
}
int max_town = 0;
for ( int i = 0; i < n; i++ ) {
scanf( "%d %d %d", &s, &g, &c );
_map[ s ][ g ] = _map[ g ][ s ] = c;
max_town = max( max_town, max( g, s ) + 1 );
}
warshall_floyd( _map );
int ans_cost = INF, ans_town;
for ( int i = 0; i < max_town; i++ ) {
int cost = 0;
for ( int j = 0; j < max_town; j++ ) {
cost += _map[ i ][ j ];
}
if ( ans_cost > cost ) {
ans_cost = cost;
ans_town = i;
}
}
printf( "%d %d\n", ans_town, ans_cost );
}
return 0;
} | a.cc:20:9: error: 'vector' does not name a type
20 | typedef vector<int> VI;
| ^~~~~~
a.cc:21:9: error: 'vector' does not name a type
21 | typedef vector<VI> VVI;
| ^~~~~~
a.cc:22:9: error: 'vector' does not name a type
22 | typedef vector<string> VS;
| ^~~~~~
a.cc:23:9: error: 'pair' does not name a type
23 | typedef pair<int, int> PII;
| ^~~~
a.cc:25:9: error: 'vector' does not name a type
25 | typedef vector<LL> VLL;
| ^~~~~~
a.cc:26:9: error: 'vector' does not name a type
26 | typedef vector<VLL> VVLL;
| ^~~~~~
a.cc:29:9: error: 'priority_queue' does not name a type
29 | typedef priority_queue<int> maxpq;
| ^~~~~~~~~~~~~~
a.cc:30:9: error: 'priority_queue' does not name a type
30 | typedef priority_queue< int, vector<int>, greater<int> > minpq;
| ^~~~~~~~~~~~~~
a.cc:32:26: error: 'acos' was not declared in this scope
32 | static const double PI = acos( -1.0 );
| ^~~~
a.cc:42:1: error: 'VVI' does not name a type
42 | VVI _map;
| ^~~
a.cc:44:9: error: expected unqualified-id before 'for'
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^~~
a.cc:44:26: error: 'i' does not name a type
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^
a.cc:44:43: error: 'i' does not name a type
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^
a.cc:51:1: error: expected declaration before '}' token
51 | }
| ^
a.cc:54:9: error: expected unqualified-id before 'if'
54 | if ( m == 0 ) {
| ^~
a.cc:57:9: error: expected unqualified-id before 'return'
57 | return gcd( m, n % m );
| ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
58 | }
| ^
a.cc:61:6: error: variable or field 'make_prime' declared void
61 | void make_prime( VI &pm, int max ) {
| ^~~~~~~~~~
a.cc:61:18: error: 'VI' was not declared in this scope; did you mean 'PI'?
61 | void make_prime( VI &pm, int max ) {
| ^~
| PI
a.cc:61:22: error: 'pm' was not declared in this scope
61 | void make_prime( VI &pm, int max ) {
| ^~
a.cc:61:26: error: expected primary-expression before 'int'
61 | void make_prime( VI &pm, int max ) {
| ^~~
a.cc: In function 'int main()':
a.cc:89:18: error: 'scanf' was not declared in this scope
89 | while ( ~scanf( "%d", &n ) && n ) {
| ^~~~~
a.cc:90:17: error: '_map' was not declared in this scope
90 | _map.resize( 100 );
| ^~~~
a.cc:106:51: error: 'max' was not declared in this scope
106 | max_town = max( max_town, max( g, s ) + 1 );
| ^~~
a.cc:106:36: error: 'max' was not declared in this scope
106 | max_town = max( max_town, max( g, s ) + 1 );
| ^~~
a.cc:108:17: error: 'warshall_floyd' was not declared in this scope
108 | warshall_floyd( _map );
| ^~~~~~~~~~~~~~
a.cc:120:17: error: 'printf' was not declared in this scope
120 | printf( "%d %d\n", ans_town, ans_cost );
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | //繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>
|
s590308432 | p00189 | C++ | //繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };
int n, s, g, c;
VVI _map;
//繝ッ繝シ繧キ繝」繝ォ繝輔Ο繧、繝?void warshall_floyd( VVI &root ) {
for ( int i = 0; i < root.size(); i++ ) {
for ( int j = 0; j < root.size(); j++ ) {
for ( int k = 0; k < root.size(); k++ ) {
root[ j ][ k ] = root[ k ][ j ] = min( root[ j ][ k ], root[ j ][ i ] + root[ i ][ k ] );
}
}
}
}
//繝ヲ繝シ繧ー繝ェ繝?ラ莠帝勁豕?int gcd( int n, int m ) {
if ( m == 0 ) {
return n;
}
return gcd( m, n % m );
}
//邏?焚縺ョ驟榊?繧剃ス懈?
void make_prime( VI &pm, int max ) {
vector<bool> is_pm( max + 1, true );
is_pm[ 0 ] = is_pm[ 1 ] = false;
for ( int i = 2; i * i <= max; i += 2 ) {
if ( is_pm[ i ] ) {
for ( int j = i * i; j <= max; j += i ) {
is_pm[ j ] = false;
if ( i != 2 ) {
j += i;
}
}
if ( i == 2 ) {
--i;
}
}
}
for ( int i = 2; i <= max; i += 2 ) {
if ( is_pm[ i ] ) {
pm.push_back( i );
if ( i == 2 ) {
--i;
}
}
}
}
int main() {
while ( ~scanf( "%d", &n ) && n ) {
_map.resize( 100 );
for ( int i = 0; i < 100; i++ ) {
_map[ i ].resize( 100 );
for ( int j = 0; j < 100; j++ ) {
if ( i == j ) {
_map[ i ][ j ] = 0;
}
else {
_map[ i ][ j ] = INF;
}
}
}
int max_town = 0;
for ( int i = 0; i < n; i++ ) {
scanf( "%d %d %d", &s, &g, &c );
_map[ s ][ g ] = _map[ g ][ s ] = c;
max_town = max( max_town, max( g, s ) + 1 );
}
warshall_floyd( _map );
int ans_cost = INF, ans_town;
for ( int i = 0; i < max_town; i++ ) {
int cost = 0;
for ( int j = 0; j < max_town; j++ ) {
cost += _map[ i ][ j ];
}
if ( ans_cost > cost ) {
ans_cost = cost;
ans_town = i;
}
}
printf( "%d %d\n", ans_town, ans_cost );
}
return 0;
} | a.cc:20:9: error: 'vector' does not name a type
20 | typedef vector<int> VI;
| ^~~~~~
a.cc:21:9: error: 'vector' does not name a type
21 | typedef vector<VI> VVI;
| ^~~~~~
a.cc:22:9: error: 'vector' does not name a type
22 | typedef vector<string> VS;
| ^~~~~~
a.cc:23:9: error: 'pair' does not name a type
23 | typedef pair<int, int> PII;
| ^~~~
a.cc:25:9: error: 'vector' does not name a type
25 | typedef vector<LL> VLL;
| ^~~~~~
a.cc:26:9: error: 'vector' does not name a type
26 | typedef vector<VLL> VVLL;
| ^~~~~~
a.cc:29:9: error: 'priority_queue' does not name a type
29 | typedef priority_queue<int> maxpq;
| ^~~~~~~~~~~~~~
a.cc:30:9: error: 'priority_queue' does not name a type
30 | typedef priority_queue< int, vector<int>, greater<int> > minpq;
| ^~~~~~~~~~~~~~
a.cc:32:26: error: 'acos' was not declared in this scope
32 | static const double PI = acos( -1.0 );
| ^~~~
a.cc:42:1: error: 'VVI' does not name a type
42 | VVI _map;
| ^~~
a.cc:44:9: error: expected unqualified-id before 'for'
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^~~
a.cc:44:26: error: 'i' does not name a type
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^
a.cc:44:43: error: 'i' does not name a type
44 | for ( int i = 0; i < root.size(); i++ ) {
| ^
a.cc:51:1: error: expected declaration before '}' token
51 | }
| ^
a.cc:54:9: error: expected unqualified-id before 'if'
54 | if ( m == 0 ) {
| ^~
a.cc:57:9: error: expected unqualified-id before 'return'
57 | return gcd( m, n % m );
| ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
58 | }
| ^
a.cc:61:6: error: variable or field 'make_prime' declared void
61 | void make_prime( VI &pm, int max ) {
| ^~~~~~~~~~
a.cc:61:18: error: 'VI' was not declared in this scope; did you mean 'PI'?
61 | void make_prime( VI &pm, int max ) {
| ^~
| PI
a.cc:61:22: error: 'pm' was not declared in this scope
61 | void make_prime( VI &pm, int max ) {
| ^~
a.cc:61:26: error: expected primary-expression before 'int'
61 | void make_prime( VI &pm, int max ) {
| ^~~
a.cc: In function 'int main()':
a.cc:89:18: error: 'scanf' was not declared in this scope
89 | while ( ~scanf( "%d", &n ) && n ) {
| ^~~~~
a.cc:90:17: error: '_map' was not declared in this scope
90 | _map.resize( 100 );
| ^~~~
a.cc:106:51: error: 'max' was not declared in this scope
106 | max_town = max( max_town, max( g, s ) + 1 );
| ^~~
a.cc:106:36: error: 'max' was not declared in this scope
106 | max_town = max( max_town, max( g, s ) + 1 );
| ^~~
a.cc:108:17: error: 'warshall_floyd' was not declared in this scope
108 | warshall_floyd( _map );
| ^~~~~~~~~~~~~~
a.cc:120:17: error: 'printf' was not declared in this scope
120 | printf( "%d %d\n", ans_town, ans_cost );
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | //繝ゥ繧、繝悶Λ繝ェ繝?せ繝?#include <bits/stdc++.h>
|
s211006030 | p00189 | C++ | #include <cstdio>
#include <iostream>
#include <queue>
using namespace std;
int main(){
while(1){
int n;
long road[10][10];
scanf(" %d", &n);
if(n==0) break;
memset(road, -1, sizeof(road));
for(int i=0; i<10; ++i) road[i][i]=0;
int city=0; //街の数
for(int i=0; i<n; ++i){
int a, b, c;
scanf(" %d %d %d", &a, &b, &c);
road[a][b]=road[b][a]=c;
if(city<a) city=a;
if(city<b) city=b;
}
long ans[10]={0};
//各街を根としてbfs
for(int i=0; i<=city; ++i){
long cost[10]; //その街までの最小コスト
for(int j=0; j<=city; ++j) cost[j]=1000000000; //とりあえず大きいので初期化
queue<int> que;
cost[i]=0;
que.push(i);
while( !que.empty() ){
int v=que.front();
que.pop();
for(int j=0; j<10; ++j){
if(v==j) continue;
if(road[v][j]>=0 && cost[v]+road[v][j]<cost[j]){
cost[j]=cost[v]+road[v][j];
que.push(j);
}
}
}
/*
printf("city %d to:\n", i);
for(int j=0; j<=city; ++j) printf(" %d is %ld\n", j, cost[j]);
*/
for(int j=0; j<=city; ++j) ans[i]+=cost[j];
}
int a=0;
for(int i=1; i<=city; ++i)
if(ans[a]>ans[i]) a=i;
printf("%d %ld\n", a, ans[a]);
}
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
13 | memset(road, -1, sizeof(road));
| ^~~~~~
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 | using namespace std;
|
s559005512 | p00189 | C++ | // Warshall-floyd
#include <iostream>
#include <algorith>
using namespace std;
#define INF 114514810
int n, a, b, c, v, d[11][11];// v: num of nodes
void init()
{
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
if(i==j)// If not exist cost, cost=INF
d[i][j] = 0;
else
d[i][j] = INF;
}
}
}
int main(void)
{
ios::sync_with_stdio(false);
while(cin >> n) {
if(n == 0) break;
init();
v = -1;
for(int i=0; i<n; i++) {
cin >> a >> b >> c;
d[a][b] = c; d[b][a] = c;
v = max(max(v, a), b);
}
v++;
for(int k=0; k<v; k++) {
for(int i=0; i<v; i++) {
for(int j=0; j<v; j++) {
d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}
}
}
int city, dist = INF;
for(int i=0; i<v; i++) {
int sum = 0;
for(int j=0; j<v; j++) {
sum += d[i][j];
}
if(dist > sum) {
dist = sum;
city = i;
}
}
cout << city << " " << dist << endl;
}
return 0;
} | a.cc:3:10: fatal error: algorith: No such file or directory
3 | #include <algorith>
| ^~~~~~~~~~
compilation terminated.
|
s574182569 | p00189 | C++ | #include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
using namespace std;
#define INF INT_MAX>>1
int main()
{
// freopen("in","r",stdin);
int n;
while(scanf("%d",&n)&&n){
int u,v,w,max_v=0;
int g[15][15];
memset(g,0x3f3f,sizeof(g));
for(int i=0;i<n;i++){
scanf("%d %d %d",&u,&v,&w);
g[u][v]=g[v][u]=w;
max_v = max(max_v,u);
max_v = max(max_v,v);
}
for(int k=0;k<=max_v;k++){
for(int i=0;i<=max_v;i++){
for(int j=0;j<=max_v;j++){
if(g[i][k]+g[k][j]<g[i][j])
g[i][j] = g[i][k]+g[k][j];
}
}
}
int ans_sum = INF,ans_i;
for(int i=0;i<=max_v;i++){
int sum = 0;
for(int j=0;j<=max_v;j++){
if(i!=j){
sum += g[i][j];
}
}
if(sum < ans_sum){
ans_sum = sum;
ans_i = i;
}
}
printf("%d %d\n",ans_i,ans_sum);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:13: error: 'INT_MAX' was not declared in this scope
11 | #define INF INT_MAX>>1
| ^~~~~~~
a.cc:37:23: note: in expansion of macro 'INF'
37 | int ans_sum = INF,ans_i;
| ^~~
a.cc:10:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
9 | #include <sstream>
+++ |+#include <climits>
10 | using namespace std;
a.cc:47:17: error: 'ans_i' was not declared in this scope; did you mean 'ans_sum'?
47 | ans_i = i;
| ^~~~~
| ans_sum
a.cc:50:26: error: 'ans_i' was not declared in this scope; did you mean 'ans_sum'?
50 | printf("%d %d\n",ans_i,ans_sum);
| ^~~~~
| ans_sum
|
s535443054 | p00189 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 10;
const int M = 10;
const int INF = 0x3f3f3f3f;
int d[N][N];
int n;
/*void input()
{
for (int i = 0; i < N; i ++)
fill(d[i], d[i]+N, INF);
int m;
cin >> m;
n = 0;
while ( m-- ) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
d[a][b] = d[b][a] = c;
n = max(max(n, a+1), b+1);
}
}*/
void solve()
{
for (int k = 0; k < n; k ++) {
for (int i = 0; i < n; i ++) {
for (int j = 0; j < n; j ++) {
d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
}
}
}
int sum, msum = INF;
int id = 0;
for (int i = 0; i < n; i ++) {
sum = 0;
for (int j = 0; j < n; j ++) {
if (i == j) continue;
sum += d[i][j];
}
if (sum < msum) {
msum = sum;
id = i;
}
}
printf("%d %d\n", id, msum);
}
int main(void)
{
int m;
while ( cin >> m && m ) {
for (int i = 0; i < N; i ++)
fill(d[i], d[i]+N, INF);
n = 0;
while ( m-- ) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
d[a][b] = d[b][a] = c;
n = max(max(n, a+1), b+1);
}
solve();
}
re | a.cc: In function 'int main()':
a.cc:64:5: error: 're' was not declared in this scope
64 | re
| ^~
a.cc:64:7: error: expected '}' at end of input
64 | re
| ^
a.cc:50:1: note: to match this '{'
50 | {
| ^
|
s738544828 | p00189 | C++ | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main{
public static void main(String[] args)throws Exception{
new Main().solve();
}
void solve(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();//the number of roads
Dijkstra ds=new Dijkstra(10);
for(int i=0;i<n;i++){
int from=sc.nextInt();
int to=sc.nextInt();
int cost=sc.nextInt();
ds.addEdge(from, to, cost);
ds.addEdge(to, from, cost);
}
long ans=99999999999L;
long ans2=0;
for(int i=0;i<n;i++){
long a=ds.getShortestPath(i);
if(a==0)continue;
if(ans>a){
ans=a;
ans2=i;
}
}
System.out.println(ans2+" "+ans);
}
}
class Dijkstra{
int n;
long[] d;
int s;
PriorityQueue<Vertice> pq;
final long INF=Long.MAX_VALUE/4;
Dijkstra(int n){
this.n=n;
d=new long[n];
@SuppressWarnings("unchecked")
List<Edge>[]edges=new List[n];
for(int i=0;i<n;i++){
edges[i]=new ArrayList<Edge>();
}
s=-1;
}
public long getShortestPath(int i){
if(i!=s){
s=i;
Arrays.fill(d, INF);
d[i]=0;
pq=new PriorityQueue<Vertice>();
pq.add(new Vertice(i,d[i]));
while(!pq.isEmpty()){
Vertice u=pq.poll();
if(d[u.me]<u.cost){
continue;//skip old vertex
}
for(int ii=0;ii<edges[u.me].size();ii++){
Edge e=edges[u.me].get(ii);
if(d[e.from]!=INF&&e.cost+d[e.from]<d[e.to]){
d[e.to]=e.cost+d[e.from];
pq.add(new Vertice(e.to,d[e.to]));
}else{
}
}
}
s=i;
}
int sum=0;
for(int ii=0;ii<d.length;ii++){
if(d[ii]==INF)continue;
sum+=d[ii];
}
return sum;
}
void addEdge(int from,int to,long cost){
edges[from].add(new Edge(from,to,cost));
}
}
class Edge{
int from;
int to;
long cost;
Edge(int i,int j,long cost){
this.from=i;
this.to=j;
this.cost=cost;
}
}
class Vertice implements Comparable<Vertice>{
int me;
long cost;
Vertice(int me,long cost){
this.me=me;
this.cost=cost;
}
@Override
public int compareTo(Vertice o){
return Long.compare(this.cost, o.cost);
}
}
void tr(Object...o){System.out.println(Arrays.deepToString(o));}
} | a.cc:48:25: error: stray '@' in program
48 | @SuppressWarnings("unchecked")
| ^
a.cc:106:17: error: stray '@' in program
106 | @Override
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import java.util.ArrayList;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Arrays;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.util.List;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.PriorityQueue;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.Scanner;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
7 | public class Main{
| ^~~~~~
|
s091273300 | p00189 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
using namespace std;
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second
#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
struct edge {
int to, cost;
edge(int _to, int _cost) :to(_to), cost(_cost){};
};
vector<edge> G[100];
int n, a, b, c;
int d[100];
set<int> si;
set<int>::iterator it;
void dijkstra(int s){
fill(d, d + 100, INF);
d[s] = 0;
priority_queue<P> que;
que.push(P(0, s));
while (!que.empty()){
P p = que.top(); que.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;
que.push(P(d[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n&&n){
REP(i, n){
cin >> a >> b >> c;
if (si.find(a) == si.end())si.insert(a);
if (si.find(b) == si.end())si.insert(b);
G[a].push_back(edge(b, c));
G[b].push_back(edge(a, c));
}
int ans = INT_MAX, index = INT_MAX;
it = si.begin();
REP(i, si.size()){
int sum = 0;
dijkstra(*it + i);
REP(i, si.size()){
sum += d[i];
}
if (ans > sum){
ans = sum;
index = *it + i;
}
}
cout << index << " " << ans << endl;
REP(i, si.size()){
G[*it + i].clear();
}
si.clear();
}
} | a.cc: In function 'int main()':
a.cc:80:27: error: 'INT_MAX' was not declared in this scope
80 | int ans = INT_MAX, index = INT_MAX;
| ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include <complex>
+++ |+#include <climits>
16 |
a.cc:90:33: error: 'index' was not declared in this scope
90 | index = *it + i;
| ^~~~~
a.cc:93:25: error: 'index' was not declared in this scope
93 | cout << index << " " << ans << endl;
| ^~~~~
|
s905617445 | p00189 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
using namespace std;
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second
#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
struct edge {
int to, cost;
edge(int _to, int _cost) :to(_to), cost(_cost){};
};
vector<edge> G[100];
int n, a, b, c;
int d[100];
set<int> si;
set<int>::iterator it;
void dijkstra(int s){
fill(d, d + 100, INF);
d[s] = 0;
priority_queue<P> que;
que.push(P(0, s));
while (!que.empty()){
P p = que.top(); que.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;
que.push(P(d[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n&&n){
REP(i, n){
cin >> a >> b >> c;
if (si.find(a) == si.end())si.insert(a);
if (si.find(b) == si.end())si.insert(b);
G[a].push_back(edge(b, c));
G[b].push_back(edge(a, c));
}
int ans = INT_MAX, index = INT_MAX;
it = si.begin();
REP(i, si.size()){
int sum = 0;
dijkstra(*it + i);
REP(i, si.size()){
sum += d[i];
}
if (ans > sum){
ans = sum;
index = *it + i;
}
}
cout << index << " " << ans << endl;
REP(i, si.size()){
G[*it + i].clear();
}
si.clear();
}
} | a.cc: In function 'int main()':
a.cc:80:27: error: 'INT_MAX' was not declared in this scope
80 | int ans = INT_MAX, index = INT_MAX;
| ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include <complex>
+++ |+#include <climits>
16 |
a.cc:90:33: error: 'index' was not declared in this scope
90 | index = *it + i;
| ^~~~~
a.cc:93:25: error: 'index' was not declared in this scope
93 | cout << index << " " << ans << endl;
| ^~~~~
|
s929475961 | p00189 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
#define INF 100000
int road, max = 0, time[10][10],sum,root[10];
void dijkstra(int a) {
int i,j,k=INF,used[10],minroot;
for (i = 0; i <= max; i++) {
used[i] = 0;
root[i] = INF;
}
root[a] = 0;
while (1) {
minroot = INF;
for (i = 0; i <= max; i++) {
if (used[i] == 0&&root[i]<minroot) {
j = i;
minroot = root[i];
}
}
if (k == j) {
break;
}
else {
k = j;
}
used[j] = 1;
for (i = 0; i <= max; i++) {
if (root[i] > root[j] + time[j][i]) {
root[i] = root[j] + time[j][i];
}
}
}
sum = 0;
for (i = 0; i <= max; i++)sum += root[i];
return ;
}
int main() {
cin >> road;
int i, j, a, b, c, save_a[45], save_b[45],save_c[45], min_sum=INF ,ans_town;
for (i = 1; i <= road; i++) {
cin >> a >> b >> c;
if (max < a) max = a;
if (max < b) max = b;
save_a[i] = a;
save_b[i] = b;
save_c[i] = c;
}
for (i = 0; i <= max; i++) {
for (j = 0; j <= max; j++) {
time[i][j] = INF;
}
time[i][i] = 0;
}
for (i = 1; i <= road; i++) {
time[save_a[i]][save_b[i]] = save_c[i];
time[save_b[i]][save_a[i]] = save_c[i];
}
for (i = 0; i <= max; i++) {
dijkstra(i);
if (sum < min_sum) {
ans_town = i;
min_sum = sum;
}
}
cout << ans_town << " " << min_sum << endl;
} | a.cc:7:32: error: 'int time [10][10]' redeclared as different kind of entity
7 | int road, max = 0, time[10][10],sum,root[10];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void dijkstra(int)':
a.cc:12:26: error: reference to 'max' is ambiguous
12 | for (i = 0; i <= max; i++) {
| ^~~
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:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:19:34: error: reference to 'max' is ambiguous
19 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:33:34: error: reference to 'max' is ambiguous
33 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:34:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~
a.cc:34:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:35:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
a.cc:35:51: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:41:26: error: reference to 'max' is ambiguous
41 | for (i = 0; i <= max; i++)sum += root[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc: In function 'int main()':
a.cc:57:21: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:57:30: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:58:21: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:58:30: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:63:26: error: reference to 'max' is ambiguous
63 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10],sum,root[10];
| ^~~
a.cc:64:34: error: reference to 'max' is ambiguous
64 | for (j = 0; j <= max; j++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: ' |
s111827647 | p00189 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
#define INF 100000
int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
void dijkstra(int a) {
int i,j,k=INF,used[10],minroot;
for (i = 0; i <= max; i++) {
used[i] = 0;
root[i] = INF;
}
root[a] = 0;
while (1) {
minroot = INF;
for (i = 0; i <= max; i++) {
if (used[i] == 0&&root[i]<minroot) {
j = i;
minroot = root[i];
}
}
if (k == j) {
break;
}
else {
k = j;
}
used[j] = 1;
for (i = 0; i <= max; i++) {
if (root[i] > root[j] + time[j][i]) {
root[i] = root[j] + time[j][i];
}
}
}
sum = 0;
for (i = 0; i <= max; i++)sum += root[i];
return ;
}
int main() {
cin >> road;
int i, j, a, b, c, save_a[45] = { 0 }, save_b[45] = { 0 }, save_c[45] = { 0 }, min_sum = INF, ans_town;
for (i = 1; i <= road; i++) {
cin >> a >> b >> c;
if (max < a) max = a;
if (max < b) max = b;
save_a[i] = a;
save_b[i] = b;
save_c[i] = c;
}
for (i = 0; i <= max; i++) {
for (j = 0; j <= max; j++) {
time[i][j] = INF;
}
time[i][i] = 0;
}
for (i = 1; i <= road; i++) {
time[save_a[i]][save_b[i]] = save_c[i];
time[save_b[i]][save_a[i]] = save_c[i];
}
for (i = 0; i <= max; i++) {
dijkstra(i);
if (sum < min_sum) {
ans_town = i;
min_sum = sum;
}
}
cout << ans_town << " " << min_sum << endl;
} | a.cc:7:32: error: 'int time [10][10]' redeclared as different kind of entity
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void dijkstra(int)':
a.cc:12:26: error: reference to 'max' is ambiguous
12 | for (i = 0; i <= max; i++) {
| ^~~
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:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:19:34: error: reference to 'max' is ambiguous
19 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:33:34: error: reference to 'max' is ambiguous
33 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:34:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~
a.cc:34:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:35:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
a.cc:35:51: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:41:26: error: reference to 'max' is ambiguous
41 | for (i = 0; i <= max; i++)sum += root[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc: In function 'int main()':
a.cc:57:21: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:57:30: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:21: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:30: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:63:26: error: reference to 'max' is ambiguous
63 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:64:34: error: reference to 'max' is ambiguous
64 | for (j = 0; j <= max; j++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: |
s727341493 | p00189 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
#define INF 100000
int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
void dijkstra(int a) {
int i,j,k=INF,used[10],minroot;
for (i = 0; i <= max; i++) {
used[i] = 0;
root[i] = INF;
}
root[a] = 0;
while (1) {
minroot = INF;
for (i = 0; i <= max; i++) {
if (used[i] == 0&&root[i]<minroot) {
j = i;
minroot = root[i];
}
}
if (k == j) {
break;
}
else {
k = j;
}
used[j] = 1;
for (i = 0; i <= max; i++) {
if (root[i] > root[j] + time[j][i]) {
root[i] = root[j] + time[j][i];
}
}
}
sum = 0;
for (i = 0; i <= max; i++)sum += root[i];
return ;
}
int main() {
cin >> road;
int i, j, a, b, c, save_a[45] = { 0 }, save_b[45] = { 0 }, save_c[45] = { 0 }, min_sum = INF, ans_town;
for (i = 1; i <= road; i++) {
cin >> a >> b >> c;
if (max < a) max = a;
if (max < b) max = b;
save_a[i] = a;
save_b[i] = b;
save_c[i] = c;
}
for (i = 0; i <= max; i++) {
for (j = 0; j <= max; j++) {
time[i][j] = INF;
}
time[i][i] = 0;
}
for (i = 1; i <= road; i++) {
time[save_a[i]][save_b[i]] = save_c[i];
time[save_b[i]][save_a[i]] = save_c[i];
}
for (i = 0; i <= max; i++) {
dijkstra(i);
if (sum < min_sum) {
ans_town = i;
min_sum = sum;
}
}
cout << ans_town << " " << min_sum << endl;
} | a.cc:7:32: error: 'int time [10][10]' redeclared as different kind of entity
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'void dijkstra(int)':
a.cc:12:26: error: reference to 'max' is ambiguous
12 | for (i = 0; i <= max; i++) {
| ^~~
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:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:19:34: error: reference to 'max' is ambiguous
19 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:33:34: error: reference to 'max' is ambiguous
33 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:34:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ^
a.cc:34:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~
a.cc:34:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
34 | if (root[i] > root[j] + time[j][i]) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:35:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ^
a.cc:35:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
a.cc:35:51: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
35 | root[i] = root[j] + time[j][i];
| ~~~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:41:26: error: reference to 'max' is ambiguous
41 | for (i = 0; i <= max; i++)sum += root[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc: In function 'int main()':
a.cc:57:21: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:57:30: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:21: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:30: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:63:26: error: reference to 'max' is ambiguous
63 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:64:34: error: reference to 'max' is ambiguous
64 | for (j = 0; j <= max; j++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: |
s235452977 | p00189 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
#define INF 100000
int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
void dijkstra(int a) {
int i,j,k=INF,used[10],minroot;
for (i = 0; i <= max; i++) {
used[i] = 0;
root[i] = INF;
}
root[a] = 0;
while (1) {
minroot = INF;
for (i = 0; i <= max; i++) {
if (used[i] == 0&&root[i]<minroot) {
j = i;
minroot = root[i];
}
}
if (k == j) {
break;
}
else {
k = j;
}
used[j] = 1;
for (i = 0; i <= max; i++) {
if (root[i] > root[j] + time_[j][i]) {
root[i] = root[j] + time_[j][i];
}
}
}
sum = 0;
for (i = 0; i <= max; i++)sum += root[i];
return ;
}
int main() {
cin >> road;
int i, j, a, b, c, save_a[45] = { 0 }, save_b[45] = { 0 }, save_c[45] = { 0 }, min_sum = INF, ans_town;
for (i = 1; i <= road; i++) {
cin >> a >> b >> c;
if (max < a) max = a;
if (max < b) max = b;
save_a[i] = a;
save_b[i] = b;
save_c[i] = c;
}
for (i = 0; i <= max; i++) {
for (j = 0; j <= max; j++) {
time_[i][j] = INF;
}
time_[i][i] = 0;
}
for (i = 1; i <= road; i++) {
time_[save_a[i]][save_b[i]] = save_c[i];
time_[save_b[i]][save_a[i]] = save_c[i];
}
for (i = 0; i <= max; i++) {
dijkstra(i);
if (sum < min_sum) {
ans_town = i;
min_sum = sum;
}
}
cout << ans_town << " " << min_sum << endl;
} | a.cc: In function 'void dijkstra(int)':
a.cc:12:26: error: reference to 'max' is ambiguous
12 | for (i = 0; i <= max; i++) {
| ^~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:19:34: error: reference to 'max' is ambiguous
19 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:33:34: error: reference to 'max' is ambiguous
33 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:41:26: error: reference to 'max' is ambiguous
41 | for (i = 0; i <= max; i++)sum += root[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc: In function 'int main()':
a.cc:57:21: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:57:30: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:21: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:30: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:63:26: error: reference to 'max' is ambiguous
63 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:64:34: error: reference to 'max' is ambiguous
64 | for (j = 0; j <= max; j++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:73:26: error: reference to 'max' is ambiguous
73 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
|
s554431882 | p00189 | C++ | #include<cstdio>
#include<iostream>
using namespace std;
#define INF 100000
int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
void dijkstra(int a) {
int i,j,k=INF,used[10],minroot;
for (i = 0; i <= max; i++) {
used[i] = 0;
root[i] = INF;
}
root[a] = 0;
while (1) {
minroot = INF;
for (i = 0; i <= max; i++) {
if (used[i] == 0&&root[i]<minroot) {
j = i;
minroot = root[i];
}
}
if (k == j) {
break;
}
else {
k = j;
}
used[j] = 1;
for (i = 0; i <= max; i++) {
if (root[i] > root[j] + time_[j][i]) {
root[i] = root[j] + time_[j][i];
}
}
}
sum = 0;
for (i = 0; i <= max; i++)sum += root[i];
return ;
}
int main() {
cin >> road;
int i, j, a, b, c, save_a[45] = { 0 }, save_b[45] = { 0 }, save_c[45] = { 0 }, min_sum = INF, ans_town;
for (i = 1; i <= road; i++) {
cin >> a >> b >> c;
if (max < a) max = a;
if (max < b) max = b;
save_a[i] = a;
save_b[i] = b;
save_c[i] = c;
}
for (i = 0; i <= max; i++) {
for (j = 0; j <= max; j++) {
time_[i][j] = INF;
}
time_[i][i] = 0;
}
for (i = 1; i <= road; i++) {
time_[save_a[i]][save_b[i]] = save_c[i];
time_[save_b[i]][save_a[i]] = save_c[i];
}
for (i = 0; i <= max; i++) {
dijkstra(i);
if (sum < min_sum) {
ans_town = i;
min_sum = sum;
}
}
cout << ans_town << " " << min_sum << endl;
} | a.cc: In function 'void dijkstra(int)':
a.cc:12:26: error: reference to 'max' is ambiguous
12 | for (i = 0; i <= max; i++) {
| ^~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:19:34: error: reference to 'max' is ambiguous
19 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:33:34: error: reference to 'max' is ambiguous
33 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:41:26: error: reference to 'max' is ambiguous
41 | for (i = 0; i <= max; i++)sum += root[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc: In function 'int main()':
a.cc:57:21: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:57:30: error: reference to 'max' is ambiguous
57 | if (max < a) max = a;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:21: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:58:30: error: reference to 'max' is ambiguous
58 | if (max < b) max = b;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:63:26: error: reference to 'max' is ambiguous
63 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:64:34: error: reference to 'max' is ambiguous
64 | for (j = 0; j <= max; j++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
a.cc:73:26: error: reference to 'max' is ambiguous
73 | for (i = 0; i <= max; i++) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:7:12: note: 'int max'
7 | int road, max = 0, time_[10][10] = { 0 }, sum, root[10] = { 0 };
| ^~~
|
s556464646 | p00189 | C++ | #include<stdio.h>
#include<string.h>
#define INF 0x3f3f3f
int max(int a,int b)
{
return a>b?a:b;
}
int map[110]110],visit[110],vis[110];
int n,m;
int dijkstra(int a)
{
memset(visit,0,sizeof(visit));
int i,j,next,sum,min;
for(i=0;i<m;i++)
vis[i]=map[a][i];
visit[a]=1;
for(i=0;i<m;i++)
{
min=INF;
for(j=0;j<m;j++)
{
if(!visit[j]&&min>vis[j])
{
next=j;
min=vis[j];
}
}
visit[next]=1;
for(j=0;j<m;j++)
if(!visit[j]&&vis[j]>vis[next]+map[next][j])
vis[j]=vis[next]+map[next][j];
}
sum=0;
for(i=0;i<m;i++)
sum+=vis[i];
return sum;
}
int main()
{
int i,j,sum;
int a,b,c;
while(scanf("%d",&n),n)
{
for(i=0;i<110;i++)
for(j=i;j<110;j++)
{
if(i==j)
map[i][j]=map[j][i]=0;
else
map[i][j]=map[j][i]=INF;
}
m=0;
while(n--)
{
scanf("%d%d%d",&a,&b,&c);
map[a][b]=map[b][a]=c;
m=max(m,max(a,b)+1);
}
sum=INF;
for(i=0;i<m;i++)
{
if(sum>dijkstra(i))
{
j=i;
sum=dijkstra(i);
}
}
printf("%d %d\n",j,sum);
}
return 0;
} | a.cc:8:13: error: expected initializer before numeric constant
8 | int map[110]110],visit[110],vis[110];
| ^~~
a.cc: In function 'int dijkstra(int)':
a.cc:12:16: error: 'visit' was not declared in this scope
12 | memset(visit,0,sizeof(visit));
| ^~~~~
a.cc:15:9: error: 'vis' was not declared in this scope
15 | vis[i]=map[a][i];
| ^~~
a.cc:15:16: error: 'map' was not declared in this scope; did you mean 'max'?
15 | vis[i]=map[a][i];
| ^~~
| max
a.cc:22:43: error: 'vis' was not declared in this scope
22 | if(!visit[j]&&min>vis[j])
| ^~~
a.cc:30:39: error: 'vis' was not declared in this scope
30 | if(!visit[j]&&vis[j]>vis[next]+map[next][j])
| ^~~
a.cc:30:56: error: 'map' was not declared in this scope; did you mean 'max'?
30 | if(!visit[j]&&vis[j]>vis[next]+map[next][j])
| ^~~
| max
a.cc:35:14: error: 'vis' was not declared in this scope
35 | sum+=vis[i];
| ^~~
a.cc: In function 'int main()':
a.cc:48:25: error: 'map' was not declared in this scope; did you mean 'max'?
48 | map[i][j]=map[j][i]=0;
| ^~~
| max
a.cc:50:25: error: 'map' was not declared in this scope; did you mean 'max'?
50 | map[i][j]=map[j][i]=INF;
| ^~~
| max
a.cc:56:25: error: 'map' was not declared in this scope; did you mean 'max'?
56 | map[a][b]=map[b][a]=c;
| ^~~
| max
|
s142027346 | p00189 | C++ | #include <iostream>
using namespace std;
const int INF = 2 << 35;
int main()
{
int data[11][11];
int n;
int a,s,d;
int ans,anssum;
int sum=0;
while (true)
{
for(int i=0;i<10;i++)
{
for(int k = 0;k<10;k++)
{
data[i][k] = INF;
}
}
cin >> n ;
if(n == 0)return 0;
for(int i = 0; i< n;++i)
{
cin >> a >> s >> d;
data[a][s] = d;
data[s][a] = d;
}
for(int i=0;i<10;i++)
{
for(int k = 0;k<10;k++)
{
for(int m = 0;m<10;m++)
{
if(data[i][k] > data[i][m] + data[m][k])
{
data[i][k] = data[i][m] + data[m][k];
data[k][i] = data[i][m] + data[m][k];
}
}
}
}
anssum = INF;
for(int i=0;i<10;++i)
{
sum = 0;
for (int k=0;k < 10;++k)
{
sum += data[i][k];
}
if(sum < anssum)
{
ans = i;
anssum = sum;
}
}
cout << ans <<" "<< ansnum << "\n";
}
} | a.cc:4:19: warning: left shift count >= width of type [-Wshift-count-overflow]
4 | const int INF = 2 << 35;
| ~~^~~~~
a.cc: In function 'int main()':
a.cc:65:21: error: 'ansnum' was not declared in this scope; did you mean 'anssum'?
65 | cout << ans <<" "<< ansnum << "\n";
| ^~~~~~
| anssum
|
s231434010 | p00189 | C++ | #include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
const int MAX_V = 100, INF = 999999;
static int cost[MAX_V][MAX_V];
static int d[MAX_V];
bool used[MAX_V];
static int V;
int E;
void dijkstra(int s) {
fill(d, d + V, INF);
fill(used, used + V, false);
d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
}
if (v == -1) break;
used[v] = true;
for (int u = 0; u < V; u++) {
d[u] = min(d[u], d[v] + cost[v][u]);
}
}
}
int main() {
while (1) {
memset(cost, 999999, sizeof(cost));
cin >> E;
if (E == 0) break;
int v_max = -1;
for (int i=0 ; i < E; i++) {
int u, v, cos;
cin >> u >> v >> cos;
cost[u][v] = cos;
cost[v][u] = cos;
if (v > v_max)v_max = v;
}
V = v_max + 1;
int sum_m = 999999, m_ind = -1;
for (int i = 0; i < V; i++) {
dijkstra(i);
int sum = 0;
for (int j = 0; j < V; j++) {
sum += d[j];
}
if (sum < sum_m) {
sum_m = sum;
m_ind = i;
}
}
cout << m_ind << " " << sum_m << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:17: error: 'memset' was not declared in this scope
34 | memset(cost, 999999, sizeof(cost));
| ^~~~~~
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 | using namespace std;
|
s553546630 | p00189 | C++ | #include<algorithm>
#include<stdio.h>
#include<vector>
#include<queue>
using namespace std;
int C = 0;
int N = 0;
int R[10][10] = { 0 };
int M[10] = { 0 };
bool solve() {
int sum = INT_MAX,ans = 0;
for (int i = 0; i <= C; i++) {
queue<int> q;
q.push(i);
M[i] = 0;
while (!q.empty()) {
for (int j = 0; j <= C; j++) {
if (R[q.front()][j] != -1 && (M[j] == -1 || M[q.front()] + R[q.front()][j] < M[j])) {
M[j] = R[q.front()][j] + M[q.front()];
q.push(j);
}
}
q.pop();
}
int s = 0;
for (int j = 0; j <= C; j++)
s += M[j];
if (sum > s) {
sum = s;
ans = i;
}
memset(M, -1, sizeof(int) * 10);
}
printf("%d %d\n", ans,sum);
}
int main(void) {
int n = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
C = 0;
memset(R, -1, sizeof(int) * 100);
memset(M, -1, sizeof(int) * 10);
scanf("%d", &N);
for (int j = 0; j < N; j++) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
R[a][b] = c;
R[b][a] = c;
C = max(C, max(a, b));
}
solve();
}
} | a.cc: In function 'bool solve()':
a.cc:14:19: error: 'INT_MAX' was not declared in this scope
14 | int sum = INT_MAX,ans = 0;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include<queue>
+++ |+#include <climits>
5 |
a.cc:34:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
34 | ans = i;
| ^~~
| abs
a.cc:36:17: error: 'memset' was not declared in this scope
36 | memset(M, -1, sizeof(int) * 10);
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<queue>
+++ |+#include <cstring>
5 |
a.cc:38:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | printf("%d %d\n", ans,sum);
| ^~~
| abs
a.cc:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
39 | }
| ^
a.cc: In function 'int main()':
a.cc:46:17: error: 'memset' was not declared in this scope
46 | memset(R, -1, sizeof(int) * 100);
| ^~~~~~
a.cc:46:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s660266632 | p00189 | C++ | #include <iostream>
#define MAX 10
#define INF INT_MAX
using namespace std;
int d[MAX][MAX];
int n, num_ver = 0;
int min_t = INF;
int min_ver;
void init();
void input();
void wf();
int main(){
while(cin >> n, n){
init();
input();
wf();
for(int i = 0; i <= num_ver; i++){
int tmp = 0;
for(int j = 0; j <= num_ver; j++){
tmp += d[i][j];
}
if(min_t > tmp) {min_t = tmp; min_ver = i;}
}
cout << min_ver << " " << min_t << endl;
}
}
void init(){
for(int i = 0; i < MAX; i++){
for(int j = 0; j < MAX; j++){
d[i][j] = (i==j)? 0: INF;
}
}
}
void input(){
for(int i = 0; i < n; i++){
int a, b, c;
cin >> a >> b >> c;
d[a][b] = c;
d[b][a] = c;
if(num_ver < b) num_ver = b;
}
}
void wf(){
for(int i = 0; i <= num_ver; i++){
for(int j = 0; j <= num_ver; j++){
for(int k = 0; k <= num_ver; k++){
d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}
}
}
} | a.cc:4:13: error: 'INT_MAX' was not declared in this scope
4 | #define INF INT_MAX
| ^~~~~~~
a.cc:9:13: note: in expansion of macro 'INF'
9 | int min_t = INF;
| ^~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 |
a.cc: In function 'void init()':
a.cc:4:13: error: 'INT_MAX' was not declared in this scope
4 | #define INF INT_MAX
| ^~~~~~~
a.cc:38:28: note: in expansion of macro 'INF'
38 | d[i][j] = (i==j)? 0: INF;
| ^~~
a.cc:4:13: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #define INF INT_MAX
| ^~~~~~~
a.cc:38:28: note: in expansion of macro 'INF'
38 | d[i][j] = (i==j)? 0: INF;
| ^~~
|
s866478908 | p00189 | C++ | #include <bits/stdc++.h>
using namespace std;
int d[11][11];
static const int INF = 99999999;
void solve() {
int n;
while (cin >> n && n) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
d[i][j] = INF;
}
d[i][i] = 0;
}
for (int i = 0; i < n; i++) {
int from, to, dist;
cin >> from >> to >> dist;
d[from][to] = dist;
d[to][from] = dist;
}
for (int k = 0; k < 10; k++) {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}
}
}
int min_sum_dist = INF;
int pos = 0;
for (int i = 0; i < 10; i++) {
int sum = 0;
for (int j = 0; j < 10; j++) {
if (d[i][j] != INF) sum += d[i][j];
}
if (sum == 0) continue;
if (min_sum_dist > sum) {
min_sum_dist = sum;
pos = i;
}
}
cout << pos << ' ' << min_sum_dist << endl;
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve()
return 0;
} | a.cc: In function 'int main()':
a.cc:50:10: error: expected ';' before 'return'
50 | solve()
| ^
| ;
51 | return 0;
| ~~~~~~
|
s493691410 | p00189 | C++ | //C++14 (Clang 3.8.0)
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef pair<int,int> p;
int inf=INT_MAX;
int main(){
while(1){
int n;
scanf("%d",&n);
if(n==0) break;
int d[50][50];
for(int i=0;i<50;i++){
for(int j=0;j<50;j++)d[i][j]=inf;
}
for(int i=0;i<50;i++)d[i][i]=0;
for(int i=0;i<n;i++){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
d[a][b]=c;
d[b][a]=c;
}
for(int k=0;k<50;k++){
for(int i=0;i<50;i++){
for(int j=0;j<50;j++){
if(d[i][k]!=inf and d[k][j]!=inf) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
}
}
}
int ans=inf;
for(int i=0;i<50;i++){
int tmp=0;
int flag=0;
for(int j=0;j<50;j++){
if(d[i][j]!=inf and i!=j){tmp+=d[i][j];flag=1;}
}
if(flag==1)ans=min(ans,tmp);
}
if(ans==inf)print("0\n");
else printf("%d\n",ans);
}
}; | a.cc: In function 'int main()':
a.cc:61:21: error: 'print' was not declared in this scope; did you mean 'rint'?
61 | if(ans==inf)print("0\n");
| ^~~~~
| rint
|
s118473958 | p00189 | C++ | //
// main.cpp
//
#include <iostream>
//#include <algorithm>
#include <vector>
//#include <limits>
#include <math.h>
//#include <queue>
//#include <tuple>
//#include <stdio.h>
//#include <stdlib.h>
//#include <string>
//#include "string.h"
// #include <unordered_map>
#include <map>
#include <unordered_set>
//#include <array>
#include <set>
#include <limits>
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2224
using namespace std;
using ll = long long;
#include <vector>
struct UnionFind {
vector<size_t> parent;
vector<size_t> rank;
size_t findParent(size_t x) {
if (parent[x] == x) {
return x;
} else {
parent[x] = findParent(parent[x]);
return parent[x];
}
}
explicit UnionFind(size_t size) {
parent.resize(size);
rank.resize(size);
for (size_t i = 0; i < size; i++) {
parent[i] = i;
rank[i] = 0;
}
}
virtual ~UnionFind() {}
void unite(size_t x, size_t y) {
size_t px = findParent(x);
size_t py = findParent(y);
if (px == py) {
return;
}
if (rank[px] < rank[py]) {
parent[px] = py;
} else if (rank[px] > rank[py]) {
parent[py] = px;
} else { // rank[px] == rank[py]
parent[py] = px;
rank[px]++;
}
}
bool isSame(size_t x, size_t y) {
return findParent(x) == findParent(y);
}
};
int main() {
int N, M;
cin >> N >> M;
struct Pl {
int x;
int y;
Pl(int x, int y) : x(x), y(y) {}
double dist(const Pl& rhs) const {
return sqrt(pow((double)(x - rhs.x), 2.0) + pow((double)(y - rhs.y), 2.0));
}
};
vector<Pl> piles;
piles.reserve(N);
for (int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
piles.emplace_back(x, y);
}
struct Fc {
int a;
int b;
double len;
Fc(int a, int b, double len) : a(a), b(b), len(len) {}
static bool compareLen(const Fc& lhs, const Fc& rhs) {
return lhs.len > rhs.len;
}
};
vector<Fc> fences;
fences.reserve(M);
double totalLen = 0.0;
for (int i = 0; i < M; i++) {
int a, b;
cin >> a >> b;
a--;
b--;
double len = piles[a].dist(piles[b]);
fences.emplace_back(a, b, len);
totalLen += len;
}
sort(fences.begin(), fences.end(), Fc::compareLen);
UnionFind uf(N);
double lenSum = 0.0;
for (Fc fc : fences) {
if (!uf.isSame(fc.a, fc.b)) {
uf.unite(fc.a, fc.b);
lenSum += fc.len;
}
}
cout << totalLen - lenSum << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:110:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
110 | sort(fences.begin(), fences.end(), Fc::compareLen);
| ^~~~
| sqrt
|
s082666013 | p00189 | C++ | #include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
while(true){
int n;
cin >> n;
if(n==0)
break;
int T[10][10];
for(int i=0; i<10; i++){
for(int j=0; j<10; j++){
if(i==j){
T[i][j] = 0;
}
else{
T[i][j] = INF;
}
}
}
int m = 0;
for(int i=0; i<n; i++){
int a, b, c;
cin >> a >> b >> c;
T[a][b] = T[b][a] = c;
if(a+1>m){
m = a+1;
}
if(b+1>m){
m = b+1;
}
}
for(int i =0;i<m;i++){
for(int j =0;j<m;j++){
for(int k = 0;k<m;k++){
if(T[j][k]>T[j][i]+T[i][k]){
T[j][k]=T[j][i]+T[i][k];
}
}
}
}
int anstown,anstime=INF;
for(int i =0;i<m;i++){
int sumtime=0;
for(int j = 0;j<m;j++){
sumtime+=Time[i][j];
}
if(anstime>sumtime){
anstown = i;
anstime = sumtime;
}
}
cout << anstonw <<" "<<anstime<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:18: error: 'Time' was not declared in this scope; did you mean 'time'?
55 | sumtime+=Time[i][j];
| ^~~~
| time
a.cc:62:13: error: 'anstonw' was not declared in this scope; did you mean 'anstown'?
62 | cout << anstonw <<" "<<anstime<<endl;
| ^~~~~~~
| anstown
|
s247322969 | p00189 | C++ | #include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
while(true){
int n;
cin >> n;
if(n==0)
break;
int T[10][10];
for(int i=0; i<10; i++){
for(int j=0; j<10; j++){
if(i==j){
T[i][j] = 0;
}
else{
T[i][j] = INF;
}
}
}
int m = 0;
for(int i=0; i<n; i++){
int a, b, c;
cin >> a >> b >> c;
T[a][b] = T[b][a] = c;
if(a+1>m){
m = a+1;
}
if(b+1>m){
m = b+1;
}
}
for(int i =0;i<m;i++){
for(int j =0;j<m;j++){
for(int k = 0;k<m;k++){
if(T[j][k]>T[j][i]+T[i][k]){
T[j][k]=T[j][i]+T[i][k];
}
}
}
}
int anstown,anstime=INF;
for(int i =0;i<m;i++){
int sumtime=0;
for(int j = 0;j<m;j++){
sumtime+=Time[i][j];
}
if(anstime>sumtime){
anstown = i;
anstime = sumtime;
}
}
cout << anstonw <<" "<<anstime<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:18: error: 'Time' was not declared in this scope; did you mean 'time'?
55 | sumtime+=Time[i][j];
| ^~~~
| time
a.cc:62:13: error: 'anstonw' was not declared in this scope; did you mean 'anstown'?
62 | cout << anstonw <<" "<<anstime<<endl;
| ^~~~~~~
| anstown
|
s541066881 | p00189 | C++ | // 2014/06/16 Tazoe
#include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
while(true){
int n;
cin >> n;
if(n==0)
break;
int T[10][10];
for(int i=0; i<10; i++){
for(int j=0; j<10; j++){
if(i==j){
T[i][j] = 0;
}
else{
T[i][j] = INF;
}
}
}
int m = 0; // ���̑���
for(int i=0; i<n; i++){
int a, b, c;
cin >> a >> b >> c;
T[a][b] = T[b][a] = c;
if(a+1>m){
m = a+1;
}
if(b+1>m){
m = b+1;
}
}
for(int k=0;k<m;k++){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
if(T[i][j] > T[i][k]+T[k][j])
T[i][j] = T[i][k] + T[k][j];
}
}
}
int min_town_n;
int min_town_time;
for(int k=0;k<m;k++){
int sub;
for(int i=0;i<m;i++){
sub += T[k][i];
}
if(min_town_time > sub){
min_town_time = sub;
min_town_time_n;
}
}
cout << min_town_n << ' ' << min_town_time << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:62:9: error: 'min_town_time_n' was not declared in this scope; did you mean 'min_town_time'?
62 | min_town_time_n;
| ^~~~~~~~~~~~~~~
| min_town_time
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.