submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s619457609 | p00200 | C | // ConsoleApplication3.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//
#include "stdafx.h"
#include <stdio.h>
#define Limit 10000000
int MinCost(int, int);
int MinTime(int, int);
typedef struct {
int time;
int cost;
} LINE;
int n, m, times[101], costs[101];
LINE lines[101][101] = { {0}, {0} };
int main()
{
int a, b, cost, time, i, k, x, y, r;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%d %d %d %d", &a, &b, &cost, &time);
lines[a][b].cost = cost;
lines[b][a].cost = cost;
lines[a][b].time = time;
lines[b][a].time = time;
}
scanf("%d", &k);
for (i = 0; i < k; i++) {
scanf("%d %d %d", &x, &y, &r);
if (r == 0) {
printf("%d\n", MinCost(x, y));
} else if (r == 1){
printf("%d\n", MinTime(x, y));
}
}
scanf("%d %d", &x, &y);
return 0;
}
int MinCost(int x, int y) {
int i, j, k;
for (i = 1; i <= m; i++) {
costs[i] = Limit;
}
costs[x] = 0;
for (i = 0; i < n; i++) {
for (j = 1; j <= m; j++) {
for (k = 1; k <= m; k++) {
if ((lines[j][k].cost != 0) && (costs[k] + lines[j][k].cost < costs[j])) {
costs[j] = costs[k] + lines[j][k].cost;
}
}
}
}
return costs[y];
}
int MinTime(int x, int y) {
int i, j, k;
for (i = 1; i <= m; i++) {
times[i] = Limit;
}
times[x] = 0;
for (i = 0; i < n; i++) {
for (j = 1; j <= m; j++) {
for (k = 1; k <= m; k++) {
if ((lines[j][k].time != 0)&&(times[k] + lines[j][k].time < times[j])) {
times[j] = times[k] + lines[j][k].time;
}
}
}
}
return times[y];
} | main.c:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s234969219 | p00200 | C | // ConsoleApplication3.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//
#include "stdafx.h"
#include <stdio.h>
#define Limit 10000000
int MinCost(int, int);
int MinTime(int, int);
typedef struct {
int time;
int cost;
} LINE;
int n, m, times[101], costs[101];
LINE lines[101][101] = { {0}, {0} };
int main()
{
int a, b, cost, time, i, k, x, y, r;
scanf("%d %d", &n, &m);
while (1) {
for (i = 0; i < n; i++) {
scanf("%d %d %d %d", &a, &b, &cost, &time);
lines[a][b].cost = cost;
lines[b][a].cost = cost;
lines[a][b].time = time;
lines[b][a].time = time;
}
scanf("%d", &k);
for (i = 0; i < k; i++) {
scanf("%d %d %d", &x, &y, &r);
if (r == 0) {
printf("%d\n", MinCost(x, y));
}
else if (r == 1) {
printf("%d\n", MinTime(x, y));
}
}
scanf("%d %d", &n, &m);
if (n == 0 && m == 0) {
for (i = 0; i < k; i++) {
return 0;
}
}
}
}
int MinCost(int x, int y) {
int i, j, k;
for (i = 1; i <= m; i++) {
costs[i] = Limit;
}
costs[x] = 0;
for (i = 0; i < n; i++) {
for (j = 1; j <= m; j++) {
for (k = 1; k <= m; k++) {
if ((lines[j][k].cost != 0) && (costs[k] + lines[j][k].cost < costs[j])) {
costs[j] = costs[k] + lines[j][k].cost;
}
}
}
}
return costs[y];
}
int MinTime(int x, int y) {
int i, j, k;
for (i = 1; i <= m; i++) {
times[i] = Limit;
}
times[x] = 0;
for (i = 0; i < n; i++) {
for (j = 1; j <= m; j++) {
for (k = 1; k <= m; k++) {
if ((lines[j][k].time != 0)&&(times[k] + lines[j][k].time < times[j])) {
times[j] = times[k] + lines[j][k].time;
}
}
}
}
return times[y];
} | main.c:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s900610443 | p00200 | C | #include <stdio.h>
int line[100][100][2] = {0};
int m;//number of station
int minvalue(int p, int q, int r);
int main(void)
{
int i;
int n;//number of line
int a;
int b;
int cost;
int time;
int k;//number of request
int p;//station1
int q;//station2
int r;//cost or time
while(1)
{
for(i=0;i<100;i++)
{
for(j=0;j<100;j++)
{
line[i][j][0]=0;
line[i][j][1]=0;
}
}
scanf("%d %d\n", &n, &m);
if(n==0 && m==0)
{
return 0;
}
for(i=0;i<n;i++)
{
//include line
scanf("%d %d %d %d\n", &a, &b, &cost, &time);
line[a-1][b-1][0] = cost;
line[b-1][a-1][0] = cost;
line[a-1][b-1][1] = time;
line[b-1][a-1][1] = time;
}
scanf("%d\n",&k);
for(i=0;i<k;i++)
{
scanf ("%d %d %d\n", &p, &q, &r);
printf("%d\n",minvalue(p-1, q-1, r));
}
}
return 0;
}
int minvalue(int p, int q, int r)
{
int min_value[100] = {0};
int flag_station[100] = {0};
int temp_min=100000;
int min_station=0;
int min=100000;
int i;
int j;
flag_station[p] = 1;
while(1)
{
temp_min=100000;
min_station=0;
min=100000;
for(i = 0; i< m;i++)
{
if(flag_station[i] == 0)
{
for(j=0;j<m;j++)
{
if(flag_station[j] == 1)
{
if(line[i][j][r] != 0)
{
if(temp_min > min_value[j] + line[i][j][r])
{
temp_min = min_value[j] + line[i][j][r];
}
}
}
}
if(min > temp_min)
{
min = temp_min;
min_station = i;
}
}
}
if(min_station == q) return min;
min_value[min_station] = min;
flag_station[min_station] = 1;
}
return 0;
} | main.c: In function 'main':
main.c:26:29: error: 'j' undeclared (first use in this function)
26 | for(j=0;j<100;j++)
| ^
main.c:26:29: note: each undeclared identifier is reported only once for each function it appears in
|
s122678108 | p00200 | C | // v ????????±??????????????§cost?????´??°??§??????????????????
for ( u = 1 ; u < m + 1 ; u++ ) {
cost[ u ] = min( cost[ u ], cost[ v ] + route[ v ][ u ] );
}
}
}
int main( void )
{
int i, j, k;
int result;
while ( scanf( "%d %d", &n, &m ), n != 0 ) {
for ( i = 0 ; i < MAX_STATION ; i++ ) {
for (j = 0 ; j < MAX_STATION ; j++ ) {
croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
troute[ i ][ j ] = ( i == j ) ? 0 : MAX;
}
}
while (n > 0) {
int a, b, c, t;
scanf( "%d %d %d %d", &a, &b, &c, &t );
croute[ a ][ b ] = croute[ b ][ a ] = c;
troute[ a ][ b ] = troute[ b ][ a ] = t;
n--;
}
scanf( "%d", &k );
while ( k > 0 ) {
int p, q, r;
scanf( "%d %d %d", &p, &q, &r );
dijkstra( p, ( r == 0 ) ? croute : troute );
result = cost[ q ];
printf( "%d\n", result );
k--;
}
}
return 0;
} | main.c:2:17: error: expected identifier or '(' before 'for'
2 | for ( u = 1 ; u < m + 1 ; u++ ) {
| ^~~
main.c:2:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
2 | for ( u = 1 ; u < m + 1 ; u++ ) {
| ^
main.c:2:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
2 | for ( u = 1 ; u < m + 1 ; u++ ) {
| ^~
main.c:5:9: error: expected identifier or '(' before '}' token
5 | }
| ^
main.c:6:1: error: expected identifier or '(' before '}' token
6 | }
| ^
main.c: In function 'main':
main.c:13:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
13 | while ( scanf( "%d %d", &n, &m ), n != 0 ) {
| ^~~~~
main.c:1:8: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | // v ????????±??????????????§cost?????´??°??§??????????????????
main.c:13:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
13 | while ( scanf( "%d %d", &n, &m ), n != 0 ) {
| ^~~~~
main.c:13:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:34: error: 'n' undeclared (first use in this function)
13 | while ( scanf( "%d %d", &n, &m ), n != 0 ) {
| ^
main.c:13:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:38: error: 'm' undeclared (first use in this function)
13 | while ( scanf( "%d %d", &n, &m ), n != 0 ) {
| ^
main.c:14:35: error: 'MAX_STATION' undeclared (first use in this function)
14 | for ( i = 0 ; i < MAX_STATION ; i++ ) {
| ^~~~~~~~~~~
main.c:16:33: error: 'croute' undeclared (first use in this function)
16 | croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
| ^~~~~~
main.c:16:69: error: 'MAX' undeclared (first use in this function)
16 | croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
| ^~~
main.c:17:33: error: 'troute' undeclared (first use in this function)
17 | troute[ i ][ j ] = ( i == j ) ? 0 : MAX;
| ^~~~~~
main.c:32:25: error: implicit declaration of function 'dijkstra' [-Wimplicit-function-declaration]
32 | dijkstra( p, ( r == 0 ) ? croute : troute );
| ^~~~~~~~
main.c:33:34: error: 'cost' undeclared (first use in this function)
33 | result = cost[ q ];
| ^~~~
main.c:34:25: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
34 | printf( "%d\n", result );
| ^~~~~~
main.c:34:25: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:34:25: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:34:25: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s368923299 | p00200 | C | /*
?????????????????? ????????\?????????????¬???¨???
??? ???
???????????´??????????´\????????????????????????????????§????????????????¨??????????????????????????????????
????????????????????§??????????????????????????????????????????????????§????????????????????????????????????
??????????????\??????????????????????????¨?????\???????????????????????????????????????????????????????????°
??????????¨????????????????????????????????????????????´?????????????????????§??????????????????????????????
?¨??????????????????????????????°??????????????£????????????????????????
??????????????±????§??????°?????\?????¨?????????????????????????????????????????????????????????????°???????
???????????????????????°????????????????????????????????????????§???? 1 ??\??? 1000 ??\????????´??°??§
??¨??????????§??????° m ??? 1 ??\??? 1000 ??\?????§????????????????????±??????????????????????????????
????§???? a b ???????§?????????? time ????????? cost ??§??¨????????? time cost ???????????????
1 ??\??? 1000 ??\?????¨????????????????????????????????????????§? p ?????°????§? q ???????¨???? r
??§??¨????????? r ??? 0 ?????¨???????????????????????? 1 ?????????????°???????????????????????????????
?????????????????° k ??? 1 ??\??? 1000 ??\?????§??????????????????????????????????????????????????????
???????????¨????????????
??\ ???
?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????????
???????????§????????????????????????????????????????????\????????¨????????§??????
1 ?????? ??????????????±?????° n????§??????° m ?????´??° ??´??°???????§???????????????????
2 ?????? ?¬¬ 1 ?????????????????± a b cost time?????´??° ??´??° ??´??° ??´??°???????§???????????????????
3 ?????? ?¬¬ 2 ?????????????????±
???
n+1 ?????? ?¬¬ n ?????????????????±
n+2 ?????? ????????????????????° k?????´??°???
n+3 ?????? ?¬¬ 1 ?????????????????? p q r ?????´??° ??´??° ??´??°???????§???????????????????
n+4 ?????? ?¬¬ 2 ??????????????????
???
n+2+k ??? ?¬¬ k ??????????????????
??? ???
??\??????????????????????????¨??????????????????????????????????°????????????????????????????
*/
/*
???????????????????????????????????????????????????????????¨???????§£???
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=552375#1
*/
#include <stdio.h>
#define MAX_STATION (1000+2)
#define MAX 1000000000
#define min(x, y) ((x) < (y) ? (x) : (y))
int croute[ MAX_STATION ][ MAX_STATION ];
int troute[ MAX_STATION ][ MAX_STATION ];
int cost[ MAX_STATION ];
int check[ MAX_STATION ];
int used[ MAX_STATION ];
int n, m;
void dijkstra(int start, int route[ MAX_STATION ][ MAX_STATION ] )
{
int x, y, min;
for( x = 0 ; x < n ; x++ ) {
cost[ x ] = MAX;
used[ x ] = 0;
}
cost[ start ] = 0;
while( 1 ) {
min = INF;
for ( x = 0 ; x < n ; x++ ) {
if ( ( used[ x ] == 0 ) && ( min > cost[ x ] )) {
min = cost[ x ];
}
}
if ( min == MAX ) {
break;
}
for ( y = 0 ; y < n ; y++ ) {
if ( cost[ y ] == min ) {
for ( x = 0 ; x < n ; x++ ) {
if ( cost[ x ] > route[ x ][ y ] + cost[ y ] ) {
cost[ x ] = route[ x ][ y ] + cost[ y ];
}
}
}
}
}
}
int main( void )
{
int i, j, k;
int result;
while ( scanf( "%d %d", &n, &m ), n != 0 ) {
for ( i = 0 ; i < MAX_STATION ; i++ ) {
for (j = 0 ; j < MAX_STATION ; j++ ) {
croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
troute[ i ][ j ] = ( i == j ) ? 0 : MAX;
}
}
while (n > 0) {
int a, b, c, t;
scanf( "%d %d %d %d", &a, &b, &c, &t );
croute[ a ][ b ] = croute[ b ][ a ] = c;
troute[ a ][ b ] = troute[ b ][ a ] = t;
n--;
}
scanf( "%d", &k );
while ( k > 0 ) {
int p, q, r;
scanf( "%d %d %d", &p, &q, &r );
dijkstra( p, ( r == 0 ) ? croute : troute );
result = cost[ q ];
printf( "%d\n", result );
k--;
}
}
return 0;
} | main.c: In function 'dijkstra':
main.c:71:23: error: 'INF' undeclared (first use in this function)
71 | min = INF;
| ^~~
main.c:71:23: note: each undeclared identifier is reported only once for each function it appears in
|
s855127092 | p00200 | C | /*
?????????????????? ????????\?????????????¬???¨???
??? ???
???????????´??????????´\????????????????????????????????§????????????????¨??????????????????????????????????
????????????????????§??????????????????????????????????????????????????§????????????????????????????????????
??????????????\??????????????????????????¨?????\???????????????????????????????????????????????????????????°
??????????¨????????????????????????????????????????????´?????????????????????§??????????????????????????????
?¨??????????????????????????????°??????????????£????????????????????????
??????????????±????§??????°?????\?????¨?????????????????????????????????????????????????????????????°???????
???????????????????????°????????????????????????????????????????§???? 1 ??\??? 1000 ??\????????´??°??§
??¨??????????§??????° m ??? 1 ??\??? 1000 ??\?????§????????????????????±??????????????????????????????
????§???? a b ???????§?????????? time ????????? cost ??§??¨????????? time cost ???????????????
1 ??\??? 1000 ??\?????¨????????????????????????????????????????§? p ?????°????§? q ???????¨???? r
??§??¨????????? r ??? 0 ?????¨???????????????????????? 1 ?????????????°???????????????????????????????
?????????????????° k ??? 1 ??\??? 1000 ??\?????§??????????????????????????????????????????????????????
???????????¨????????????
??\ ???
?????°???????????????????????????????????\?????¨?????????????????????????????\??????????????????????????????
???????????§????????????????????????????????????????????\????????¨????????§??????
1 ?????? ??????????????±?????° n????§??????° m ?????´??° ??´??°???????§???????????????????
2 ?????? ?¬¬ 1 ?????????????????± a b cost time?????´??° ??´??° ??´??° ??´??°???????§???????????????????
3 ?????? ?¬¬ 2 ?????????????????±
???
n+1 ?????? ?¬¬ n ?????????????????±
n+2 ?????? ????????????????????° k?????´??°???
n+3 ?????? ?¬¬ 1 ?????????????????? p q r ?????´??° ??´??° ??´??°???????§???????????????????
n+4 ?????? ?¬¬ 2 ??????????????????
???
n+2+k ??? ?¬¬ k ??????????????????
??? ???
??\??????????????????????????¨??????????????????????????????????°????????????????????????????
*/
/*
???????????????????????????????????????????????????????????¨???????§£???
http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=552375#1
*/
#include <stdio.h>
#define MAX_STATION (100+2)
#define INF 1000000000
#define min(x, y) ((x) < (y) ? (x) : (y))
int croute[ MAX_STATION ][ MAX_STATION ];
int troute[ MAX_STATION ][ MAX_STATION ];
int cost[ MAX_STATION ];
int check[ MAX_STATION ];
int used[ MAX_STATION ];
int n, m;
void dijkstra(int start, int route[ MAX_STATION ][ MAX_STATION ] )
{
int x, y, min;
for( x = 0 ; x < n ; x++ ) {
cost[ x ] = INF;
used[ x ] = 0;
}
cost[ start ] = 0;
while( 1 ) {
min = INF;
for ( x = 0 ; x < n ; x++ ) {
if ( ( used[ x ] == 0 ) && ( min > cost[ x ] ) ) {
min = cost[ x ];
}
}
if ( min == INF ) {
break;
}
for ( y = 0 ; y < n ; y++ ) {
if ( cost[ y ] == min ) {
for ( x = 0 ; x < n ; x++ ) {
if ( cost[ x ] > route[ x ][ y ] + cost[ y ] ) {
cost[ x ] = route[ x ][ y ] + cost[ y ];
}
}
}
}
}
}
int main( void )
{
int i, j, k;
int result;
while ( scanf( "%d %d", &n, &m ), n != 0 ) {
for ( i = 0 ; i < MAX_STATION ; i++ ) {
for (j = 0 ; j < MAX_STATION ; j++ ) {
croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
troute[ i ][ j ] = ( i == j ) ? 0 : MAX;
}
}
while (n > 0) {
int a, b, c, t;
scanf( "%d %d %d %d", &a, &b, &c, &t );
croute[ a ][ b ] = croute[ b ][ a ] = c;
troute[ a ][ b ] = troute[ b ][ a ] = t;
n--;
}
scanf( "%d", &k );
while ( k > 0 ) {
int p, q, r;
scanf( "%d %d %d", &p, &q, &r );
dijkstra( p, ( r == 0 ) ? croute : troute );
result = cost[ q ];
printf( "%d\n", result );
k--;
}
}
return 0;
} | main.c: In function 'main':
main.c:101:69: error: 'MAX' undeclared (first use in this function)
101 | croute[ i ][ j ] = ( i == j ) ? 0 : MAX;
| ^~~
main.c:101:69: note: each undeclared identifier is reported only once for each function it appears in
|
s182975170 | p00200 | C | #include<iostream>
#include<map>
#include<queue>
using namespace std;
#define P pair<int, int>
#define MAX_M 300
#define MAX_N 100
int n, m, k, trainMap[MAX_N + 1][MAX_N + 1][2];
void resetTrainMap();
void inputTrainMap(int n);
int check(int p, int q, int r);
int main(){
while(cin >>n >>m){
if(n == 0 && m == 0) break;
resetTrainMap();
inputTrainMap(n);
cin >>k;
for(int i = 0; i < k; i++){
int p, q, r;
cin >>p >>q >>r;
cout <<check(p, q, r) <<endl;
}
}
return 0;
}
void resetTrainMap(){
for(int i = 0; i <= MAX_N; i++){
for(int j = 0; j <= MAX_N; j++){
trainMap[i][j][0] = -1;
trainMap[i][j][1] = -1;
}
}
}
void inputTrainMap(int n){
for(int i = 0; i < n; i++){
int a, b, c, t;
cin >>a >>b >>c >>t;
trainMap[a][b][0] = c;
trainMap[b][a][0] = c;
trainMap[a][b][1] = t;
trainMap[b][a][1] = t;
}
}
int check(int p, int q, int r){
priority_queue< P, vector<P>, greater<P> > ansQu; //f = cost or time
map<int, int> ansMap;
for(int i = 1; i <= m; i++) ansMap.insert( map<int, int>::value_type(i, -1) );
ansQu.push( make_pair(p, 0) );
while(!ansQu.empty()){
P nowq = ansQu.top();
for(int i = 1; i <= m; i++){
if(trainMap[nowq.first][i][r] != -1){
if(nowq.second + trainMap[nowq.first][i][r] < ansMap[i] || ansMap[i] == -1){
ansMap[i] = nowq.second + trainMap[nowq.first][i][r];
ansQu.push( make_pair(i, ansMap[i]) );
// cout <<"push! i = " <<i <<", cost or time = " <<ansMap[i] <<endl;
}
}
}
ansQu.pop();
}
return ansMap[q];
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s368880598 | p00200 | C | #include<iostream>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#define pb push_back
#define MAX_V 2000//場合によって変更
#define INF 1000000000
using namespace std;
typedef pair<int,int> P;//firstは最短距離,secondは頂点番号
struct edge{
int to,cost;
};
int V;//頂点の数
vector<vector<edge> > G;
//-----------
vector<vector<edge> > G2;
//-----------
int dijkstra(int s,int g){
priority_queue<P,vector<P> , greater<P> > que;
vector<int> d(V,INF);
d[s]=0;
que.push(P(0,0));
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));
}
}
}
return d[g];
}
//-----------
int dijkstra2(int s,int g){
priority_queue<P,vector<P> , greater<P> > que;
vector<int> d(V,INF);
d[s]=0;
que.push(P(0,0));
while(!que.empty()){
P p=que.top();
que.pop();
int v=p.second;
if(d[v]<p.first)
continue;
for(int i=0;i<G2[v].size();i++){
edge e=G2[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));
}
}
}
return d[g];
}
//--------------
int main(){
int E;
while(cin>>E>>V,E){
G.clear();
G.resize(V);
//------------
G2.clear();
G2.resize(V);
//---------------
for(int i=0;i<E;i++){
int x,y,c,t;
cin>>x>>y>>c>>t;x--;y--;
edge e;
e.cost=c;
e.to=y;
G[x].pb(e);
e.to=x;
G[y].pb(e);
//--------------
e.cost=t;
e.to=y;
G2[x].pb(e);
e.to=x;
G2[y].pb(e);
//---------------
}
int n;
cin>>n;
for(int i=0;i<n;i++){
int s,t,q;
cin>>s>>t>>q;
if(q==0)
cout<<dijkstra(s-1,t-1)<<endl;
else
cout<<dijkstra2(s-1,t-1)<<endl;
}
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s761327813 | p00200 | C | #include<stdio.h>
int min(int a,int b){
if(a > b)return b;
return a;
}
int main(){
int i,j,l,n,m,x,y,cost,time,p,q,r,k,matrix1[300][300],matrix2[300][300];
while(1){
scanf("%d %d",&n,&m);
if(n+m == 0)break;
for(i=0;i<m+2;i++){
for(j=0;j<m+2;j++){
matrix2[i][j] 100000000;
matrix1[i][j] = 1000000;
}
}
for(i=0;i<n;i++){
scanf("%d %d %d %d",&x,&y,&cost,&time);
matrix1[x][y] = cost;
matrix1[y][x] = cost;
matrix2[y][x] = time;
matrix2[x][y] = time;
}
for(k=1;k<=n;k++){
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
matrix1[i][j] = min(matrix1[i][j],matrix1[i][k]+matrix1[k][j]);
matrix2[i][j] = min(matrix2[i][j],matrix2[i][k]+matrix2[k][j]);
}
}
}
scanf("%d",&l);
for(i=0;i<l;i++){
scanf("%d %d %d",&p,&q,&r);
if(r == 0){
printf("%d\n",matrix1[p][q]);
}
else{
printf("%d\n",matrix2[p][q]);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:17:22: error: expected ';' before numeric constant
17 | matrix2[i][j] 100000000;
| ^~~~~~~~~~
| ;
|
s795543735 | p00200 | C | #include <stdio.h>
#define MAX 1000000000
#define min(x,y) ((x)<(y)?(x):(y))
int cost[101];
int check[101];
int route[101][101];
int n,m;
void dijkstra(int start, int route[101][101]) {
int i,j,k;
for (i = 1; i < m + 1; i++) {
cost[i] = MAX;
check[i] = 0;
}
cost[start] =0;
while (1) {
k=-1;
for (j=1;j<m+1;j++) {
if (check[j] == 0 && (k == -1 || cost[j] < cost[k]))
k = j;
}
if (k == -1)
break;
check[k] = 1;
for (j=1;j< m + 1;j++) {
cost[j] = min(cost[j], cost[k] + route[k][j]);
}
}
}
int main(void) {
int l, o, count,a, b, cro, tro;;
int result;
int croute[101][101];
int troute[101][101];
while (scanf("%d%d", &n, &m)) {
if(n+m==0) break;
for (l = 0; l < 101; l++) {
for (o = 0; o < 101; o++) {
croute[l][o] = l == o ? 0 : MAX;
troute[l][o] = l == o ? 0 : MAX;
}
}
while (n > 0) {
scanf("%d%d%d%d", &a, &b, &c, &t);
croute[a][b] = croute[b][a] = cro;
troute[a][b] = troute[b][a] = tro;
n--;
}
scanf("%d", &count);
while (count > 0) {
int p, q, r;
scanf("%d%d%d", &p, &q, &r);
dijkstra(p, r == 0 ? croute : troute);
result = cost[q];
printf("%d\n", result);
count--;
}
}
return 0;
} | main.c: In function 'main':
main.c:55:36: error: 'c' undeclared (first use in this function)
55 | scanf("%d%d%d%d", &a, &b, &c, &t);
| ^
main.c:55:36: note: each undeclared identifier is reported only once for each function it appears in
main.c:55:40: error: 't' undeclared (first use in this function)
55 | scanf("%d%d%d%d", &a, &b, &c, &t);
| ^
|
s954871046 | p00200 | C | #include <stdio.h>
#include <algorithm>
using namespace std;
int cost[101][101][2];
int d[101]; //始点固定は最初
bool used[101];
int n,m; //mは頂点数
void dijkstra(int s,int r){
for(int j=0;j<m;j++){
d[j]=1000000;
used[j]=false;
}
d[s]=0;
while(true){
int v=-1;
for(int u=0; u<m;u++){
if(!used[u] && (v == -1 || d[u] < d[v]))
v=u;
}
if(v == -1)
break;
used[v] = true;
for ( int u =0; u < m; u++){
d[u] = min(d[u], d[v] + cost[v][u][r]);
}
for(int i=0;i<5;i++){
printf("%d ",d[i]);
}
printf("\n");
}
}
int main(void){
for(;;){
int a,b,time,cos;
scanf("%d %d",&n,&m);
if(!(n|m))
break;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
cost[i][j][0]=1000000;
cost[i][j][1]=1000000;
}
}
for(int i=0;i<n;i++){
scanf("%d %d %d %d",&a,&b,&cos,&time);
a--; b--;
cost[a][b][0]=cos;
cost[b][a][0]=cos;
cost[a][b][1]=time;
cost[b][a][1]=time;
}
int p,q,r;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d %d",&p,&q,&r);
p--;q--;
dijkstra(p,r);
printf("%d\n",d[q]);
}
}
return 0;
} | main.c:2:10: fatal error: algorithm: No such file or directory
2 | #include <algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s485318728 | p00200 | C | #include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_N 100
#define MAX_M 3000
#define SWAP(type, a, b) do {type _tmp; _tmp = a; a = b; b = _tmp;} while(0)
typedef struct {
int v;
int dist;
} state;
bool greater(state a, state b) {
return a.dist > b.dist;
}
// priority_queue
typedef state value_type;
typedef struct skew_heap{
struct skew_heap *left, *right;
value_type value;
} skew_heap;
void swap(skew_heap *a, skew_heap *b) {
skew_heap *tmp = a;
a = b;
b = tmp;
}
skew_heap *meld(skew_heap *a, skew_heap *b) {
if(a == NULL) return b;
if(b == NULL) return a;
if(greater(a->value, b->value)) SWAP(skew_heap *, a, b);
a->right = meld(a->right, b);
SWAP(skew_heap *, a->left, a->right);
}
skew_heap *root;
bool empty() {
return root == NULL;
}
void enqueue(value_type value) {
skew_heap *new_node = malloc(sizeof(skew_heap));
new_node->left = NULL;
new_node->right = NULL;
new_node->value = value;
root = meld(root, new_node);
}
value_type dequeue() {
if(root == NULL) return (value_type){-1, -1};
value_type res = root->value;
skew_heap *tmp = meld(root->left, root->right);
free(root);
root = tmp;
return res;
}
// graph
int n, m;
int num;
int head[MAX_N], next[MAX_M * 2], to[MAX_M * 2];
int cost[MAX_M * 2], time[MAX_M * 2];
int dist[MAX_N];
void add_edge(int u, int v, int c, int t) {
next[num] = head[u];
head[u] = num;
to[num] = v;
cost[num] = c;
time[num] = t;
++num;
}
// calc weight
int dijkstra(int start, int goal, int r) {
int i, e;
const int *weight = (r ? time : cost);
for(i = 0; i < n; ++i) dist[i] = INT_MAX;
enqueue((state){start, 0});
dist[start] = 0;
while(!empty()) {
state current = dequeue();
if(dist[current.v] < current.dist)
continue;
for(e = head[current.v]; e != -1; e = next[e]) {
int next_dist = current.dist + weight[e];
if(dist[to[e]] > next_dist) {
dist[to[e]] = next_dist;
enqueue((state){to[e], next_dist});
}
}
}
assert(dist[goal] != INT_MAX);
return dist[goal];
}
int main(void) {
int i;
while(scanf("%d %d", &m, &n) == 2 && n) {
num = 0;
memset(head, -1, sizeof(head));
for(i = 0; i < m; ++i) {
int u, v, c, t;
scanf("%d %d %d %d", &u, &v, &c, &t);
--u; --v;
add_edge(u, v, c, t);
add_edge(v, u, c, t);
}
int query;
scanf("%d", &query);
while(query--) {
int start, goal, r;
scanf("%d %d %d", &start, &goal, &r);
printf("%d\n", dijkstra(start - 1, goal - 1, r));
}
}
return EXIT_SUCCESS;
} | main.c: In function 'dijkstra':
main.c:105:9: error: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
105 | assert(dist[goal] != INT_MAX);
| ^~~~~~
main.c:6:1: note: 'assert' is defined in header '<assert.h>'; this is probably fixable by adding '#include <assert.h>'
5 | #include <string.h>
+++ |+#include <assert.h>
6 |
|
s571277775 | p00200 | C++ | import sys
import heapq as h
inf = sys.maxsize
# おまじない
class heapq:
def __init__(self):
self.q = []
def push(self,v):
h.heappush(self.q, v)
def pop(self):
return h.heappop(self.q)
def is_empty(self):
return len(self.q) == 0
# 入力:graphと始点s
# 出力:始点sから各頂点tへの距離dist
def shortestPath0(graph, s):
n = len(graph)
dist = [inf for _ in range(n)]
visited = [False for _ in range(n)]
dist[s] = 0
while True:
idx, u = -1, inf
for i in range(n):
if not visited[i] and dist[i] < u:
idx = i
u = dist[i]
if u == inf: break
visited[idx] = True
for (next, w) in graph[idx]:
newdist = w + dist[idx]
if newdist < dist[next]:
dist[next] = newdist
return dist
def shortestPath1(graph, s):
n = len(graph)
dist = [inf for _ in range(n)]
visited = [False for _ in range(n)]
q = heapq()
q.push((0, s))
while not q.is_empty():
(cur_dist, v) = q.pop()
if visited[v] or dist[v] <= cur_dist:
continue
dist[v] = cur_dist
visited[v] = True
for next, w in graph[v]:
if not visited[next] and dist[v] + w < dist[next]:
q.push((dist[v] + w, next))
return dist
def main():
while True:
n, m = map(int, input().split())
if n == 0 and m == 0:
break
# 隣接リスト
tgraph = [[] for _ in range(m)]
cgraph = [[] for _ in range(m)]
for i in range(n):
a, b, cost, time = map(int, input().split())
a -= 1
b -= 1
cgraph[a].append((b, cost))
cgraph[b].append((b, cost))
tgraph[a].append((b, time))
tgraph[b].append((b, time))
c_dist = [shortestPath1(cgraph, s) for s in range(m)]
t_dist = [shortestPath1(tgraph, s) for s in range(m)]
k = int(input())
for i in range(k):
p, q, r = map(int, input().split())
p-=1
q-=1
if r == 0:
print(c_dist[p][q])
else:
print(t_dist[p][q])
main() | a.cc:6:3: error: invalid preprocessing directive #\U0000304a\U0000307e\U00003058\U0000306a\U00003044
6 | # おまじない
| ^~~~~~~~~~
a.cc:20:3: error: invalid preprocessing directive #\U00005165\U0000529b
20 | # 入力:graphと始点s
| ^~~~
a.cc:21:3: error: invalid preprocessing directive #\U000051fa\U0000529b
21 | # 出力:始点sから各頂点tへの距離dist
| ^~~~
a.cc:75:11: error: invalid preprocessing directive #\U000096a3\U000063a5\U000030ea\U000030b9\U000030c8
75 | # 隣接リスト
| ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s020949742 | p00200 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int time[3001][3001];
int cost[3001][3001];
int main(){
int i,j,k,a,b,t,c;
int rail, station;
int q,start,goal,dotti;
int temp;
while (1){
cin >> rail >> station;
if (rail == 0 && station == 0){
break;
}
for (i = 0; i < station+1; i++){
for (j = 0; j < station+1; j++){
time[i][j] = 1000000;
cost[i][j] = 1000000;
}
}
for (i = 0; i < rail; i++){
cin >> a >> b >> c >> t;
time[a][b] = t;
time[b][a] = t;
cost[a][b] = c;
cost[b][a] = c;
}
cin >> q;
for (;q>0;q--){
cin >> start >> goal >> dotti;
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
if (dotti == 0){
cout << cost[start][goal] << endl;
}
if (dotti == 1){
cout << time[start][goal] << endl;
}
}
}
} | a.cc:5:20: error: 'int time [3001][3001]' redeclared as different kind of entity
5 | int time[3001][3001];
| ^
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 'int main()':
a.cc:30:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = 1000000;
| ^
a.cc:30:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = 1000000;
| ^
a.cc:30:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
30 | time[i][j] = 1000000;
| ~~~~~~~~~~~^~~~~~~~~
a.cc:37:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | time[a][b] = t;
| ^
a.cc:37:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | time[a][b] = t;
| ^
a.cc:37:36: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
37 | time[a][b] = t;
| ~~~~~~~~~~~^~~
a.cc:38:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | time[b][a] = t;
| ^
a.cc:38:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | time[b][a] = t;
| ^
a.cc:38:36: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
38 | time[b][a] = t;
| ~~~~~~~~~~~^~~
a.cc:60:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:72: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:75: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:97: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:100: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:89: 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+'
60 | 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:71:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << time[start][goal] << endl;
| ^
a.cc:71:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << time[start][goal] << endl;
| ^
|
s402009515 | p00200 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int time[3001][3001];
int cost[3001][3001];
int main(){
int i,j,k,a,b,t,c;
int rail, station;
int q,start,goal,dotti;
int temp;
while (1){
cin >> rail >> station;
if (rail == 0 && station == 0){
break;
}
for (i = 0; i < station+1; i++){
for (j = 0; j < station+1; j++){
time[i][j] = 1000000;
cost[i][j] = 1000000;
}
}
for (i = 0; i < rail; i++){
cin >> a >> b >> c >> t;
time[a][b] = t;
time[b][a] = t;
cost[a][b] = c;
cost[b][a] = c;
}
cin >> q;
for (;q>0;q--){
cin >> start >> goal >> dotti;
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
if (dotti == 0){
cout << cost[start][goal] << endl;
}
if (dotti == 1){
cout << time[start][goal] << endl;
}
}
}
} | a.cc:5:20: error: 'int time [3001][3001]' redeclared as different kind of entity
5 | int time[3001][3001];
| ^
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 'int main()':
a.cc:30:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = 1000000;
| ^
a.cc:30:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = 1000000;
| ^
a.cc:30:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
30 | time[i][j] = 1000000;
| ~~~~~~~~~~~^~~~~~~~~
a.cc:37:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | time[a][b] = t;
| ^
a.cc:37:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | time[a][b] = t;
| ^
a.cc:37:36: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
37 | time[a][b] = t;
| ~~~~~~~~~~~^~~
a.cc:38:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | time[b][a] = t;
| ^
a.cc:38:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | time[b][a] = t;
| ^
a.cc:38:36: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
38 | time[b][a] = t;
| ~~~~~~~~~~~^~~
a.cc:60:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:72: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:75: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:97: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:100: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:60:89: 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+'
60 | 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:71:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << time[start][goal] << endl;
| ^
a.cc:71:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << time[start][goal] << endl;
| ^
|
s290464917 | p00200 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int clock[3001][3001];
int cost[3001][3001];
int main(){
int i,j,k,a,b,t,c;
int rail, station;
int q,start,goal,dotti;
int temp;
while (1){
cin >> rail >> station;
if (rail == 0 && station == 0){
break;
}
for (i = 0; i < station+1; i++){
for (j = 0; j < station+1; j++){
clock[i][j] = 1000000;
cost[i][j] = 1000000;
}
}
for (i = 0; i < rail; i++){
cin >> a >> b >> c >> t;
clock[a][b] = t;
clock[b][a] = t;
cost[a][b] = c;
cost[b][a] = c;
}
cin >> q;
for (;q>0;q--){
cin >> start >> goal >> dotti;
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (k = 1; k <= station; k++){
for (i = 1; i <= station; i++){
for (j = 1; j <= station; j++){
clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
}
}
}
if (dotti == 0){
cout << cost[start][goal] << endl;
}
if (dotti == 1){
cout << clock[start][goal] << endl;
}
}
}
} | a.cc:5:21: error: 'int clock [3001][3001]' redeclared as different kind of entity
5 | int clock[3001][3001];
| ^
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:72:16: note: previous declaration 'clock_t clock()'
72 | extern clock_t clock (void) __THROW;
| ^~~~~
a.cc: In function 'int main()':
a.cc:30:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | clock[i][j] = 1000000;
| ^
a.cc:30:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | clock[i][j] = 1000000;
| ^
a.cc:30:45: error: assignment of read-only location '*(clock + (((sizetype)i) + ((sizetype)j)))'
30 | clock[i][j] = 1000000;
| ~~~~~~~~~~~~^~~~~~~~~
a.cc:37:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | clock[a][b] = t;
| ^
a.cc:37:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
37 | clock[a][b] = t;
| ^
a.cc:37:37: error: assignment of read-only location '*(clock + (((sizetype)a) + ((sizetype)b)))'
37 | clock[a][b] = t;
| ~~~~~~~~~~~~^~~
a.cc:38:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | clock[b][a] = t;
| ^
a.cc:38:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
38 | clock[b][a] = t;
| ^
a.cc:38:37: error: assignment of read-only location '*(clock + (((sizetype)b) + ((sizetype)a)))'
38 | clock[b][a] = t;
| ~~~~~~~~~~~~^~~
a.cc:60:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:74: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:77: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:90: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:101: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:104: warning: pointer to a function used in arithmetic [-Wpointer-arith]
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ^
a.cc:60:92: error: invalid operands of types 'clock_t() noexcept' {aka 'long int() noexcept'} and 'clock_t() noexcept' {aka 'long int() noexcept'} to binary 'operator+'
60 | clock[i][j] = min(clock[i][j], clock[i][k] + clock[k][j]);
| ~~~~~~~~~~~ ^ ~~~~~~~~~~~
| | |
| | clock_t() noexcept {aka long int() noexcept}
| clock_t() noexcept {aka long int() noexcept}
a.cc:71:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << clock[start][goal] << endl;
| ^
a.cc:71:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | cout << clock[start][goal] << endl;
| ^
|
s085828052 | p00200 | 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;
short cost[3000][3000];
short time_data[3000][3000];
short main(){
short n, m;
while (cin >> n >> m && (n != 0 && m != 0)) {
short min_ = 2000; // 答えの最小値
short min_num = 1; // 答えの町
short from, to, time_, cost_;
short k;
short k_from, k_to, info;
for (short i = 0; i < 3000; i++) {
for (short j = 0; j < 3000; j++) {
cost[i][j] = 2000;
time_data[i][j] = 2000;
}
}
for (short i = 0; i < 3000; i++) {
cost[i][i] = 0;
}
for (short i = 0; i < n; i++) {
cin >> from >> to >> cost_ >> time_;
cost[from][to] = cost_;
cost[to][from] = cost_;
time_data[from][to] = time_;
time_data[to][from] = time_;
}
for (short k = 1; k <= m; k++) {
for (short i = 1; i <= m; i++) {
for (short j = 1; j <= m; j++) {
cost[i][j] = min((int)cost[i][j], cost[i][k] + cost[k][j]);
time_data[i][j] = min((int)time_data[i][j], time_data[i][k] + time_data[k][j]);
}
}
}
// 答えを求める
cin >> k;
for (short i = 0; i < k; i++) {
cin >> k_from >> k_to >> info;
if (info == 0) {
cout << cost[k_from][k_to] << endl;
} else {
cout << time_data[k_from][k_to] << endl;
}
}
}
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s311026728 | p00200 | C++ | #include <algorithm>
#define MAX_M 100
#define INF (1<<21)
using namespace std;
int dp_cost[MAX_M][MAX_M];
int dp_time[MAX_M][MAX_M];
int m;
void warshall_froyd(){
for(int k=0;k<m;k++){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
dp_cost[i][j] = min(dp_cost[i][j], dp_cost[i][k] + dp_cost[k][j]);
dp_time[i][j] = min(dp_time[i][j], dp_time[i][k] + dp_time[k][j]);
}
}
}
}
int main(){
int n;
cin >> n >> m;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
dp_time[i][j] = (i==j ? 0 : INF);
dp_cost[i][j] = (i==j ? 0 : INF);
}
}
for(int i=0;i<n;i++){
int a,b,cost,time;
cin >> a >> b >> cost >> time;
a--;
b--;
dp_cost[a][b] = cost; dp_cost[b][a] = cost;
dp_time[a][b] = time; dp_time[b][a] = time;
}
warshall_froyd();
int k,p,q,r;
cin >> k;
for(int i=0;i<k;i++){
cin >> p >> q >> r;
p--; q--;
cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
}
cin >> p >> q;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:3: error: 'cin' was not declared in this scope
23 | cin >> n >> m;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <algorithm>
+++ |+#include <iostream>
2 | #define MAX_M 100
a.cc:47:5: error: 'cout' was not declared in this scope
47 | cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
| ^~~~
a.cc:47:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:47:57: error: 'endl' was not declared in this scope
47 | cout << (r == 0 ? dp_cost[p][q] : dp_time[p][q]) << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <algorithm>
+++ |+#include <ostream>
2 | #define MAX_M 100
|
s745140659 | p00200 | C++ | 6 5
1 2 200 10
1 4 400 15
1 3 250 25
2 4 100 10
4 5 150 20
3 5 300 20
2
1 5 0
1 5 1
0 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 6 5
| ^
|
s868758597 | p00200 | C++ | #include<iostream>
#include<algorithm>
const int INF = 10000000;
const int N = 101;
int cost[N][N];
int time[N][N];
using namespace std;
int main()
{
int n, m, a, b, co, ti,r;
while (1){
cin >> n >> m;
if (n == 0 && m == 0)break;
for (int i = 0; i < n; i++){
for (int i2 = 0; i2 < n; i2++){
cost[i][i2] = INF;
time[i][i2] = INF;
}
}
for (int i = 0; i < n; i++){
cin >> a >> b >> co >> ti;
cost[a][b] = co;
cost[b][a] = co;
time[a][b] = ti;
time[b][a] = ti;
}
for (int k = 0; k < n; ++k)
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
{
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
cin >> m;
for (int i = 0; i < m; i++){
cin >> a >> b >> r;
if (r == 0){
cout << cost[a][b] << endl;
}
else
cout << time[a][b] << endl;
}
}
} | a.cc:6:14: error: 'int time [101][101]' redeclared as different kind of entity
6 | int time[N][N];
| ^
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 'int main()':
a.cc:17:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | time[i][i2] = INF;
| ^
a.cc:17:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | time[i][i2] = INF;
| ^
a.cc:17:45: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)i2)))'
17 | time[i][i2] = INF;
| ~~~~~~~~~~~~^~~~~
a.cc:24:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a][b] = ti;
| ^
a.cc:24:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a][b] = ti;
| ^
a.cc:24:36: error: assignment of read-only location '*(time + (((sizetype)a) + ((sizetype)b)))'
24 | time[a][b] = ti;
| ~~~~~~~~~~~^~~~
a.cc:25:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[b][a] = ti;
| ^
a.cc:25:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[b][a] = ti;
| ^
a.cc:25:36: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
25 | time[b][a] = ti;
| ~~~~~~~~~~~^~~~
a.cc:32:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:81: 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+'
32 | 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:41:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | cout << time[a][b] << endl;
| ^
a.cc:41:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
41 | cout << time[a][b] << endl;
| ^
|
s386329277 | p00200 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <regex>
#include <cmath>
#include <bitset>
#include <array>
#include <deque>
#include <list>
#include <stack>
#include <iterator>
#include <random>
using namespace std;
extern void* enabler;
//-----桁指定出力-------
// %8d: cout << setw(8);
// %08d: cout << setw(8) << setfill('0');
//=====別名・定数定義=====
using LL=long long int;
using ULL=unsigned long long int;
using Complex=complex<double>;
template<class T>
using asc_pqueue=std::priority_queue<T,vector<T>, std::greater<T>>;
template<class T>
using desc_pqueue=std::priority_queue<T,vector<T>, std::less<T>>;
template<class T>
using asc_set=std::set<T,vector<T>, std::greater<T>>;
template<class T>
using desc_set=std::set<T,vector<T>, std::less<T>>;
const LL INF = (1ll << 62);
#include <algorithm>
#include <utility>
//=====debug======
#define debug(...) cerr << (__VA_ARGS__) << endl;
template<typename T>
class has_begin_and_end
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.begin(), v.end(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_top_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.top(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_front_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.front(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<class T, typename std::enable_if<has_begin_and_end<T>::value>::type*& = enabler>
void dump(const T& val){
for(auto& v : val){
debug(v);
}
}
template<class T, typename std::enable_if<has_top_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.top());
val.pop();
}
}
template<class T, typename std::enable_if<has_front_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.front());
val.pop();
}
}
//=====pair-utility=====
template<class T, class U>
ostream& operator<<(ostream& os, const pair<T,U>& v)
{
os << "(" << v.first << ", " << v.second << ")";
return os;
}
template<class T, class U>
istream& operator>>(istream& is, pair<T,U>& v)
{
is >> v.first;
is >> v.second;
return is;
}
#define def_pair_op(op) template<class T, class U> \
auto operator op(const pair<T,U>& a, const pair<T,U>& b) -> pair<decltype(a.first op b.first), decltype(a.second op b.second)> \
{ \
return make_pair(a.first op b.first,a.second op b.second); \
} \
template<class T, class U, class V> \
auto operator op(const pair<T,U>& a, V b) -> pair<decltype(a.first op b), decltype(a.second op b)> \
{ \
return make_pair(a.first op b, a.second op b); \
}
def_pair_op(+)
def_pair_op(-)
def_pair_op(*)
def_pair_op(/)
def_pair_op(%)
#undef def_pair_op
//=====clamp=====
template<class T>
T clamp(const T& val, const T& a, const T& b){
return min(a, max(val, b));
}
template<class T,class U>
pair<T,U> clampPair(const pair<T,U>& val, const pair<T,U>& a, const pair<T,U>& b){
return {clamp(val.first,a.first,b.first), clamp(val.second,a.second,b.second)};
}
//=====hash=====
template<std::size_t... idx>
struct index_sequence{
typedef index_sequence<idx..., sizeof...(idx)> next;
static constexpr size_t size() { return sizeof...(idx); }
};
template<std::size_t idx>
struct build_tuple{
typedef typename build_tuple<idx-1>::type::next type;
};
template<>
struct build_tuple<0>{
typedef index_sequence<> type;
};
template<std::size_t N>
using make_index_sequence = typename build_tuple<N>::type;
namespace std {
template<class... T>
class hash<std::tuple<T...>> {
template<size_t... I>
size_t impl(const std::tuple<T...>& t, ::index_sequence<I...>) const{
initializer_list<size_t> h{std::hash<typename std::tuple_element<I, std::tuple<T...>>::type>()(std::get<I>(t))...};
size_t a = accumulate(h.begin(), h.end(), 0, [](size_t a, size_t b){return a ^ b;});
return a;
}
public:
size_t operator()(const std::tuple<T...> &t) const
{
return impl(t, ::make_index_sequence<std::tuple_size<std::tuple<T...>>::value>());
}
};
}
//=====complex=====
template<class T>
bool operator<(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() < b.imag();
return a.real() < b.real();
}
template<class T>
bool operator>(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() > b.imag();
return a.real() > b.real();
}
class edge{
public:
int from;
int to;
LL cost;
edge(){}
edge(int f,int t,LL c)
: from(f), to(t), cost(c)
{
}
edge reverse() const
{
return {to,from,cost};
}
};
class graph{
public:
int size; //????????°
vector<vector<edge>> edges;
graph(){
}
graph(int n)
: edges(n), size(n)
{
}
void init(int _size){
edges.clear();
edges.resize(_size);
size = _size;
}
void push_edge(const edge& e){
edges[e.from].push_back(e);
edges[e.to].push_back(e.reverse());
}
};
class dijkstra_result{
public:
const vector<LL> cost; //???????????¢
const LL result;
dijkstra_result(const vector<LL>& c, LL res)
: cost(c), result(res)
{
}
dijkstra_result(const vector<LL>&& c, LL res)
: cost(c), result(res)
{
}
};
dijkstra_result dijkstra(const graph& g, int from, int to, bool all = false){
asc_pqueue<pair<LL,int>> que;
vector<LL> v(g.size);
vector<bool> f(g.size);
fill(v.begin(), v.end(), INF);
que.push({0, from});
v[from] = 0;
while(!que.empty() || !(!all && f[to])){
auto p = que.top();
que.pop();
int n = p.second;
if(v[n] < p.first)
continue;
f[n] = true;
for(const auto& m : g.edges[n]){
if(v[m.to] > v[n] + m.cost){
v[m.to] = min(v[n] + m.cost, v[m.to]);
que.push({v[m.to], m.to});
}
}
}
int r = v[to];
return {v, r};
}
//#include "library/interval.h"
//#include "library/maybe.h"
//#include "library/utility.h"
//#include "library/rectangle.h"
//==========
int main(){
int n,m;
cin >> n >> m;
graph g1(m+1),g2(m+1);
for(int i=0;i<n;i++){
int x,y,a,b;
cin >> x >> y >> a >> b;
g1.push_edge({x,y,a});
g2.push_edge({x,y,b});
}
int q;
cin >> q;
for(int i=0;i<q;i++){
int s,g,t;
cin >> s >> g >> t;
auto res = dijkstra(t == 0 ? g1 : g2, s, g);
cout << res.result << endl;
}
return 0;
} | a.cc:175:17: error: reference to 'index_sequence' is ambiguous
175 | typedef index_sequence<> type;
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/utility.h:182:11: note: candidates are: 'template<long unsigned int ..._Idx> using std::index_sequence = std::integer_sequence<long unsigned int, _Idx ...>'
182 | using index_sequence = integer_sequence<size_t, _Idx...>;
| ^~~~~~~~~~~~~~
a.cc:163:8: note: 'template<long unsigned int ...idx> struct index_sequence'
163 | struct index_sequence{
| ^~~~~~~~~~~~~~
|
s759927686 | p00200 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <regex>
#include <cmath>
#include <bitset>
#include <array>
#include <deque>
#include <list>
#include <stack>
#include <iterator>
#include <random>
using namespace std;
extern void* enabler;
//-----桁指定出力-------
// %8d: cout << setw(8);
// %08d: cout << setw(8) << setfill('0');
//=====別名・定数定義=====
using LL=long long int;
using ULL=unsigned long long int;
using Complex=complex<double>;
template<class T>
using asc_pqueue=std::priority_queue<T,vector<T>, std::greater<T>>;
template<class T>
using desc_pqueue=std::priority_queue<T,vector<T>, std::less<T>>;
template<class T>
using asc_set=std::set<T,vector<T>, std::greater<T>>;
template<class T>
using desc_set=std::set<T,vector<T>, std::less<T>>;
const LL INF = (1ll << 62);
#include <algorithm>
#include <utility>
//=====debug======
#define debug(...) cerr << (__VA_ARGS__) << endl;
template<typename T>
class has_begin_and_end
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.begin(), v.end(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_top_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.top(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_front_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.front(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<class T, typename std::enable_if<has_begin_and_end<T>::value>::type*& = enabler>
void dump(const T& val){
for(auto& v : val){
debug(v);
}
}
template<class T, typename std::enable_if<has_top_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.top());
val.pop();
}
}
template<class T, typename std::enable_if<has_front_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.front());
val.pop();
}
}
//=====pair-utility=====
template<class T, class U>
ostream& operator<<(ostream& os, const pair<T,U>& v)
{
os << "(" << v.first << ", " << v.second << ")";
return os;
}
template<class T, class U>
istream& operator>>(istream& is, pair<T,U>& v)
{
is >> v.first;
is >> v.second;
return is;
}
#define def_pair_op(op) template<class T, class U> \
auto operator op(const pair<T,U>& a, const pair<T,U>& b) -> pair<decltype(a.first op b.first), decltype(a.second op b.second)> \
{ \
return make_pair(a.first op b.first,a.second op b.second); \
} \
template<class T, class U, class V> \
auto operator op(const pair<T,U>& a, V b) -> pair<decltype(a.first op b), decltype(a.second op b)> \
{ \
return make_pair(a.first op b, a.second op b); \
}
def_pair_op(+)
def_pair_op(-)
def_pair_op(*)
def_pair_op(/)
def_pair_op(%)
#undef def_pair_op
//=====clamp=====
template<class T>
T clamp(const T& val, const T& a, const T& b){
return min(a, max(val, b));
}
template<class T,class U>
pair<T,U> clampPair(const pair<T,U>& val, const pair<T,U>& a, const pair<T,U>& b){
return {clamp(val.first,a.first,b.first), clamp(val.second,a.second,b.second)};
}
//=====hash=====
template<std::size_t... idx>
struct index_sequence{
typedef index_sequence<idx..., sizeof...(idx)> next;
static constexpr size_t size() { return sizeof...(idx); }
};
template<std::size_t idx>
struct build_tuple{
typedef typename build_tuple<idx-1>::type::next type;
};
template<>
struct build_tuple<0>{
typedef index_sequence<> type;
};
template<std::size_t N>
using make_index_sequence = typename build_tuple<N>::type;
namespace std {
template<class... T>
class hash<std::tuple<T...>> {
template<size_t... I>
size_t impl(const std::tuple<T...>& t, ::index_sequence<I...>) const{
initializer_list<size_t> h{std::hash<typename std::tuple_element<I, std::tuple<T...>>::type>()(std::get<I>(t))...};
size_t a = accumulate(h.begin(), h.end(), 0, [](size_t a, size_t b){return a ^ b;});
return a;
}
public:
size_t operator()(const std::tuple<T...> &t) const
{
return impl(t, ::make_index_sequence<std::tuple_size<std::tuple<T...>>::value>());
}
};
}
//=====complex=====
template<class T>
bool operator<(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() < b.imag();
return a.real() < b.real();
}
template<class T>
bool operator>(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() > b.imag();
return a.real() > b.real();
}
class edge{
public:
int from;
int to;
LL cost;
edge(){}
edge(int f,int t,LL c)
: from(f), to(t), cost(c)
{
}
edge reverse() const
{
return {to,from,cost};
}
};
class graph{
public:
int size; //????????°
vector<vector<edge>> edges;
graph(){
}
graph(int n)
: edges(n), size(n)
{
}
void init(int _size){
edges.clear();
edges.resize(_size);
size = _size;
}
void push_edge(const edge& e){
edges[e.from].push_back(e);
edges[e.to].push_back(e.reverse());
}
};
class dijkstra_result{
public:
const vector<LL> cost; //???????????¢
const LL result;
dijkstra_result(const vector<LL>& c, LL res)
: cost(c), result(res)
{
}
dijkstra_result(const vector<LL>&& c, LL res)
: cost(c), result(res)
{
}
};
dijkstra_result dijkstra(const graph& g, int from, int to, bool all = false){
asc_pqueue<pair<LL,int>> que;
vector<LL> v(g.size);
vector<bool> f(g.size);
fill(v.begin(), v.end(), INF);
que.push({0, from});
v[from] = 0;
while(!que.empty() || !(!all && f[to])){
auto p = que.top();
que.pop();
int n = p.second;
if(v[n] < p.first)
continue;
f[n] = true;
for(const auto& m : g.edges[n]){
if(v[m.to] > v[n] + m.cost){
v[m.to] = min(v[n] + m.cost, v[m.to]);
que.push({v[m.to], m.to});
}
}
}
int r = v[to];
return {v, r};
}
//#include "library/interval.h"
//#include "library/maybe.h"
//#include "library/utility.h"
//#include "library/rectangle.h"
//==========
int main(){
int n,m;
cin >> n >> m;
graph g1(m+1),g2(m+1);
for(int i=0;i<n;i++){
int x,y,a,b;
cin >> x >> y >> a >> b;
g1.push_edge({x,y,a});
g2.push_edge({x,y,b});
}
int q;
cin >> q;
for(int i=0;i<q;i++){
int s,g,t;
cin >> s >> g >> t;
auto res = dijkstra(t == 0 ? g1 : g2, s, g);
cout << res.result << endl;
}
return 0;
} | a.cc:175:17: error: reference to 'index_sequence' is ambiguous
175 | typedef index_sequence<> type;
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/utility.h:182:11: note: candidates are: 'template<long unsigned int ..._Idx> using std::index_sequence = std::integer_sequence<long unsigned int, _Idx ...>'
182 | using index_sequence = integer_sequence<size_t, _Idx...>;
| ^~~~~~~~~~~~~~
a.cc:163:8: note: 'template<long unsigned int ...idx> struct index_sequence'
163 | struct index_sequence{
| ^~~~~~~~~~~~~~
|
s365610972 | p00200 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <regex>
#include <cmath>
#include <bitset>
#include <array>
#include <deque>
#include <list>
#include <stack>
#include <iterator>
#include <random>
using namespace std;
extern void* enabler;
using LL=long long int;
using ULL=unsigned long long int;
using Complex=complex<double>;
template<class T>
using asc_pqueue=std::priority_queue<T,vector<T>, std::greater<T>>;
template<class T>
using desc_pqueue=std::priority_queue<T,vector<T>, std::less<T>>;
template<class T>
using asc_set=std::set<T,vector<T>, std::greater<T>>;
template<class T>
using desc_set=std::set<T,vector<T>, std::less<T>>;
const LL INF = (1ll << 62);
#include <algorithm>
#include <utility>
//=====debug======
#define debug(...) cerr << (__VA_ARGS__) << endl;
template<typename T>
class has_begin_and_end
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.begin(), v.end(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_top_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.top(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_front_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.front(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<class T, typename std::enable_if<has_begin_and_end<T>::value>::type*& = enabler>
void dump(const T& val){
for(auto& v : val){
debug(v);
}
}
template<class T, typename std::enable_if<has_top_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.top());
val.pop();
}
}
template<class T, typename std::enable_if<has_front_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.front());
val.pop();
}
}
//=====pair-utility=====
template<class T, class U>
ostream& operator<<(ostream& os, const pair<T,U>& v)
{
os << "(" << v.first << ", " << v.second << ")";
return os;
}
template<class T, class U>
istream& operator>>(istream& is, pair<T,U>& v)
{
is >> v.first;
is >> v.second;
return is;
}
#define def_pair_op(op) template<class T, class U> \
auto operator op(const pair<T,U>& a, const pair<T,U>& b) -> pair<decltype(a.first op b.first), decltype(a.second op b.second)> \
{ \
return make_pair(a.first op b.first,a.second op b.second); \
} \
template<class T, class U, class V> \
auto operator op(const pair<T,U>& a, V b) -> pair<decltype(a.first op b), decltype(a.second op b)> \
{ \
return make_pair(a.first op b, a.second op b); \
}
def_pair_op(+)
def_pair_op(-)
def_pair_op(*)
def_pair_op(/)
def_pair_op(%)
#undef def_pair_op
//=====clamp=====
template<class T>
T clamp(const T& val, const T& a, const T& b){
return min(a, max(val, b));
}
template<class T,class U>
pair<T,U> clampPair(const pair<T,U>& val, const pair<T,U>& a, const pair<T,U>& b){
return {clamp(val.first,a.first,b.first), clamp(val.second,a.second,b.second)};
}
//=====hash=====
template<std::size_t... idx>
struct index_sequence{
typedef index_sequence<idx..., sizeof...(idx)> next;
static constexpr size_t size() { return sizeof...(idx); }
};
template<std::size_t idx>
struct build_tuple{
typedef typename build_tuple<idx-1>::type::next type;
};
template<>
struct build_tuple<0>{
typedef index_sequence<> type;
};
template<std::size_t N>
using make_index_sequence = typename build_tuple<N>::type;
namespace std {
template<class... T>
class hash<std::tuple<T...>> {
template<size_t... I>
size_t impl(const std::tuple<T...>& t, ::index_sequence<I...>) const{
initializer_list<size_t> h{std::hash<typename std::tuple_element<I, std::tuple<T...>>::type>()(std::get<I>(t))...};
size_t a = accumulate(h.begin(), h.end(), 0, [](size_t a, size_t b){return a ^ b;});
return a;
}
public:
size_t operator()(const std::tuple<T...> &t) const
{
return impl(t, ::make_index_sequence<std::tuple_size<std::tuple<T...>>::value>());
}
};
}
//=====complex=====
template<class T>
bool operator<(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() < b.imag();
return a.real() < b.real();
}
template<class T>
bool operator>(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() > b.imag();
return a.real() > b.real();
}
class edge{
public:
int from;
int to;
LL cost;
edge(){}
edge(int f,int t,LL c)
: from(f), to(t), cost(c)
{
}
edge reverse() const
{
return {to,from,cost};
}
};
class graph{
public:
int size; //????????°
vector<vector<edge>> edges;
graph(){
}
graph(int n)
: edges(n), size(n)
{
}
void init(int _size){
edges.clear();
edges.resize(_size);
size = _size;
}
void push_edge(const edge& e){
edges[e.from].push_back(e);
edges[e.to].push_back(e.reverse());
}
};
class dijkstra_result{
public:
const vector<LL> cost; //???????????¢
const LL result;
dijkstra_result(const vector<LL>& c, LL res)
: cost(c), result(res)
{
}
dijkstra_result(const vector<LL>&& c, LL res)
: cost(c), result(res)
{
}
};
dijkstra_result dijkstra(const graph& g, int from, int to, bool all = false){
asc_pqueue<pair<LL,int>> que;
vector<LL> v(g.size);
vector<bool> f(g.size);
fill(v.begin(), v.end(), INF);
que.push({0, from});
v[from] = 0;
while(!que.empty() || !(!all && f[to])){
auto p = que.top();
que.pop();
int n = p.second;
if(v[n] < p.first)
continue;
f[n] = true;
for(const auto& m : g.edges[n]){
if(v[m.to] > v[n] + m.cost){
v[m.to] = min(v[n] + m.cost, v[m.to]);
que.push({v[m.to], m.to});
}
}
}
int r = v[to];
return {v, r};
}
//#include "library/interval.h"
//#include "library/maybe.h"
//#include "library/utility.h"
//#include "library/rectangle.h"
//==========
int main(){
int n,m;
cin >> n >> m;
graph g1(m+1),g2(m+1);
for(int i=0;i<n;i++){
int x,y,a,b;
cin >> x >> y >> a >> b;
g1.push_edge({x,y,a});
g2.push_edge({x,y,b});
}
int q;
cin >> q;
for(int i=0;i<q;i++){
int s,g,t;
cin >> s >> g >> t;
auto res = dijkstra(t == 0 ? g1 : g2, s, g);
cout << res.result << endl;
}
return 0;
} | a.cc:168:17: error: reference to 'index_sequence' is ambiguous
168 | typedef index_sequence<> type;
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/utility.h:182:11: note: candidates are: 'template<long unsigned int ..._Idx> using std::index_sequence = std::integer_sequence<long unsigned int, _Idx ...>'
182 | using index_sequence = integer_sequence<size_t, _Idx...>;
| ^~~~~~~~~~~~~~
a.cc:156:8: note: 'template<long unsigned int ...idx> struct index_sequence'
156 | struct index_sequence{
| ^~~~~~~~~~~~~~
|
s975801330 | p00200 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <regex>
#include <cmath>
#include <bitset>
#include <array>
#include <deque>
#include <list>
#include <stack>
#include <iterator>
#include <random>
using namespace std;
extern void* enabler;
//-----桁指定出力-------
// %8d: cout << setw(8);
// %08d: cout << setw(8) << setfill('0');
//=====別名・定数定義=====
using LL=long long int;
using ULL=unsigned long long int;
using Complex=complex<double>;
template<class T>
using asc_pqueue=std::priority_queue<T,vector<T>, std::greater<T>>;
template<class T>
using desc_pqueue=std::priority_queue<T,vector<T>, std::less<T>>;
template<class T>
using asc_set=std::set<T,vector<T>, std::greater<T>>;
template<class T>
using desc_set=std::set<T,vector<T>, std::less<T>>;
const LL INF = (1ll << 62);
#include <algorithm>
#include <utility>
//=====debug======
#define debug(...) cerr << (__VA_ARGS__) << endl;
template<typename T>
class has_begin_and_end
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.begin(), v.end(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_top_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.top(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<typename T>
class has_front_and_pop
{
private:
template<typename U>
static auto check( U v ) -> decltype( v.empty(), v.front(), v.pop(), std::true_type() );
static auto check( ... ) -> decltype( std::false_type() );
public:
typedef decltype( check( std::declval<T>() ) ) type;
static bool const value = type::value;
};
template<class T, typename std::enable_if<has_begin_and_end<T>::value>::type*& = enabler>
void dump(const T& val){
for(auto& v : val){
debug(v);
}
}
template<class T, typename std::enable_if<has_top_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.top());
val.pop();
}
}
template<class T, typename std::enable_if<has_front_and_pop<T>::value>::type*& = enabler>
void dump(T val){
while(!val.empty()){
debug(val.front());
val.pop();
}
}
//=====pair-utility=====
template<class T, class U>
ostream& operator<<(ostream& os, const pair<T,U>& v)
{
os << "(" << v.first << ", " << v.second << ")";
return os;
}
template<class T, class U>
istream& operator>>(istream& is, pair<T,U>& v)
{
is >> v.first;
is >> v.second;
return is;
}
#define def_pair_op(op) template<class T, class U> \
auto operator op(const pair<T,U>& a, const pair<T,U>& b) -> pair<decltype(a.first op b.first), decltype(a.second op b.second)> \
{ \
return make_pair(a.first op b.first,a.second op b.second); \
} \
template<class T, class U, class V> \
auto operator op(const pair<T,U>& a, V b) -> pair<decltype(a.first op b), decltype(a.second op b)> \
{ \
return make_pair(a.first op b, a.second op b); \
}
def_pair_op(+)
def_pair_op(-)
def_pair_op(*)
def_pair_op(/)
def_pair_op(%)
#undef def_pair_op
//=====clamp=====
template<class T>
T clamp(const T& val, const T& a, const T& b){
return min(a, max(val, b));
}
template<class T,class U>
pair<T,U> clampPair(const pair<T,U>& val, const pair<T,U>& a, const pair<T,U>& b){
return {clamp(val.first,a.first,b.first), clamp(val.second,a.second,b.second)};
}
//=====hash=====
template<std::size_t... idx>
struct index_sequence{
typedef index_sequence<idx..., sizeof...(idx)> next;
static constexpr size_t size() { return sizeof...(idx); }
};
template<std::size_t idx>
struct build_tuple{
typedef typename build_tuple<idx-1>::type::next type;
};
template<>
struct build_tuple<0>{
typedef index_sequence<> type;
};
template<std::size_t N>
using make_index_sequence = typename build_tuple<N>::type;
namespace std {
template<class... T>
class hash<std::tuple<T...>> {
template<size_t... I>
size_t impl(const std::tuple<T...>& t, ::index_sequence<I...>) const{
initializer_list<size_t> h{std::hash<typename std::tuple_element<I, std::tuple<T...>>::type>()(std::get<I>(t))...};
size_t a = accumulate(h.begin(), h.end(), 0, [](size_t a, size_t b){return a ^ b;});
return a;
}
public:
size_t operator()(const std::tuple<T...> &t) const
{
return impl(t, ::make_index_sequence<std::tuple_size<std::tuple<T...>>::value>());
}
};
}
//=====complex=====
template<class T>
bool operator<(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() < b.imag();
return a.real() < b.real();
}
template<class T>
bool operator>(const complex<T>& a, const complex<T>& b){
if(a.real() == b.real())
return a.imag() > b.imag();
return a.real() > b.real();
}
class edge{
public:
int from;
int to;
LL cost;
edge(){}
edge(int f,int t,LL c)
: from(f), to(t), cost(c)
{
}
edge reverse() const
{
return {to,from,cost};
}
};
class graph{
public:
int size; //頂点数
vector<vector<edge>> edges;
graph(){
}
graph(int n)
: edges(n), size(n)
{
}
void init(int _size){
edges.clear();
edges.resize(_size);
size = _size;
}
void push_edge(const edge& e){
edges[e.from].push_back(e);
edges[e.to].push_back(e.reverse());
}
};
class dijkstra_result{
public:
const vector<LL> cost; //最短距離
const LL result;
dijkstra_result(const vector<LL>& c, LL res)
: cost(c), result(res)
{
}
dijkstra_result(const vector<LL>&& c, LL res)
: cost(c), result(res)
{
}
};
dijkstra_result dijkstra(const graph& g, int from, int to, bool all = false){
asc_pqueue<pair<LL,int>> que;
vector<LL> v(g.size);
vector<bool> f(g.size);
fill(v.begin(), v.end(), INF);
que.push({0, from});
v[from] = 0;
while(!que.empty() || !(!all && f[to])){
auto p = que.top();
que.pop();
int n = p.second;
if(v[n] < p.first)
continue;
f[n] = true;
for(const auto& m : g.edges[n]){
if(v[m.to] > v[n] + m.cost){
v[m.to] = min(v[n] + m.cost, v[m.to]);
que.push({v[m.to], m.to});
}
}
}
int r = v[to];
return {v, r};
}
//==========
int main(){
int n,m;
cin >> n >> m;
graph g1(m+1),g2(m+1);
for(int i=0;i<n;i++){
int x,y,a,b;
cin >> x >> y >> a >> b;
g1.push_edge({x,y,a});
g2.push_edge({x,y,b});
}
int q;
cin >> q;
for(int i=0;i<q;i++){
int s,g,t;
cin >> s >> g >> t;
auto res = dijkstra(t == 0 ? g1 : g2, s, g);
cout << res.result << endl;
}
return 0;
} | a.cc:174:17: error: reference to 'index_sequence' is ambiguous
174 | typedef index_sequence<> type;
| ^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:62,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/utility.h:182:11: note: candidates are: 'template<long unsigned int ..._Idx> using std::index_sequence = std::integer_sequence<long unsigned int, _Idx ...>'
182 | using index_sequence = integer_sequence<size_t, _Idx...>;
| ^~~~~~~~~~~~~~
a.cc:162:8: note: 'template<long unsigned int ...idx> struct index_sequence'
162 | struct index_sequence{
| ^~~~~~~~~~~~~~
|
s935595262 | p00200 | C++ | Y | a.cc:1:1: error: 'Y' does not name a type
1 | Y
| ^
|
s787119581 | p00200 | C++ | Y | a.cc:1:1: error: 'Y' does not name a type
1 | Y
| ^
|
s293760757 | p00200 | C++ | Y | a.cc:1:1: error: 'Y' does not name a type
1 | Y
| ^
|
s106859040 | p00200 | C++ | #include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <iterator>
using namespace std;
struct AboutTo;
class Node{
public:
int aa;
int Lowest;
bool IsSelected;
vector<AboutTo> ToCollection;
Node(){
Lowest = 2147483647/2;
IsSelected = false;
}
void Reset(){
Lowest = 2147483647/2;
IsSelected = false;
}
};
struct AboutTo{
Node* To;
int Cost;
int Time;
};
int GetShortest(int a,Node GoalNode, int b, vector<Node> &aNodeCol, const int IsTime){
aNodeCol[a].IsSelected = true;
int TempMin = 2147483647/2;
int aNode;
Node fad;
for (unsigned int i = 0; i < aNodeCol.size(); ++i){
if (aNodeCol[i].IsSelected){
for (unsigned int j = 0; j < aNodeCol[i].ToCollection.size(); ++j){
if (!(*(aNodeCol[i].ToCollection[j].To)).IsSelected){
if (IsTime){
if (TempMin>aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Time){
TempMin = aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Time;
aNode = (*(aNodeCol[i].ToCollection[j].To)).aa;
fad = *aNodeCol[i].ToCollection[j].To;
}
}
else{
if (TempMin>aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Cost){
TempMin = aNodeCol[i].Lowest + aNodeCol[i].ToCollection[j].Cost;
aNode = (*(aNodeCol[i].ToCollection[j].To)).aa;
fad = *aNodeCol[i].ToCollection[j].To;
}
}
}
}
}
}
if (b != aNode){
aNodeCol[aNode].Lowest = TempMin;
return GetShortest(aNode,GoalNode, b, aNodeCol, IsTime);
}
/*if (GoalNode != aNode){
aNodeCol[aNode].Lowest = TempMin;
return GetShortest(aNode, GoalNode, b, aNodeCol, IsTime);
}*/
return TempMin;
}
int main(){
int n, m;
cin >> n >> m;
vector<Node> NodeCollection;
for (int i = 0; i < m; ++i){
Node aNode;
aNode.aa = i;
NodeCollection.push_back(aNode);
}
for (int i = 0; i < n; ++i){
int a, b, cost, time;
cin >> a >> b >> cost >> time;
NodeCollection[a - 1].ToCollection.push_back({ &NodeCollection[b - 1], cost, time });
NodeCollection[b - 1].ToCollection.push_back({ &NodeCollection[a - 1], cost, time });
}
int k;
cin >> k;
for (int i = 0; i < k; ++i){
int p, q, r;
cin >> p >> q >> r;
NodeCollection[p - 1].Lowest = 0;
cout << GetShortest(p - 1, q - 1, NodeCollection, r) << endl;
for (auto i = NodeCollection.begin(); i != NodeCollection.end(); ++i){
(*i).Reset();
}
}
cin >> k >> k;
return 0;
} | a.cc: In function 'int main()':
a.cc:91:46: error: could not convert '(q - 1)' from 'int' to 'Node'
91 | cout << GetShortest(p - 1, q - 1, NodeCollection, r) << endl;
| ~~^~~
| |
| int
|
s745974434 | p00200 | C++ | // 0200.cpp : テ」ツδ。テ」ツつ、テ」ツδウ テ」ツδ療」ツδュテ」ツつクテ」ツつァテ」ツつッテ」ツδ?テ」ツδ陛」ツつ。テ」ツつ、テ」ツδォテ」ツ?ァテ」ツ?凖」ツ??
#include "stdafx.h"
#include <iostream>
#include <cstring>
using namespace std;
const int INF=100000;
int cost[101][101];
int tim[101][101];
int main(void){
int n,m,a,b,c;
while(1){
for(a=0;a<=100;a++){
for(b=0;b<=100;b++){
cost[a][b]=INF;
tim[a][b]=INF;
if(a==b)cost[a][b]=0,tim[a][b]=0;
}
}
cin >> n >> m;
if(n==0 && m==0)break;
for(a=0;a<n;a++){
int f,t,co,ti;
scanf("%d%d%d%d",&f,&t,&co,&ti);
if(cost[f][t]>co)cost[f][t]=co,cost[t][f]=co;
if(tim[f][t]>ti)tim[f][t]=ti,tim[t][f]=ti;
}
for(c=1;c<=m;c++){
for(b=1;b<=m;b++){
for(a=1;a<=m;a++){
cost[a][b]=min(cost[a][b],cost[a][c]+cost[c][b]);
tim[a][b]=min(tim[a][b],tim[a][c]+tim[c][b]);
}
}
}
cin >> n;
for(a=0;a<n;a++){
int d,f,t;
scanf("%d%d%d",&f,&t,&d);
if(d==0)printf("%d\n",cost[f][t]);
if(d==1)printf("%d\n",tim[f][t]);
}
}
return 0;
} | a.cc:3:10: fatal error: stdafx.h: No such file or directory
3 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s214768887 | p00200 | C++ | #include <iostream>
#include <set>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int n,m,K;
int cost[100][100],time[100][100];
int main()
{
while(cin>>n>>m&&(n||m)){
fill(cost[0],cost[100],1000000);
fill(time[0],time[100],1000000);
for(int i=0;i<n;i++){
int a,b,c,t;cin>>a>>b>>c>>t;a--;b--;
cost[a][b]=cost[b][a]=c;
time[a][b]=time[b][a]=t;
}
for(int k=0;k<m;k++)
for(int i=0;i<m;i++)
for(int j=0;j<m;j++){
cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
}
cin>>K;
while(K--){
int p,q,r;
cin>>p>>q>>r;p--;q--;
if(r==0)cout<<cost[p][q]<<endl;
else cout<<time[p][q]<<endl;
}
}
return 0;
} | a.cc:10:33: error: 'int time [100][100]' redeclared as different kind of entity
10 | int cost[100][100],time[100][100];
| ^
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 'int main()':
a.cc:15:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | fill(time[0],time[100],1000000);
| ^
a.cc:15:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | fill(time[0],time[100],1000000);
| ^
a.cc:19:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | time[a][b]=time[b][a]=t;
| ^
a.cc:19:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | time[a][b]=time[b][a]=t;
| ^
a.cc:19:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | time[a][b]=time[b][a]=t;
| ^
a.cc:19:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
19 | time[a][b]=time[b][a]=t;
| ^
a.cc:19:46: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
19 | time[a][b]=time[b][a]=t;
| ~~~~~~~~~~^~
a.cc:25:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:62: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:65: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:73: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:87: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
a.cc:25:77: 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+'
25 | 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:32:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | else cout<<time[p][q]<<endl;
| ^
a.cc:32:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | else cout<<time[p][q]<<endl;
| ^
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long int (*)(long int*) noexcept; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = long int (*)(long int*) noexcept; _Tp = int]'
998 | { std::__fill_a1(__first, __last, __value); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = long int (*)(long int*) noexcept; _Tp = int]'
1029 | std::__fill_a(__first, __last, __value);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:15:7: required from here
15 | fill(time[0],time[100],1000000);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: assignment of read-only location '* __first'
952 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
|
s931794151 | p00200 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
template<typename T>
void remove(vector<T>& vector, unsigned int index){
vector.erase(vector.begin() + index);
}
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void){
int n, m;
while(cin >> n >> m, n||m){
int cost[120][120];
int timm[120][120];
rep(i,m)rep(j,m){
cost[i][j] = 1e9;
timm[i][j] = 1e9;
}
for(int i = 0; i < n; i++){
int a, b,c,t;
cin >> a >> b >> c >> t;
cost[a][b] = c;
cost[b][a] = c;
timm[a][b] = t;
timm[b][a] = t;
}
for(int k=0;k<n;++k)for(int i=0;i<n;++i)for(int j=0;j<n;++j){
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
timm[i][j] = min(timm[i][j], timm[i][k] + timm[k][j])
}
int k;
cin >> k;
rep(i, k){
int a, b, c;
cin >> a >> b >> c;
if(!c)
cout << cost[a][b] << endl;
else
cout << timm[a][b] << endl;
}
}
return 0;
}
int StrToInt(string s){
stringstream ss;
ss << s;
int val;
ss >> val;
return val;
}
string IntToStr(int i){
stringstream ss;
ss << i;
return ss.str();
} | a.cc: In function 'int main()':
a.cc:54:78: error: expected ';' before '}' token
54 | timm[i][j] = min(timm[i][j], timm[i][k] + timm[k][j])
| ^
| ;
55 | }
| ~
|
s781888412 | p00200 | C++ | #include<iostream>
#include<set>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e6
using namespace std;
int n,m,k,a,b,c,d,p,q,r;
int cost[101][101],tm[101][101],d[101];
bool used[101];
void dfunc(int s,int r){
d[s]=0;
rep(i,101){
used[i]=true;
d[i]=INF;
}
while(1){
int mem=INF,now=-1;
rep(i,101){
if(used[i] && mem>d[i]){
now=i;
mem=d[i];
}
}
if(now==-1)break;
used[now]=false;
rep(i,101){
if(r==0){
if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
}else{
if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
}
}
}
}
int main(){
while(cin>>n>>m,n||m){
rep(i,101)rep(j,101){
cost[i][j]=INF;
tm[i][j]=INF;
}
rep(i,n){
cin>>a>>b>>c>>d;
a--;
b--;
cost[b][a]=cost[a][b]=c;
tm[b][a]=tm[a][b]=d;
}
cin>>k;
rep(i,k){
cin>>p>>q>>r;
dfunc(p,r);
cout<<d[q]<<endl;
}
}
return 0;
} | a.cc:8:33: error: conflicting declaration 'int d [101]'
8 | int cost[101][101],tm[101][101],d[101];
| ^
a.cc:7:17: note: previous declaration as 'int d'
7 | int n,m,k,a,b,c,d,p,q,r;
| ^
a.cc: In function 'void dfunc(int, int)':
a.cc:12:10: error: invalid types 'int[int]' for array subscript
12 | d[s]=0;
| ^
a.cc:15:18: error: invalid types 'int[int]' for array subscript
15 | d[i]=INF;
| ^
a.cc:20:44: error: invalid types 'int[int]' for array subscript
20 | if(used[i] && mem>d[i]){
| ^
a.cc:22:38: error: invalid types 'int[int]' for array subscript
22 | mem=d[i];
| ^
a.cc:29:55: error: invalid types 'int[int]' for array subscript
29 | if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
| ^
a.cc:29:60: error: invalid types 'int[int]' for array subscript
29 | if(cost[now][i]!=INF)d[i]=d[now]+cost[now][i];
| ^
a.cc:31:53: error: invalid types 'int[int]' for array subscript
31 | if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
| ^
a.cc:31:58: error: invalid types 'int[int]' for array subscript
31 | if(tm[now][i]!=INF)d[i]=d[now]+tm[now][i];
| ^
a.cc: In function 'int main()':
a.cc:54:32: error: invalid types 'int[int]' for array subscript
54 | cout<<d[q]<<endl;
| ^
|
s444272871 | p00200 | C++ | #include<iostream>
#include<algorithm>
#define MAX 1000000
using namespace std;
int main(){
int n, m, a, b, cost, ti, k, p, q, r, point = 0;
int cost_[101][101], time_[101][101], k_[101];
for (int i = 0; i < 101; i++){
for (int l = 0; l < 101; l++){
cost_[i][l] = MAX;
ti_[i][l] = MAX;
}
}
cin >> n >> m;
while (n != 0 && m != 0){
for (int i = 0; i < n; i++){
cin >> a >> b >> cost >> ti;
cost_[a][b] = cost;
ti_[a][b] = time;
}
cin >> k;
for (int i = 0; i < k; i++){
cin >> p >> q >> r;
k_[point] = p;
k_[point + 1] = q;
k_[point + 2] = r;
point += 3;
}point = 0;
for (int i = 1; i <= m; i++){
for (int j = 1; j <= m; j++){
for (int o = 1; o <= m; o++){
if (cost_[j][i] != MAX && cost_[i][o] != MAX &&
ti_[j][i] != MAX && ti_[i][o] != MAX){
cost_[j][o] = min(cost_[j][o], cost_[j][i] + cost_[i][o]);
ti_[j][o] = min(ti_[j][o], ti_[j][i] + ti_[i][o]);
}
}
}
}
for (int i = 0; i < k; i++){
if (k_[point + 2] == 0){
cout << cost_[k_[point]][k_[point + 1]] << endl;
}
else cout << time_[k_[point]][k_[point + 1]] << endl;
point += 3;
}
cin >> n >> m;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:25: error: 'ti_' was not declared in this scope; did you mean 'ti'?
11 | ti_[i][l] = MAX;
| ^~~
| ti
a.cc:19:25: error: 'ti_' was not declared in this scope; did you mean 'ti'?
19 | ti_[a][b] = time;
| ^~~
| ti
a.cc:33:49: error: 'ti_' was not declared in this scope; did you mean 'ti'?
33 | ti_[j][i] != MAX && ti_[i][o] != MAX){
| ^~~
| ti
|
s192755496 | p00200 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
#define chmin(a,b) a=min(a,b)
#define rep(i,x) for(int i=0;i<(x);++i)
const int inf = 1e9;
int N, M;
int mc[100][100], mt[100][100];
int main()
{
while (scanf("%d %d", &N, &M), N || M) {
fill(mc, mc[M], inf);
fill(mt, mt[M], inf);
rep(i, M) mc[i][i] = mt[i][i] = 0;
rep(i, N) {
int a, b, cost, time; scanf("%d %d %d %d", &a, &b, &cost, &time); a--; b--;
mc[a][b] = mc[b][a] = cost;
mt[a][b] = mt[b][a] = time;
}
rep(k, M) rep(i, M) rep(j, M) {
chmin(mc[i][j], mc[i][k] + mc[j][k]);
chmin(mt[i][j], mt[i][k] + mt[j][k]);
}
int K; scanf("%d", &K);
rep(i, K) {
int p, q, r; scanf("%d %d %d", &p, &q, &r); p--; q--;
printf("%d\n", r == 0 ? mc[p][q] : mt[p][q]);
}
}
} | a.cc: In function 'int main()':
a.cc:17:21: error: no matching function for call to 'fill(int [100][100], int [100], const int&)'
17 | fill(mc, mc[M], inf);
| ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
1022 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: deduced conflicting types for parameter '_ForwardIterator' ('int (*)[100]' and 'int*')
17 | fill(mc, mc[M], inf);
| ~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate expects 4 arguments, 3 provided
a.cc:18:21: error: no matching function for call to 'fill(int [100][100], int [100], const int&)'
18 | fill(mt, mt[M], inf);
| ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: candidate: 'template<class _ForwardIterator, class _Tp> void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&)'
1022 | fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:1022:5: note: template argument deduction/substitution failed:
a.cc:18:21: note: deduced conflicting types for parameter '_ForwardIterator' ('int (*)[100]' and 'int*')
18 | fill(mt, mt[M], inf);
| ~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: candidate expects 4 arguments, 3 provided
|
s201916772 | p00200 | C++ | #include <list>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#define INF (1LL << 60)
using namespace std;
bool used[100]; long long dist[100];
void dijkstra(int V, int E, int s, vector<pair<int, long long> > X[]) {
priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > Q;
for (int i = 0; i < V; i++) dist[i] = INF, used[i] = false;
dist[s] = 0; Q.push(make_pair(0, s));
int cnt = 0;
while (!Q.empty()) {
if (cnt > E) return; // NEGATIVE_CYCLE
pair<long long, int> p = Q.top(); used[p.second] = true; Q.pop();
for (int i = 0; i < X[p.second].size(); i++) {
int to = X[p.second][i].first; long long leng = X[p.second][i].second;
if (dist[to] > dist[p.second] + leng && !used[to]) {
dist[to] = dist[p.second] + leng;
Q.push(make_pair(dist[to], to));
}
}
}
}
int n, m, q, a, b, c, u, v, w1, w2; vector<pair<int, long long> > G1[100], G2[100];
int main() {
while(cin >> n >> m, n) {
for(int i = 0; i < m; i++) G1[i].clear(), G2[i].clear();
for(int i = 0; i < n; i++) {
cin >> u >> v >> w1 >> w2;
G1[u].push_back(make_pair(v, w1));
G1[v].push_back(make_pair(u, w1));
G2[u].push_back(make_pair(v, w2));
G2[v].push_back(make_pair(u, w2));
}
cin >> q;
for(int i = 0; i < q; i++) {
cin >> a >> b >> c;
if(c == 0) {
dijksrta(m, n, a, G1);
cout << dist[b] << endl;
}
else {
dijkstra(m, n, a, G2);
cout << dist[b] << endl;
}
}
}
} | a.cc: In function 'int main()':
a.cc:42:33: error: 'dijksrta' was not declared in this scope; did you mean 'dijkstra'?
42 | dijksrta(m, n, a, G1);
| ^~~~~~~~
| dijkstra
|
s698111304 | p00200 | 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
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
struct edge{
int to, cost, time;
edge(int to, int cost, int time) :to(to), cost(cost), time(time){};
};
int n, m, a, b, cost, time, k, s, g, f;
ll mincost[1000], mintime[1000];
vector<edge> G[1000];
void dijkstra0(int start){
fill(mincost, mincost + 1000, INF);
mincost[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mincost[e.to] > mincost[v] + e.cost){
mincost[e.to] = mincost[v] + e.cost;
que.push(P(mincost[e.to], e.to));
}
}
}
}
void dijkstra1(int start){
fill(mintime, mintime + 1000, INF);
mintime[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mintime[e.to] > mintime[v] + e.time){
mintime[e.to] = mintime[v] + e.time;
que.push(P(mintime[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n >> m&&n + m){
REP(i, n){
cin >> a >> b >> cost >> time;
G[a].push_back(edge(b, cost, time));
G[b].push_back(edge(a, cost, time));
}
cin >> k;
REP(i, k){
cin >> s >> g >> f;
if (f == 0){
dijkstra0(s);
cout << mincost[g] << endl;
}
else{
dijkstra1(s);
cout << mintime[g] << endl;
}
}
}
} | a.cc:39:23: error: 'int time' redeclared as different kind of entity
39 | int n, m, a, b, cost, time, k, s, g, f;
| ^~~~
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 'int main()':
a.cc:89:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
89 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
89 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s472051002 | p00200 | 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
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
struct edge{
int to, cost, time;
edge(int to, int cost, int time) :to(to), cost(cost), time(time){};
};
int n, m, a, b, cost, time, k, s, g, f;
ll mincost[1000], mintime[1000];
vector<edge> G[1000];
void dijkstra0(int start){
fill(mincost, mincost + 1000, INF);
mincost[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mincost[e.to] > mincost[v] + e.cost){
mincost[e.to] = mincost[v] + e.cost;
que.push(P(mincost[e.to], e.to));
}
}
}
}
void dijkstra1(int start){
fill(mintime, mintime + 1000, INF);
mintime[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mintime[e.to] > mintime[v] + e.time){
mintime[e.to] = mintime[v] + e.time;
que.push(P(mintime[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n >> m&&n + m){
REP(i, n){
cin >> a >> b >> cost >> time;
G[a].push_back(edge(b, cost, time));
G[b].push_back(edge(a, cost, time));
}
cin >> k;
REP(i, k){
cin >> s >> g >> f;
if (f == 0){
dijkstra0(s);
cout << mincost[g] << endl;
}
else{
dijkstra1(s);
cout << mintime[g] << endl;
}
}
}
} | a.cc:39:23: error: 'int time' redeclared as different kind of entity
39 | int n, m, a, b, cost, time, k, s, g, f;
| ^~~~
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 'int main()':
a.cc:89:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
89 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
89 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s739457239 | p00200 | 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
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
struct edge{
ll to, cost, time;
edge(ll to, ll cost, ll time) :to(to), cost(cost), time(time){};
};
ll n, m, a, b, cost, time, k, s, g, f;
ll mincost[1000], mintime[1000];
vector<edge> G[1000];
void dijkstra0(ll start){
fill(mincost, mincost + 1000, INF);
mincost[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mincost[e.to] > mincost[v] + e.cost){
mincost[e.to] = mincost[v] + e.cost;
que.push(P(mincost[e.to], e.to));
}
}
}
}
void dijkstra1(ll start){
fill(mintime, mintime + 1000, INF);
mintime[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mintime[e.to] > mintime[v] + e.time){
mintime[e.to] = mintime[v] + e.time;
que.push(P(mintime[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n >> m&&n + m){
REP(i, n){
cin >> a >> b >> cost >> time;
G[a].push_back(edge(b, cost, time));
G[b].push_back(edge(a, cost, time));
}
cin >> k;
REP(i, k){
cin >> s >> g >> f;
if (f == 0){
dijkstra0(s);
cout << mincost[g] << endl;
}
else{
dijkstra1(s);
cout << mintime[g] << endl;
}
}
}
} | a.cc:39:22: error: 'll time' redeclared as different kind of entity
39 | ll n, m, a, b, cost, time, k, s, g, f;
| ^~~~
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 'int main()':
a.cc:89:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
89 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
89 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s723974343 | p00200 | 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
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
struct edge{
ll to, cost, time;
edge(ll _to, ll _cost, ll _time) :to(_to), cost(_cost), time(_time){};
};
ll n, m, a, b, cost, time, k, s, g, f;
ll mincost[1000], mintime[1000];
vector<edge> G[1000];
void dijkstra0(ll start){
fill(mincost, mincost + 1000, INF);
mincost[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mincost[e.to] > mincost[v] + e.cost){
mincost[e.to] = mincost[v] + e.cost;
que.push(P(mincost[e.to], e.to));
}
}
}
}
void dijkstra1(ll start){
fill(mintime, mintime + 1000, INF);
mintime[start] = 0;
priority_queue<P> que;
que.push(P(0, start));
while (!que.empty()){
P p = que.top(); que.pop();
ll v = p.second;
if (mincost[v] < p.first)continue;
for (int i = 0; i < G[v].size(); i++){
edge e = G[v][i];
if (mintime[e.to] > mintime[v] + e.time){
mintime[e.to] = mintime[v] + e.time;
que.push(P(mintime[e.to], e.to));
}
}
}
}
int main(){
while (cin >> n >> m&&n + m){
REP(i, n){
cin >> a >> b >> cost >> time;
G[a].push_back(edge(b, cost, time));
G[b].push_back(edge(a, cost, time));
}
cin >> k;
REP(i, k){
cin >> s >> g >> f;
if (f == 0){
dijkstra0(s);
cout << mincost[g] << endl;
}
else{
dijkstra1(s);
cout << mintime[g] << endl;
}
}
}
} | a.cc:39:22: error: 'll time' redeclared as different kind of entity
39 | ll n, m, a, b, cost, time, k, s, g, f;
| ^~~~
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 'int main()':
a.cc:89:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
89 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
89 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
89 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s748002050 | p00200 | 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;
int dpt[111][111];
int dpc[111][111];
int n, m, a, b, cost, time, k, p, q, r;
int main(){
while (cin >> n >> m&&n + m){
REP(i, 111)REP(j, 111){
if (i == j){
dpt[i][j] = 0;
dpc[i][j] = 0;
}
else{
dpt[i][j] = INF;
dpc[i][j] = INF;
}
}
REP(i, n){
cin >> a >> b >> cost >> time;
dpt[a][b] = time;
dpt[b][a] = time;
dpc[a][b] = cost;
dpc[b][a] = cost;
}
FOR(i, 1, m + 1){
FOR(j, 1, m + 1){
FOR(k, 1, m + 1){
dpt[i][j] = min(dpt[i][j], dpt[i][k] + dpt[k][j]);
dpc[i][j] = min(dpc[i][j], dpc[i][k] + dpc[k][j]);
}
}
}
cin >> k;
REP(i, k){
cin >> p >> q >> r;
if (r == 0)cout << dpc[p][q] << endl;
else cout << dpt[p][q] << endl;
}
}
} | a.cc:39:23: error: 'int time' redeclared as different kind of entity
39 | int n, m, a, b, cost, time, k, p, q, r;
| ^~~~
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 'int main()':
a.cc:54:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
54 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
54 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s963643006 | p00200 | 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;
int dpt[111][111];
int dpc[111][111];
int n, m, a, b, cost, time, k, p, q, r;
int main(){
while (cin >> n >> m&&n + m){
REP(i, 111)REP(j, 111){
if (i == j){
dpt[i][j] = 0;
dpc[i][j] = 0;
}
else{
dpt[i][j] = INF;
dpc[i][j] = INF;
}
}
REP(i, n){
cin >> a >> b >> cost >> time;
dpt[a][b] = time;
dpt[b][a] = time;
dpc[a][b] = cost;
dpc[b][a] = cost;
}
FOR(i, 1, m + 1){
FOR(j, 1, m + 1){
FOR(k, 1, m + 1){
dpt[i][j] = min(dpt[i][j], dpt[i][k] + dpt[k][j]);
dpc[i][j] = min(dpc[i][j], dpc[i][k] + dpc[k][j]);
}
}
}
cin >> k;
REP(i, k){
cin >> p >> q >> r;
if (r == 0)cout << dpc[p][q] << endl;
else cout << dpt[p][q] << endl;
}
}
} | a.cc:39:23: error: 'int time' redeclared as different kind of entity
39 | int n, m, a, b, cost, time, k, p, q, r;
| ^~~~
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 'int main()':
a.cc:54:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
54 | cin >> a >> b >> cost >> time;
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
54 | cin >> a >> b >> cost >> time;
| ^~~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(short int)time' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(short unsigned int)time' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(int)time' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(unsigned int)time' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long int)time' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long unsigned int)time' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long long int)time' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:54:50: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive]
54 | cin >> a >> b >> cost >> time;
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:54:50: error: cannot bind rvalue '(long long unsigned int)time' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| |
s519569649 | p00200 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
const int INF = 1 << 25;
int cost[100][100], time[100][100];
int main() {
int n, m, query;
while (cin >> n >> m , n) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = (i == j) ? 0 : INF;
time[i][j] = (i == j) ? 0 : INF;
}
}
while (n--) {
int a, b, c, t;
cin >> a >> b >> c >> t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
for (int k = 0; k < m; k++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
cin >> query;
while (query--) {
int p, q, r;
cin >> p >> q >> r;
if (r == 0) {
cout << cost[p - 1][q - 1] << endl;
}
else {
cout << time[p - 1][q - 1] << endl;
}
}
}
} | a.cc:8:34: error: 'int time [100][100]' redeclared as different kind of entity
8 | int cost[100][100], time[100][100];
| ^
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 'int main()':
a.cc:17:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:17:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
17 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:17:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
17 | time[i][j] = (i == j) ? 0 : INF;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:25:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:25:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:25:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:25:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
25 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:25:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
25 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
a.cc:32:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:32:81: 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+'
32 | 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:45:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:45:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s214192895 | p00200 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1 << 25;
int cost[100][100], time[100][100];
int main() {
int n, m, query;
while (cin >> n >> m , n) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = (i == j) ? 0 : INF;
time[i][j] = (i == j) ? 0 : INF;
}
}
while (n--) {
int a, b, c, t;
cin >> a >> b >> c >> t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
for (int k = 0; k < m; k++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
cin >> query;
while (query--) {
int p, q, r;
cin >> p >> q >> r;
if (r == 0) {
cout << cost[p - 1][q - 1] << endl;
}
else {
cout << time[p - 1][q - 1] << endl;
}
}
}
} | a.cc:6:34: error: 'int time [100][100]' redeclared as different kind of entity
6 | int cost[100][100], time[100][100];
| ^
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 'int main()':
a.cc:15:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:15:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:15:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
15 | time[i][j] = (i == j) ? 0 : INF;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:23:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
a.cc:30:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:81: 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+'
30 | 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:43:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:43:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s199979821 | p00200 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1 << 25;
int cost[100][100], time[100][100];
int main() {
int n, m, query;
while (cin >> n >> m , n) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = (i == j) ? 0 : INF;
time[i][j] = (i == j) ? 0 : INF;
}
}
while (n--) {
int a, b, c, t;
cin >> a >> b >> c >> t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
for (int k = 0; k < m; k++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
cin >> query;
while (query--) {
int p, q, r;
cin >> p >> q >> r;
if (r == 0) {
cout << cost[p - 1][q - 1] << endl;
}
else {
cout << time[p - 1][q - 1] << endl;
}
}
}
} | a.cc:6:34: error: 'int time [100][100]' redeclared as different kind of entity
6 | int cost[100][100], time[100][100];
| ^
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 'int main()':
a.cc:15:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:15:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
15 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:15:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
15 | time[i][j] = (i == j) ? 0 : INF;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:23:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:23:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
23 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
a.cc:30:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:30:81: 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+'
30 | 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:43:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:43:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s738703017 | p00200 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
const int INF = 1 << 25;
int cost[100][100], time[100][100];
int main() {
int n, m, query;
while (cin >> n >> m , n) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = (i == j) ? 0 : INF;
time[i][j] = (i == j) ? 0 : INF;
}
}
while (n--) {
int a, b, c, t;
cin >> a >> b >> c >> t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
for (int k = 0; k < m; k++) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
cin >> query;
while (query--) {
int p, q, r;
cin >> p >> q >> r;
if (r == 0) {
cout << cost[p - 1][q - 1] << endl;
}
else {
cout << time[p - 1][q - 1] << endl;
}
}
}
} | a.cc:8:34: error: 'int time [100][100]' redeclared as different kind of entity
8 | int cost[100][100], time[100][100];
| ^
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 'int main()':
a.cc:16:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
16 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:16:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
16 | time[i][j] = (i == j) ? 0 : INF;
| ^
a.cc:16:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
16 | time[i][j] = (i == j) ? 0 : INF;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:24:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:24:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
24 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
a.cc:31:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:31:81: 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+'
31 | 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:44:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:44:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
44 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s059597980 | p00200 | C++ | #include <iostream>
#include <algorithm>
#define INF 1000000
using namespace std;
int cost[100][100];
int time[100][100];
int d[100];
int m;
void dcost(int s) {
bool used[100];
fill(used, used + 100, false);
fill(d, d + 100, INF);
d[s] = 0;
while (1) {
int v = -1;
for (int u = 0; u < m; ++u) {
if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
}
if (v == -1) break;
used[v] = true;
for (int u = 0; u < m; ++u) {
d[u] = d[u] < d[v] + cost[v][u] ? d[u] : d[v] + cost[v][u];
}
}
}
void dtime(int s) {
bool used[100];
fill(used, used + 100, false);
fill(d, d + 100, INF);
d[s] = 0;
while (1) {
int v = -1;
for (int u = 0; u < m; ++u) {
if (!used[u] && (v == -1 || d[u] < d[v])) v = u;
}
if (v == -1) break;
used[v] = true;
for (int u = 0; u < m; ++u) {
d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
}
}
}
int main() {
int n, k, a, b, p, q, r;
while (cin >> n >> m, !(n == 0 && m == 0)) {
fill(cost[0], cost[100], INF);
fill(time[0], time[100], INF);
while (n--) {
cin >> a >> b;
a--; b--;
cin >> cost[a][b] >> time[a][b];
cost[b][a] = cost[a][b];
time[b][a] = time[a][b];
}
cin >> k;
while (k--) {
cin >> p >> q >> r;
p--; q--;
if (r == 1) dtime(p);
else dcost(p);
cout << d[q] << endl;
}
}
return 0;
} | a.cc:6:18: error: 'int time [100][100]' redeclared as different kind of entity
6 | int time[100][100];
| ^
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 dtime(int)':
a.cc:43:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ^
a.cc:43:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ^
a.cc:43:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ~~~~~^~~~~~~~~~~~
a.cc:43:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ~~~~~^~~~~~~~~~~~~~~~~~~
a.cc:43:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ^
a.cc:43:82: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ^
a.cc:43:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ~~~~~^~~~~~~~~~~~
a.cc:43:57: error: operands to '?:' have different types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
43 | d[u] = d[u] < d[v] + time[v][u] ? d[u] : d[v] + time[v][u];
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:53:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | fill(time[0], time[100], INF);
| ^
a.cc:53:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | fill(time[0], time[100], INF);
| ^
a.cc:57:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | cin >> cost[a][b] >> time[a][b];
| ^
a.cc:57:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | cin >> cost[a][b] >> time[a][b];
| ^
a.cc:57:43: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:57:55: error: cannot bind rvalue '(short int)(time + (((sizetype)a) + ((sizetype)b)))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:57:55: error: cannot bind rvalue '(short unsigned int)(time + (((sizetype)a) + ((sizetype)b)))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:57:55: error: cannot bind rvalue '(int)(time + (((sizetype)a) + ((sizetype)b)))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:57:55: error: cannot bind rvalue '(unsigned int)(time + (((sizetype)a) + ((sizetype)b)))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:57:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
57 | cin >> cost[a][b] >> time[a][b];
| ~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:57:55: error: cannot bind rvalue '(long int)(time + (((sizetype)a) + ((sizetype)b)))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _T |
s000139996 | p00200 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int > P;
const int INF = 1 << 30;
int Dijkstra(int s,int g,int r);
int m,n;
int min_cost[2][111];
typedef struct{
vector<int>edge_to;
vector<int>edge_cost[2];
}Node_data;
Node_data Graph[111];
priority_queue<P ,vector< P >, greater< P > >que;
int main(){
int a,b,c,d,k;
int s,g,r;
while(1){
cin >> m >> n;
if(m == 0 && n == 0)break;
for(int i = 0;i < m;i++){
scanf("%d %d %d %d",&a,&b,&c,&d);
Graph[a - 1].edge_to.push_back(b - 1);
Graph[a - 1].edge_cost[0].push_back(c);
Graph[a - 1].edge_cost[1].push_back(d);
Graph[b - 1].edge_to.push_back(a - 1);
Graph[b - 1].edge_cost[0].push_back(c);
Graph[b - 1].edge_cost[1].push_back(d);
}
cin >> k;
for(int i = 0;i < k;i++){
cin >> s >> g >> r;
for(int j = 0;j < n;j++){
min_cost[r][j] = INF;
}
cout << Dijkstra(s - 1,g - 1,r) << endl;
}
}
return(0);
}
int Dijkstra(int s,int g,int r){
int node,cost;
int newnode,newcost;
min_cost[r][s] = 0;
P a;
a.first = 0;
a.second = s;
que.push(a);
while(!que.empty()){
node = que.top().second;
cost = que.top().first;
que.pop();
if(node == g)return cost;
if(cost > min_cost[r][node])continue;
for(int i = 0;i < Graph[node].edge_to.size();i++){
newnode = Graph[node].edge_to[i];
newcost = min_cost[node] + Graph[node].edge_cost[r][i];
if(min_cost[r][newnode] > newcost){
min_cost[r][newnode] = newcost;
a.first = newcost;
a.second = newnode;
que.push(a);
}
}
}
return -1;
} | a.cc: In function 'int Dijkstra(int, int, int)':
a.cc:65:32: error: invalid conversion from 'int*' to 'int' [-fpermissive]
65 | newcost = min_cost[node] + Graph[node].edge_cost[r][i];
|
s462032863 | p00200 | C++ | #include<iostream>
#include<vector>
using namespace std;
class NextNodesData
{
public:
int nextNodesName;
int nextNodesMany;
int nextNodesTime;
};
class Nodes
{
public:
vector<NextNodesData> nextNodes;
int name;
int minValue;
bool fixed;
};
int main()
{
int N, M;
cin >> N >> M;
vector<Nodes> nodesList;
for(int i = 0; i < M; i++)
{
Nodes nodes;
nodes.name = i+1;
nodesList.push_back(nodes);
}
for(int i = 0; i < N; i++)
{
int Start;
int End;
int Many;
int Time;
cin >> Start >> End >> Many >> Time;
NextNodesData nodes;
nodes.nextNodesName = End;
nodes.nextNodesMany = Many;
nodes.nextNodesTime = Time;
nodesList[Start - 1].nextNodes.push_back(nodes);
}
int Query;
cin >> Query;
for(int i = 0; i < Query; i++)
{
//???????????????
for(int j = 0; j < nodesList.size(); j++)
{
nodesList[j].fixed = false;
}
int Start;
int End;
int mode;
cin >> Start >> End;
cin >> mode;
if(Start == End)
{
cout << 0 << endl;
continue;
}
nodesList[Start - 1].fixed = true;
nodesList[Start - 1].minValue = 0;
int nextFixedNodesName = Start;
vector<Nodes> candidate;
while(1)
{
//??????????¢????????????°??????????´????????????????????????¨???????????????????????????
for(int j = 0; j < nodesList[nextFixedNodesName - 1].nextNodes.size(); j++)
{
Nodes obj;
obj.name = nodesList[nextFixedNodesName - 1].nextNodes[j].nextNodesName;
//??¢??????????????????????????????????????????????????????
if(nodesList[obj.name - 1].fixed == true)
{
continue;
}
if(mode == 0)
{
obj.minValue = nodesList[nextFixedNodesName - 1].minValue + nodesList[nextFixedNodesName - 1].nextNodes[j].nextNodesMany;
}
else
{
obj.minValue = nodesList[nextFixedNodesName - 1].minValue + nodesList[nextFixedNodesName - 1].nextNodes[j].nextNodesTime;
}
//?¬???????????????????????????????????????????
candidate.push_back(obj);
}
int minValue = 1001;
int minName = -1;
//?¬????????????????????£???????????°???????????????¢???
for(int j = 0; j < candidate.size(); j++)
{
if(candidate.size == 0)
{
cout << 0 << endl;
}
if(candidate[j].minValue < minValue)
{
minValue = candidate[j].minValue;
minName = candidate[j].name;
}
}
if(minName == End)
{
cout << minValue << endl;
break;
}
nodesList[minName - 1].minValue = minValue;
nodesList[minName - 1].fixed = true;
nextFixedNodesName = minName;
for(auto itr = candidate.begin(); itr != candidate.end();)
{
if(nodesList[itr->name - 1].fixed == true)
{
itr = candidate.erase(itr);
}
else
{
itr++;
}
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:107:46: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = Nodes; _Alloc = std::allocator<Nodes>; size_type = long unsigned int]' (did you forget the '()' ?)
107 | if(candidate.size == 0)
| ~~~~~~~~~~^~~~
| ()
|
s330562862 | p00200 | C++ | V\\\#include<stack>
#include<queue>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
static const int INFTY = (1 << 21);
int main(){
int n, m, a, b, cost, time;
int kk, p, q, r;
int sta_c[101][101];
int sta_t[101][101];
while (cin >> n >> m, n, m){
for (int i = 0; i < 101; i++){
for (int j = 0; j < 101; j++){
sta_c[i][j] = sta_t[i][j] = INFTY;
}
}
for (int i = 0; i < n; i++){
cin >> a >> b >> cost >> time;
sta_c[a][b] = cost; sta_c[b][a] = cost;
sta_t[a][b] = time; sta_t[b][a] = time;
}
for (int k = 1; k <= m; k++){
for (int i = 1; i <= m; i++){
if (sta_c[i][k] == INFTY) continue;
for (int j = 1; j <= m; j++){
if (sta_c[k][j] == INFTY) continue;
sta_c[i][j] = min(sta_c[i][j], sta_c[i][k] + sta_c[k][j]);
sta_t[i][j] = min(sta_t[i][j], sta_t[i][k] + sta_t[k][j]);
}
}
}
cin >> kk;
for (int i = 0; i < kk; i++){
cin >> p >> q >> r;
if (r == 0) cout << sta_c[p][q] << endl;
else cout << sta_t[p][q] << endl;
}
}
return 0;
} | a.cc:1:2: error: stray '\' in program
1 | V\\\#include<stack>
| ^
a.cc:1:3: error: stray '\' in program
1 | V\\\#include<stack>
| ^
a.cc:1:4: error: stray '\' in program
1 | V\\\#include<stack>
| ^
a.cc:1:5: error: stray '#' in program
1 | V\\\#include<stack>
| ^
a.cc:1:1: error: 'V' does not name a type
1 | V\\\#include<stack>
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/deque:62,
from /usr/include/c++/14/queue:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| |
s185979436 | p00200 | C++ | #include<iostream>
#include<string.h>
using namespace std;
int kingaku(void);
int saitan(void);
#define WHITE 0
#define GLAY 1
#define BLACK 2
#define INF 999999
int n; // ??????????????±?????°
int m; // ?§??????°
int p; // ????????°
int q; // ??°?????°
int minv;
int cost[100][100];
int time[100][100];
int dd[100],Flag[100];
int main()
{
int a,b,c,t,k,r;
while(1){
memset(cost,INF,sizeof(cost));
memset(time,INF,sizeof(time));
memset(Flag,0,sizeof(Flag));
cin >> n >> m;
if(n == 0 && m == 0) break;
for(int i=0;i<n;i++){
cin >> a >> b >> c >>t;
cost[a][b] = cost[b][a] = c;
time[a][b] = time[b][a] = t;
}
cin >> k;
for(int i=0;i<k;i++){
cin >> p >> q >> r;
if(r == 0)
cout << kingaku() << endl;
else if(r == 1)
cout << saitan() << endl;
//for(int i=1;i<=m;i++)
// cout << i << " " << dd[i] << endl;
}
}
return 0;
}
int kingaku()
{
int u;
int color[100];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(cost[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + cost[u][i]) //
//1?§? 1?§???¨??\?????????????§?
dd[i] = dd[u] + cost[u][i];
}
}
}
return dd[q];
}
int saitan()
{
int u;
int color[100];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(time[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + time[u][i])
dd[i] = dd[u] + time[u][i];
}
}
}
return dd[q];
} | a.cc:16:18: error: 'int time [100][100]' redeclared as different kind of entity
16 | int time[100][100];
| ^
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 'int main()':
a.cc:23:40: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ~^~~~~
a.cc:23:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included 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:31:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:41: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
31 | time[a][b] = time[b][a] = t;
| ~~~~~~~~~~~^~~
a.cc: In function 'int saitan()':
a.cc:97:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:97:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:97:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:98:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:98:61: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:98:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~
a.cc:98:42: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
98 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:99:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:99:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:99:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
a.cc:99:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
99 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s116270751 | p00200 | C++ | #include<iostream>
#include<string.h>
using namespace std;
int kingaku(void);
int saitan(void);
#define WHITE 0
#define GLAY 1
#define BLACK 2
#define INF 9999
int n; // ??????????????±?????°
int m; // ?§??????°
int p; // ????????°
int q; // ??°?????°
int minv;
int cost[100][100];
int time[100][100];
int dd[100],Flag[100];
int main()
{
int a,b,c,t,k,r;
while(1){
memset(cost,INF,sizeof(cost));
memset(time,INF,sizeof(time));
memset(Flag,0,sizeof(Flag));
cin >> n >> m;
if(n == 0 && m == 0) break;
for(int i=0;i<n;i++){
cin >> a >> b >> c >>t;
cost[a][b] = cost[b][a] = c;
time[a][b] = time[b][a] = t;
}
cin >> k;
for(int i=0;i<k;i++){
cin >> p >> q >> r;
if(r == 0)
cout << kingaku() << endl;
else if(r == 1)
cout << saitan() << endl;
//for(int i=1;i<=m;i++)
// cout << i << " " << dd[i] << endl;
}
}
return 0;
}
int kingaku()
{
int u;
int color[100];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(cost[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + cost[u][i]) //
//1?§? 1?§???¨??\?????????????§?
dd[i] = dd[u] + cost[u][i];
}
}
}
return dd[q];
}
int saitan()
{
int u;
int color[100];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(time[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + time[u][i])
dd[i] = dd[u] + time[u][i];
}
}
}
return dd[q];
} | a.cc:16:18: error: 'int time [100][100]' redeclared as different kind of entity
16 | int time[100][100];
| ^
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 'int main()':
a.cc:23:40: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ~^~~~~
a.cc:23:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included 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:31:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
31 | time[a][b] = time[b][a] = t;
| ^
a.cc:31:41: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
31 | time[a][b] = time[b][a] = t;
| ~~~~~~~~~~~^~~
a.cc: In function 'int saitan()':
a.cc:97:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:97:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:97:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
97 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:98:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:98:61: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:98:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
98 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~
a.cc:98:42: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
98 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:99:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:99:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:99:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
99 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
a.cc:99:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
99 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s200588800 | p00200 | C++ | #include<iostream>
#include<string.h>
using namespace std;
int kingaku(void);
int saitan(void);
#define WHITE 0
#define GLAY 1
#define BLACK 2
#define INF 9999
int n; // ??????????????±?????°
int m; // ?§??????°
int p; // ????????°
int q; // ??°?????°
int minv;
int cost[101][101];
int time[101][101];
int dd[101];
int main()
{
int a,b,c,t,k,r;
while(1){
memset(cost,INF,sizeof(cost));
memset(time,INF,sizeof(time));
cin >> n >> m;
if(n == 0 && m == 0) break;
for(int i=0;i<n;i++){
cin >> a >> b >> c >>t;
cost[a][b] = cost[b][a] = c;
time[a][b] = time[b][a] = t;
}
cin >> k;
for(int i=0;i<k;i++){
cin >> p >> q >> r;
if(r == 0)
cout << kingaku() << endl;
else if(r == 1)
cout << saitan() << endl;
//for(int i=1;i<=m;i++)
// cout << i << " " << dd[i] << endl;
}
}
return 0;
}
int kingaku()
{
int u;
int color[101];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(cost[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + cost[u][i]) //
//1?§? 1?§???¨??\?????????????§?
dd[i] = dd[u] + cost[u][i];
}
}
}
return dd[q];
}
int saitan()
{
int u;
int color[101];
memset(dd,INF,sizeof(dd));
memset(color,WHITE,sizeof(color));
dd[p] = 0;
color[p] = GLAY;
while(1){
u = -1;
minv = INF;
for(int i=1;i<=m;i++){
if(minv > dd[i] && color[i] != BLACK){
minv = dd[i];
u = i;
}
}
if(u==-1) break;
color[u] = BLACK;
for(int i=1;i<=m;i++){
if(time[u][i] != INF && color[i] != BLACK){
if(dd[i] > dd[u] + time[u][i])
dd[i] = dd[u] + time[u][i];
}
}
}
return dd[q];
} | a.cc:16:18: error: 'int time [101][101]' redeclared as different kind of entity
16 | int time[101][101];
| ^
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 'int main()':
a.cc:23:40: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ~^~~~~
a.cc:23:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
23 | memset(time,INF,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included 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:29:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | time[a][b] = time[b][a] = t;
| ^
a.cc:29:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | time[a][b] = time[b][a] = t;
| ^
a.cc:29:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | time[a][b] = time[b][a] = t;
| ^
a.cc:29:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
29 | time[a][b] = time[b][a] = t;
| ^
a.cc:29:41: error: assignment of read-only location '*(time + (((sizetype)b) + ((sizetype)a)))'
29 | time[a][b] = time[b][a] = t;
| ~~~~~~~~~~~^~~
a.cc: In function 'int saitan()':
a.cc:95:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
95 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:95:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
95 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:95:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
95 | if(time[u][i] != INF && color[i] != BLACK){
| ^
a.cc:96:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
96 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:96:61: warning: pointer to a function used in arithmetic [-Wpointer-arith]
96 | if(dd[i] > dd[u] + time[u][i])
| ^
a.cc:96:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
96 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~
a.cc:96:42: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
96 | if(dd[i] > dd[u] + time[u][i])
| ~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:97:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:97:66: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | dd[i] = dd[u] + time[u][i];
| ^
a.cc:97:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
a.cc:97:55: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
97 | dd[i] = dd[u] + time[u][i];
| ~~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s821514552 | p00200 | C++ | #include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#define REP(i,a) for(int i=0;i<a;i++)
int A[101][101];
int B[101][101];
int main(){
int a,b=0,c=0,d,n,m;
cin>>n>>m;
while(n!=0||m!=0){
REP(i,m){
REP(j,m){
A[i][j]=1001;
B[i][j]=1001;
}
}
REP(i,n){
cin>>a>>b>>c>>d;
A[a-1][b-1]=c;
B[a-1][b-1]=d;
A[b-1][a-1]=c;
B[b-1][a-1]=d;
}
REP(k,m){
REP(i,m){
if(i==j) continue;
REP(j,m){
A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
A[j][i]=A[i][j];
B[j][i]=B[i][j];
}
}
}
cin>>n;
REP(i,n){
cin>>a>>b>>c;
if(c==0) cout<<A[a-1][b-1]<<endl;
else cout<<B[a-1][b-1]<<endl;
}
cin>>n>>m;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:27:23: error: 'j' was not declared in this scope
27 | if(i==j) continue;
| ^
|
s601356885 | p00200 | C++ | #include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#define REP(i,a) for(int i=0;i<a;i++)
int A[101][101];
int B[101][101];
int main(){
int a,b=0,c=0,d,n,m;
cin>>n>>m;
while(n!=0||m!=0){
REP(i,m){
REP(j,m){
A[i][j]=1001;
B[i][j]=1001;
}
}
REP(i,n){
cin>>a>>b>>c>>d;
A[a-1][b-1]=c;
B[a-1][b-1]=d;
A[b-1][a-1]=c;
B[b-1][a-1]=d;
}
REP(k,m){
REP(i,m){
if(i==k) continue;
REP(k,m){
A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
A[j][i]=A[i][j];
B[j][i]=B[i][j];
}
}
}
cin>>n;
REP(i,n){
cin>>a>>b>>c;
if(c==0) cout<<A[a-1][b-1]<<endl;
else cout<<B[a-1][b-1]<<endl;
}
cin>>n>>m;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:22: error: 'j' was not declared in this scope
29 | A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
| ^
|
s343965509 | p00200 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#define M 1000000000
using namespace std;
void Warshall_Floyd();
void GYORETU();
int cc[1001][1001],ti[1001][1001];
int n,m,a,b,cost,time,;
int main(void)
{
while(1) {
scanf("%d %d",&n,&m);
if(n==0&&m==0) break;
GYORETU();
Warshall_Floyd();
int s,g,w,kk;
scanf("%d",&kk);
for(int i=0;i<kk;i++) {
scanf("%d %d %d",&s,&g,&w);
if(w==0) printf("%d\n",cc[s-1][g-1]);
else printf("%d\n",ti[s-1][g-1]);
}
}
}
void GYORETU()
{
for(int i=0;i<m;i++) {
for(int j=0;j<m;j++) {
cc[i][j]=M;
ti[i][j]=M;
}
}
for(int i=0;i<m;i++) {
cc[i][i]=0;
ti[i][i]=0;
}
for(int i=0;i<n;i++) {
scanf("%d %d %d %d",&a,&b,&cost,&time);
cc[a][b]=cost;
cc[b][a]=cost;
ti[a][b]=time;
ti[b][a]=time;
}
}
void Warshall_Floyd()
{
for(int k=0;k<m;k++) {
for(int i=0;i<m;i++) {
for(int j=0;j<m;j++) {
cc[i][j]=min(cc[i][j],cc[i][k]+cc[k][j]);
}
}
}
for(int k=0;k<m;k++) {
for(int i=0;i<m;i++) {
for(int j=0;j<m;j++) {
ti[i][j]=min(ti[i][j],ti[i][k]+ti[k][j]);
}
}
}
}
| a.cc:10:23: error: expected unqualified-id before ';' token
10 | int n,m,a,b,cost,time,;
| ^
|
s329335026 | p00200 | C++ | #include<iostream>
#include<vector>
#include<string>
#define int long long
using namespace std;
signed main() {
int a, b;
while (cin >>b>>a, a | b) {
vector<vector<int>>cost(a, vector<int>(a, INT_MAX));
vector<vector<int>>time(a, vector<int>(a, INT_MAX));
for (int c = 0; c < b; c++) {
int d, e, f, g;
cin >> d >> e >> f >> g;
d--; e--;
cost[d][e] = cost[e][d] = f;
time[d][e] = time[e][d] = g;
}
for (auto j : cost) {
for (int i : j)cout << i << " ";
cout << endl;
}
for (int h = 0; h < a; h++) {
for (int i = 0; i < a; i++) {
for (int j = 0; j < a; j++) {
if (i == j)cost[i][j] = time[i][j] = 0;
else {
cost[i][j] = (cost[i][j] < cost[i][h] + cost[h][j]) ? (cost[i][j]) : (cost[i][h] + cost[h][j]);
time[i][j] = (time[i][j] < time[i][h] + time[h][j]) ? (time[i][j]) : (time[i][h] + time[h][j]);
}
}
}
}
for (auto j : cost) {
for (int i : j)cout << i << " ";
cout << endl;
}
int l;
cin >> l;
for (int r = 0; r < l; r++) {
int x, y, z;
cin >> x >> y >> z;
x--; y--;
if (z) { cout << time[x][y] << endl; }
else { cout << cost[x][y] << endl; }
}
}
} | a.cc: In function 'int main()':
a.cc:10:59: error: 'INT_MAX' was not declared in this scope
10 | vector<vector<int>>cost(a, vector<int>(a, INT_MAX));
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include<vector>
+++ |+#include <climits>
3 | #include<string>
|
s930591833 | p00200 | C++ | #include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;
const int INF = 100 * 1000 + 2;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;
int n, m, a, b, c, t;
int k, p, q, r;
int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };
int main()
{
scanf_s("%d %d", &m, &n);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
wfc[i][j] = INF; wft[i][j] = INF;
}
}
for (int i = 0; i < m; ++i) {
scanf_s("%d %d %d %d", &a, &b, &c, &t);
wft[a - 1][b - 1] = t; wft[b - 1][a - 1] = t;
wfc[a - 1][b - 1] = c; wfc[b - 1][a - 1] = c;
}
for (int k = 0; k < n; ++k) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
}
}
}
scanf_s("%d", &k);
int ans = 0;
for (int i = 0; i < k; ++i){
scanf_s("%d %d %d", &p, &q, &r);
if (p == 0 && q == 0) break;
if (r == 0) { ans = wfc[p - 1][q - 1]; }
else { ans = wft[p - 1][q - 1]; }
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
28 | scanf_s("%d %d", &m, &n);
| ^~~~~~~
| scanf
|
s401602274 | p00200 | C++ | #include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;
const int INF = INT16_MAX;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;
int n, m, a, b, c, t;
int k, p, q, r;
int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };
int main()
{
scanf_s("%d %d", &n, &m);
for (int i = 0; i < m; ++i) {
for (int j = 0; j < m; ++j) {
wfc[i][j] = INF; wft[i][j] = INF;
}
}
for (int i = 0; i < n; ++i) {
scanf_s("%d %d %d %d", &a, &b, &c, &t);
wft[a - 1][b - 1] = t; wft[b - 1][a - 1] = t;
wfc[a - 1][b - 1] = c; wfc[b - 1][a - 1] = c;
}
for (int k = 0; k < m; ++k) {
for (int i = 0; i < m; ++i) {
for (int j = 0; j < m; ++j) {
if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
}
}
}
scanf_s("%d", &k);
int ans = 0;
for (int i = 0; i < k; ++i){
scanf_s("%d %d %d", &p, &q, &r);
if (p == 0 && q == 0) break;
if (r == 0) { ans = wfc[p - 1][q - 1]; }
else { ans = wft[p - 1][q - 1]; }
printf("%d\n", ans);
}
} | a.cc:14:17: error: 'INT16_MAX' was not declared in this scope
14 | const int INF = INT16_MAX;
| ^~~~~~~~~
a.cc:10:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
9 | #include <functional>
+++ |+#include <cstdint>
10 | #include <time.h>
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
28 | scanf_s("%d %d", &n, &m);
| ^~~~~~~
| scanf
|
s602470769 | p00200 | C++ | #include<stdio.h>
#include<algorithm>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <functional>
#include <time.h>
using namespace std;
clock_t fi, endtime;
const int INF = INT16_MAX;
const int r_c = 0;
const int r_t = 1;
const int MAX_V = 100;
const int MAX_E = 6000;
int n, m, a, b, c, t;
int k, p, q, r;
int wft[MAX_V][MAX_V] = { 0 };
int wfc[MAX_V][MAX_V] = { 0 };
int main()
{
scanf("%d %d", &n, &m);
for (int i = 0; i < m; ++i) {
for (int j = 0; j < m; ++j) {
wfc[i][j] = INF; wft[i][j] = INF;
}
}
for (int i = 0; i < n; ++i) {
scanf("%d %d %d %d", &a, &b, &c, &t);
wft[a - 1][b - 1] = t; wft[b - 1][a - 1] = t;
wfc[a - 1][b - 1] = c; wfc[b - 1][a - 1] = c;
}
for (int k = 0; k < m; ++k) {
for (int i = 0; i < m; ++i) {
for (int j = 0; j < m; ++j) {
if (wft[i][j] > wft[i][k] + wft[k][j]) { wft[i][j] = wft[i][k] + wft[k][j]; }
if (wfc[i][j] > wfc[i][k] + wfc[k][j]) { wfc[i][j] = wfc[i][k] + wfc[k][j]; }
}
}
}
scanf("%d", &k);
int ans = 0;
for (int i = 0; i < k; ++i){
scanf("%d %d %d", &p, &q, &r);
if (p == 0 && q == 0) break;
if (r == 0) { ans = wfc[p - 1][q - 1]; }
else { ans = wft[p - 1][q - 1]; }
printf("%d\n", ans);
}
} | a.cc:14:17: error: 'INT16_MAX' was not declared in this scope
14 | const int INF = INT16_MAX;
| ^~~~~~~~~
a.cc:10:1: note: 'INT16_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
9 | #include <functional>
+++ |+#include <cstdint>
10 | #include <time.h>
|
s913150660 | p00200 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 1010001000
#define loop(i, n) for (int i = 1; i < n; i++)
int main()
{
int n, m; cin >> n >> m; m++;
vector<vector<int> > time(m,vector<int>(m,INF)), cost(m,vector<int>(m,INF));
loop(i, n+1){
int a,b,c,t; cin>>a>>b>>c>>t;
time[a][b]=t;time[b][a]=t;
cost[a][b]=c;cost[b][a]=c;
}
loop(k, m){loop(i, m){loop(i, m){
time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
}}}
int k; cin>>k;
loop(i, k+1){
int p,q,r; cin>>p>>q>>r;
if(r) cout<<time[p][q]<<endl;
else cout<<cost[p][q]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'j' was not declared in this scope
18 | time[i][j]=min(time[i][j],time[i][k]+time[k][j]);
| ^
|
s228265477 | p00200 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<s;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int,int> pii;
#define MAX 99999999
signed main(){
while(1){
int n,m;
cin>>n>>m;
if(!(n+m))break;
vector<vector<pii>>v(n+1,vector<pii>(n+1,pii(INF,INF)));
rep(i,n+1)v[i][i]=pii(0,0?\);
rep(i,n){
pii temp;
int s,g;
cin>>s>>g>>temp.first>>temp.second;
v[--s][--g]=temp;
}
rep(k,m){
rep(i,m){
rep(j,m){
v[i][j].first=min(v[i][k].first+v[k][j].first,v[i][j].first);
v[i][j].second=min(v[i][k].second+v[k][j].second,v[i][j].second);
}
}
}
int k; cin>>k;
rep(i,k){
int s,g,r; cin>>s>>g>>r;
if(!r)cout<<v[--s][--g].first<<endl;
else cout<<v[--s][--g].second<<endl;
}
}
}
| a.cc:37:35: error: stray '\' in program
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc: In function 'int main()':
a.cc:37:30: error: expected primary-expression before '(' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc:37:36: error: expected primary-expression before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc:37:35: error: expected ':' before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^~
| :
a.cc:37:36: error: expected primary-expression before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
|
s766924906 | p00200 | C++ | #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<s;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int,int> pii;
#define MAX 99999999
signed main(){
while(1){
int n,m;
cin>>n>>m;
if(!(n+m))break;
vector<vector<pii>>v(n+1,vector<pii>(n+1,pii(INF,INF)));
rep(i,n+1)v[i][i]=pii(0,0?\);
rep(i,n){
pii temp;
int s,g;
cin>>s>>g>>temp.first>>temp.second;
v[--s][--g]=temp;
}
rep(k,m){
rep(i,m){
rep(j,m){
v[i][j].first=min(v[i][k].first+v[k][j].first,v[i][j].first);
v[i][j].second=min(v[i][k].second+v[k][j].second,v[i][j].second);
}
}
}
int k; cin>>k;
rep(i,k){
int s,g,r; cin>>s>>g>>r;
if(!r)cout<<v[--s][--g].first<<endl;
else cout<<v[--s][--g].second<<endl;
}
}
}
| a.cc:37:35: error: stray '\' in program
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc: In function 'int main()':
a.cc:37:30: error: expected primary-expression before '(' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc:37:36: error: expected primary-expression before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
a.cc:37:35: error: expected ':' before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^~
| :
a.cc:37:36: error: expected primary-expression before ')' token
37 | rep(i,n+1)v[i][i]=pii(0,0?\);
| ^
|
s625487132 | p00200 | C++ | #define NODE 0
#define WEIGHT 1
#define COST_IDX 0
#define TIME_IDX 1
#define P_IDX 0
#define Q_IDX 1
#define R_IDX 2
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int n, m, k;
int weights[101][101][2];
int requests[200][3];
bool read_input() {
cin >> n >> m;
if (n*m == 0)
return false;
memset(weights, 0, sizeof(int)*101*101*2);
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
weights[a][b][COST_IDX] = weights[b][a][COST_IDX] = c;
weights[a][b][TIME_IDX] = weights[b][a][TIME_IDX] = t;
}
cin >> k;
for (int i = 0; i < k; i++) {
cin >> requests[i][P_IDX] >> requests[i][Q_IDX] >> requests[i][R_IDX];
}
return true;
}
int resolve_request(int i_th) {
int p, q, r;
p = requests[i_th][P_IDX];
q = requests[i_th][Q_IDX];
r = requests[i_th][R_IDX];
int weight_sum_map[101];
int in_queue[101] = {}; // set all to 0
memset(weight_sum_map, -1, sizeof(int)*101);
/* starting node has weight_sum of 0 */
weight_sum_map[p] = 0;
in_queue[p] = 1;
int current_node = p; // first in queue is p
while (current_node != q) {
int weight_sum = weight_sum_map[current_node];
in_queue[current_node] = 0;
for (int i = 1; i < 101; i++) {
if (!weights[current_node][i][r])
continue;
int adj_node = i;
int w = weights[current_node][adj_node][r];
int new_weight_sum = weight_sum + w;
if (weight_sum_map[adj_node] == -1 || new_weight_sum < weight_sum_map[adj_node]) {
weight_sum_map[adj_node] = new_weight_sum;
in_queue[adj_node] = 1;
}
}
int min_sum = -1;
for (int i = 1; i < 101; i++) {
if (in_queue[i] && (min_sum == -1 || weight_sum_map[i] < min_sum)) {
min_sum = weight_sum_map[i];
current_node = i;
}
}
}
return weight_sum_map[q];
}
void solve() {
for (int i = 0; i < k; i++)
cout << resolve_request(i) << endl;
}
int main() {
while(read_input()) {
solve();
}
return 0;
} | a.cc: In function 'bool read_input()':
a.cc:21:3: error: 'memset' was not declared in this scope
21 | memset(weights, 0, sizeof(int)*101*101*2);
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <queue>
+++ |+#include <cstring>
10 | #include <vector>
a.cc: In function 'int resolve_request(int)':
a.cc:43:3: error: 'memset' was not declared in this scope
43 | memset(weight_sum_map, -1, sizeof(int)*101);
| ^~~~~~
a.cc:43:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s524131505 | p00200 | C++ | #define NODE 0
#define WEIGHT 1
#define COST_IDX 0
#define TIME_IDX 1
#define P_IDX 0
#define Q_IDX 1
#define R_IDX 2
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int n, m, k;
int weights[101][101][2];
int min_w[101][101][2];
int requests[200][3];
bool read_input() {
cin >> n >> m;
if (n*m == 0)
return false;
memset(weights, 0, sizeof(int)*101*101*2);
memset(min_w, 0, sizeof(int)*101*101*2);
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
weights[a][b][COST_IDX] = weights[b][a][COST_IDX] = c;
weights[a][b][TIME_IDX] = weights[b][a][TIME_IDX] = t;
}
cin >> k;
for (int i = 0; i < k; i++) {
cin >> requests[i][P_IDX] >> requests[i][Q_IDX] >> requests[i][R_IDX];
}
return true;
}
int resolve_request(int i_th) {
int p, q, r;
p = requests[i_th][P_IDX];
q = requests[i_th][Q_IDX];
r = requests[i_th][R_IDX];
if (min_w[p][q][r])
return min_w[p][q][r];
int weight_sum_map[101];
int in_queue[101] = {}; // set all to 0
memset(weight_sum_map, -1, sizeof(int)*101);
/* starting node has weight_sum of 0 */
weight_sum_map[p] = 0;
in_queue[p] = 1;
int current_node = p; // first in queue is p
while (current_node != q) {
int weight_sum = weight_sum_map[current_node];
in_queue[current_node] = 0;
min_w[p][current_node][r] = weight_sum;
for (int i = 1; i < 101; i++) {
if (!weights[current_node][i][r])
continue;
int adj_node = i;
int w = weights[current_node][adj_node][r];
int new_weight_sum = weight_sum + w;
if (weight_sum_map[adj_node] == -1 || new_weight_sum < weight_sum_map[adj_node]) {
weight_sum_map[adj_node] = new_weight_sum;
in_queue[adj_node] = 1;
}
}
int min_sum = -1;
for (int i = 1; i < 101; i++) {
if (in_queue[i] && (min_sum == -1 || weight_sum_map[i] < min_sum)) {
min_sum = weight_sum_map[i];
current_node = i;
}
}
}
return weight_sum_map[q];
}
void solve() {
for (int i = 0; i < k; i++)
cout << resolve_request(i) << endl;
}
int main() {
while(read_input()) {
solve();
}
return 0;
} | a.cc: In function 'bool read_input()':
a.cc:22:3: error: 'memset' was not declared in this scope
22 | memset(weights, 0, sizeof(int)*101*101*2);
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <queue>
+++ |+#include <cstring>
10 | #include <vector>
a.cc: In function 'int resolve_request(int)':
a.cc:48:3: error: 'memset' was not declared in this scope
48 | memset(weight_sum_map, -1, sizeof(int)*101);
| ^~~~~~
a.cc:48:3: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s363405484 | p00200 | C++ | #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
int m,n;
while(cin>>m>>n,n){
int a1[n][n],a2[n][n],q,w,e,r;
r(i,n)r(j,n){
if(i==j)a2[i][j]=a1[i][j]=0;
else a2[i][j]=a1[i][j]=INF;
}
while(m--){
scanf("%d%d%d%d",&q,&w,&e,&r)q--;w--;
a1[q][w]=e;
a2[q][w]=r;
}
r(k,n)r(i,n)r(j,n){
a1[i][j]=min(a1[i][j],a1[i][k]+a1[k][j]);
a2[i][j]=min(a2[i][j],a2[i][k]+a2[k][j]);
}
cin>>e;
while(e--){
scanf("%d%d%d",&q,&w,&e);q--;w--;
if(r)cout<<a2[w][q]<<endl;
else cout<<a1[w][q]<<endl;
}
}
} | a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:14:36: error: expected ';' before 'q'
14 | scanf("%d%d%d%d",&q,&w,&e,&r)q--;w--;
| ^
| ;
|
s003364490 | p00200 | C++ | #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
int m,n;
while(cin>>m>>n,n){
int a1[n][n],a2[n][n],q,w,e,r;
r(i,n)r(j,n){
if(i==j)a2[i][j]=a1[i][j]=0;
else a2[i][j]=a1[i][j]=INF;
}
while(m--){
scanf("%d%d%d%d",&q,&w,&e,&r);q--;w--;
a1[q][w]=a1[w][q]=e;
a2[q][w]=a2[w][q]=r;
}
r(k,n)r(i,n)r(j,n){
a1[i][j]=min(a1[i][j],a1[i][k]+a1[k][j]);
a2[i][j]=min(a2[i][j],a2[i][k]+a2[k][j]);
}
cin>>e;
while(e--){
scanf("%d%d%d",&q,&w,&r)q--;w--;
if(r)cout<<a2[q][w]<<endl;
else cout<<a1[q][w]<<endl;
}
}
} | a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:24:31: error: expected ';' before 'q'
24 | scanf("%d%d%d",&q,&w,&r)q--;w--;
| ^
| ;
|
s883308565 | p00200 | C++ | #include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
#define INF 1<<29
using namespace std;
main(){
int m,n;
while(cin>>m>>n,n){
int a1[n][n],a2[n][n],q,w,e,r;
r(i,0,n)r(j,0,n){
if(i==j)a2[i][j]=a1[i][j]=0;
else a2[i][j]=a1[i][j]=INF;
}
while(m--){
scanf("%d%d%d%d",&q,&w,&e,&r);q--;w--;
a1[q][w]=a1[w][q]=e;
a2[q][w]=a2[w][q]=r;
}
r(k,0,n)r(i,0,n)r(j,i+1,n){
a1[i][j]=a[j][i]=min(a1[i][j],a1[i][k]+a1[k][j]);
a2[i][j]=a[j][i]=min(a2[i][j],a2[i][k]+a2[k][j]);
}
cin>>e;
while(e--){
scanf("%d%d%d",&q,&w,&r);q--;w--;
if(r)cout<<a2[q][w]<<endl;
else cout<<a1[q][w]<<endl;
}
}
} | a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:19:16: error: 'a' was not declared in this scope
19 | a1[i][j]=a[j][i]=min(a1[i][j],a1[i][k]+a1[k][j]);
| ^
|
s435159727 | p00200 | C++ | #define _USE_MATH_DEFINES
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#define INF 10000000
using namespace std;
typedef long long ll;
int cost[110][110];
int time[110][110];
int main(void)
{
while (1) {
int n, m;
cin >> n >> m;
if (n == 0 && m == 0)break;
for (int i = 0; i < m; i++) {
for (int j = 0; j < m; j++) {
if (i == j) {
cost[i][j] = 0;
time[i][j] = 0;
}
else {
cost[i][j] = INF;
time[i][j] = INF;
}
}
}
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
for (int k = 0; k < m; k++) {
for (int j = 0; j < m; j++) {
for (int i = 0; i < m; i++) {
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
int k;
cin >> k;
for (int i = 0; i < k; i++) {
int p, q, r;
cin >> p >> q >> r;
if (r == 0)
cout << cost[p - 1][q - 1] << endl;
else if (r == 1)
cout << time[p - 1][q - 1] << endl;
}
}
return 0;
} | a.cc:18:18: error: 'int time [110][110]' redeclared as different kind of entity
18 | int time[110][110];
| ^
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:3:
/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 'int main()':
a.cc:32:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = 0;
| ^
a.cc:32:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[i][j] = 0;
| ^
a.cc:32:52: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
32 | time[i][j] = 0;
| ~~~~~~~~~~~^~~
a.cc:36:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
36 | time[i][j] = INF;
| ^
a.cc:36:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
36 | time[i][j] = INF;
| ^
a.cc:36:52: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
36 | time[i][j] = INF;
| ^
a.cc:45:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:45:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:45:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:45:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
45 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:45:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
45 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
a.cc:52:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:64: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:67: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:76: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:79: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:89: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:92: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:52:81: 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+'
52 | 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:64:51: warning: pointer to a function used in arithmetic [-Wpointer-arith]
64 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:64:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
64 | cout << time[p - 1][q - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s873426542 | p00200 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <queue>
#include <functional>
#define N 101
#define INF 2000000000
using namespace std;
int dist[N];
typedef pair<int,int> pii;
std::vector<pii> e1[N];
std::vector<pii> e2[N];
int dijk1(int a,int b){
dist[a]=0;
std::priority_queue<pii> pq;
for(int i=0;i<e2[a].size();i++){
pq.push(e2[a][i]);
}
while(!pq.empty()){
pii temp=pq.top();
int now=temp.second;
int c=temp.first;
pq.pop();
if(dist[now]!=INF)continue;
dist[now]=-c;
if(now==b)break;
for(int i=0;i<e2[now].size();i++){
pq.push(make_pair(c+e2[now][i].first,e2[now][i].second));
}
}
return dist[b];
}
int dijk(int a,int b){
dist[a]=0;
std::priority_queue<pii> pq;
for(int i=0;i<e1[a].size();i++){
pq.push(e1[a][i]);
}
while(!pq.empty()){
pii temp=pq.top();
int now=temp.second;
int c=temp.first;
pq.pop();
if(dist[now]!=INF)continue;
dist[now]=-c;
if(now==b)break;
for(int i=0;i<e1[now].size();i++){
pq.push(make_pair(c+e1[now][i].first,e1[now][i].second));
}
}
return dist[b];
}
int main(void){
int a,b,c,d;
int n,m;
while(cin>>n>>m,n||m){
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
e1[b].push_back(make_pair(-c,a);
e1[a].push_back(make_pair(-c,b));
e2[a].push_back(make_pair(-d,b));
e2[b].push_back(make_pair(-d,a);
}
int k;
cin>>k;
while(k--){
for(int i=1;i<=m;i++)dist[i]=INF;
cin>>a>>b>>c;
if(c) cout<<dijk1(a,b)<<endl;
else cout<<dijk(a,b)<<endl;
// for(int i=1;i<=m;i++)printf("dist[%d]:%d\n",i,dist[i]);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:65:32: error: expected ')' before ';' token
65 | e1[b].push_back(make_pair(-c,a);
| ~ ^
| )
a.cc:68:32: error: expected ')' before ';' token
68 | e2[b].push_back(make_pair(-d,a);
| ~ ^
| )
|
s256238289 | p00200 | C++ | #include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;
int n, m;
int k;
int cost[100][100];
int time[100][100];
int main()
{
memset(cost, 0x0f, sizeof cost);
memset(time, 0x0f, sizeof time);
cin >> n >> m;
for (int i = 0; i < n; ++i)
{
int a, b, cost_, time_;
cin >> a >> b >> cost_ >> time_;
cost[a - 1][b - 1] = cost_;
cost[b - 1][a - 1] = cost_;
time[a - 1][b - 1] = time_;
time[b - 1][a - 1] = time_;
}
for (int k = 0; k < m; ++k)
{
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < m; ++j)
{
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
}
}
}
for (int k = 0; k < m; ++k)
{
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < m; ++j)
{
time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
}
}
}
cin >> k;
for (int i = 0; i < k; ++i)
{
int p, q, r;
cin >> q >> p >> r;
if (r == 0)
{
cout << cost[q - 1][p - 1] << endl;
}
else
{
cout << time[q - 1][p - 1] << endl;
}
}
} | a.cc:10:18: error: 'int time [100][100]' redeclared as different kind of entity
10 | int time[100][100];
| ^
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 'int main()':
a.cc:14:9: error: 'memset' was not declared in this scope
14 | memset(cost, 0x0f, sizeof cost);
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <functional>
+++ |+#include <cstring>
5 | using namespace std;
a.cc:15:35: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
15 | memset(time, 0x0f, sizeof time);
| ^~~~
a.cc:26:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | time[a - 1][b - 1] = time_;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
26 | time[a - 1][b - 1] = time_;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:26:36: error: assignment of read-only location '*(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))'
26 | time[a - 1][b - 1] = time_;
| ~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:27:27: warning: pointer to a function used in arithmetic [-Wpointer-arith]
27 | time[b - 1][a - 1] = time_;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:27:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
27 | time[b - 1][a - 1] = time_;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:27:36: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
27 | time[b - 1][a - 1] = time_;
| ~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:46:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:68: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:81: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:84: warning: pointer to a function used in arithmetic [-Wpointer-arith]
46 | time[i][j] = min(time[i][j], time[i][k] + time[k][j]);
| ^
a.cc:46:73: 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+'
46 | 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:62:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
62 | cout << time[q - 1][p - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:62:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
62 | cout << time[q - 1][p - 1] << endl;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
|
s340275396 | p00200 | C++ | #include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
#define MIN(a, b) ((a)<(b)?(a):(b))
#define MAX(a, b) ((a)<(b)?(a):(b))
#define INF 10e6
using namespace std;
/*temp*/
int main(){
int n, m, l;
while(cin>>m>>n,n){
int cost[n][n],time[n][n];
// set table
REP(i,n){
REP(j,n){
cost[i][j]=time[i][j]=INF;
}
cost[i][i]=time[i][i]=0;
}
// read
REP(i,n){
int a,b,c,t;
a--;
b--;
cost[a][b]=cost[b][a]=MIN(c,cost[a][b]);
time[a][b]=time[b][a]=MIN(t,time[a][b]);
}
// Warshall???Floyd Algorithm
REP(a,n){
REP(b,a+1){
REP(k,n){
cost[a][b]=cost[b][a]=MIN(cost[a][b],cost[a][k]+cost[k][b]);
time[a][b]=time[b][a]=MIN(time[a][b],time[a][k]+time[k][b]);
}
}
}
//
cin>>q;
REP(i,q){
int s,d,type;
cin>>s>>d>>type;
s--;
d--;
cout<<type==0?cost[s][d]:time[s][d]<<'\n';
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:41:14: error: 'q' was not declared in this scope
41 | cin>>q;
| ^
a.cc:47:23: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ~~~~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>
a.cc:47:23: note: candidate: 'operator==(int, int)' (built-in)
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ~~~~~~~~~~^~~
a.cc:47:23: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:47:25: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_CharT>'
47 | cout<<type==0?cost[s][d]:time[s][d]<<'\n';
|
s147073242 | p00200 | C++ | #include <iostream>
#include <vector>
#define INF 1<<29
??
using namespace std;
??
int main(void) {
????????int n,m,k,p,q,r;
????????while (cin >> n >> m && n && m) {
????????????????int dp[101][101][2];
????????????????for (int i = 0; i < m + 1; ++i) {
????????????????????????for (int j = 0; j < m + 1; ++j) {
????????????????????????????????for (int k = 0; k < 2; ++k) {
????????????????????????????????????????if (i == j) {
????????????????????????????????????????????????dp[i][j][k] = 0;
????????????????????????????????????????}
????????????????????????????????????????else {
????????????????????????????????????????????????dp[i][j][k] = INF;
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????int a,b,c,t;
????????????????for (int i = 0; i < n; ++i) {
????????????????????????cin >> a >> b >> dp[a][b][0] >> dp[a][b][1];
????????????????????????dp[b][a][0] = dp[a][b][0];
????????????????????????dp[b][a][1] = dp[a][b][1];
????????????????}
??
????????????????for (int mode = 0; mode < 2; ++mode) {
????????????????????????for (int k = 1; k < m + 1; ++k) {
????????????????????????????????for (int i = 1; i < m + 1; ++i) {
????????????????????????????????????????for (int j = 1; j < m + 1; ++j) {
????????????????????????????????????????????????dp[i][j][mode] = min(dp[i][j][mode], dp[i][k][mode]+dp[k][j][mode]);
????????????????????????????????????????}
????????????????????????????????}
????????????????????????}
????????????????}
??
????????????????cin >> k;
????????????????for (int i = 0; i < k; ++i) {
????????????????????????cin >> p >> q >> r;
????????????????????????cout << dp[p][q][r] << endl;
????????????????}
????????}
????????return 0;
} | a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:6:1: error: expected unqualified-id before '?' token
6 | ??
| ^
|
s646910863 | p00200 | C++ | #include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;
struct edge { int to, cost, time; };
typedef pair<int, int> P;
vector<edge> G[105];
int n, m, k, cost[105], time[105];
void dijkstra(int s) {
priority_queue<P, vector<P>, greater<P>> costque, timeque;
fill(cost, cost + m + 1, INF);
fill(time, time + m + 1, INF);
cost[s] = 0;
time[s] = 0;
costque.push(P(s, 0));
timeque.push(P(s, 0));
while (!costque.empty()) {
P p = costque.top();
costque.pop();
int v = p.first;
if (cost[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (cost[e.to] > cost[v] + e.cost) {
cost[e.to] = cost[v] + e.cost;
costque.push(P(e.to, cost[e.to]));
}
}
}
while (!timeque.empty()) {
P p = timeque.top();
timeque.pop();
int v = p.first;
if (time[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (time[e.to] > time[v] + e.time) {
time[e.to] = time[v] + e.time;
timeque.push(P(e.to, time[e.to]));
}
}
}
}
int main() {
while (1) {
cin >> n >> m;
if (n == 0&&m == 0) break;
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
edge tmp = { b,c,t };
G[a].push_back(tmp);
}
cin >> k;
for (int i = 0; i < k; i++) {
int p, q, r;
cin >> p >> q >> r;
dijkstra(p);
if (r == 0) cout << cost[q] << endl;
else cout << time[q] << endl;
}
}
return 0;
} | a.cc:25:33: error: 'int time [105]' redeclared as different kind of entity
25 | int n, m, k, cost[105], time[105];
| ^
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 dijkstra(int)':
a.cc:30:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~^~~
a.cc:30:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~~~~~^~~
a.cc:32:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[s] = 0;
| ^
a.cc:32:13: error: assignment of read-only location '*(time + ((sizetype)s))'
32 | time[s] = 0;
| ~~~~~~~~^~~
a.cc:53:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | if (time[v] < p.second) continue;
| ^
a.cc:53:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
53 | if (time[v] < p.second) continue;
| ~~~~~~~~^~~~~~~~~~
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.time) {
| ^
a.cc:56:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.time) {
| ^
a.cc:56:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.time) {
| ~~~~~~~~^~~~~~~~
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.time;
| ^
a.cc:57:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.time;
| ^
a.cc:57:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.time;
| ~~~~~~~~^~~~~~~~
a.cc:57:28: error: assignment of read-only location '*(time + ((sizetype)e.edge::to))'
57 | time[e.to] = time[v] + e.time;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:58:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | timeque.push(P(e.to, time[e.to]));
| ^
a.cc:58:48: error: no matching function for call to 'std::pair<int, int>::pair(int&, time_t (&)(time_t*) noexcept)'
58 | timeque.push(P(e.to, time[e.to]));
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
913 | explicit constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
902 | constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
891 | explicit constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
890 | bool>::type=false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
881 | constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
880 | bool>::type=true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
866 | bool> = false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
853 | bool> = true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std: |
s866503509 | p00200 | C++ | #include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;
struct edge { int to, cos, tim; };
typedef pair<int, int> P;
vector<edge> G[105];
int n, m, k, cost[105], time[105];
void dijkstra(int s) {
priority_queue<P, vector<P>, greater<P>> costque, timeque;
fill(cost, cost + m + 1, INF);
fill(time, time + m + 1, INF);
cost[s] = 0;
time[s] = 0;
costque.push(P(s, 0));
timeque.push(P(s, 0));
while (!costque.empty()) {
P p = costque.top();
costque.pop();
int v = p.first;
if (cost[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (cost[e.to] > cost[v] + e.cos) {
cost[e.to] = cost[v] + e.cos;
costque.push(P(e.to, cost[e.to]));
}
}
}
while (!timeque.empty()) {
P p = timeque.top();
timeque.pop();
int v = p.first;
if (time[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (time[e.to] > time[v] + e.tim) {
time[e.to] = time[v] + e.tim;
timeque.push(P(e.to, time[e.to]));
}
}
}
}
int main() {
while (1) {
cin >> n >> m;
if (n == 0&&m == 0) break;
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
edge tmp = { b,c,t };
G[a].push_back(tmp);
}
cin >> k;
for (int i = 0; i < k; i++) {
int p, q, r;
cin >> p >> q >> r;
dijkstra(p);
if (r == 0) cout << cost[q] << endl;
else cout << time[q] << endl;
}
}
return 0;
} | a.cc:25:33: error: 'int time [105]' redeclared as different kind of entity
25 | int n, m, k, cost[105], time[105];
| ^
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 dijkstra(int)':
a.cc:30:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~^~~
a.cc:30:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~~~~~^~~
a.cc:32:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[s] = 0;
| ^
a.cc:32:13: error: assignment of read-only location '*(time + ((sizetype)s))'
32 | time[s] = 0;
| ~~~~~~~~^~~
a.cc:53:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | if (time[v] < p.second) continue;
| ^
a.cc:53:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
53 | if (time[v] < p.second) continue;
| ~~~~~~~~^~~~~~~~~~
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ~~~~~~~~^~~~~~~
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~^~~~~~~
a.cc:57:28: error: assignment of read-only location '*(time + ((sizetype)e.edge::to))'
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:58:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | timeque.push(P(e.to, time[e.to]));
| ^
a.cc:58:48: error: no matching function for call to 'std::pair<int, int>::pair(int&, time_t (&)(time_t*) noexcept)'
58 | timeque.push(P(e.to, time[e.to]));
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
913 | explicit constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
902 | constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
891 | explicit constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
890 | bool>::type=false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
881 | constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
880 | bool>::type=true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
866 | bool> = false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
853 | bool> = true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, |
s406680050 | p00200 | C++ | #include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;
struct edge { int to, cos, tim; };
typedef pair<int, int> P;
vector<edge> G[105];
int n, m, k, cost[105], time[105];
void dijkstra(int s) {
priority_queue<P, vector<P>, greater<P>> costque, timeque;
fill(cost, cost + m + 1, INF);
fill(time, time + m + 1, INF);
cost[s] = 0;
time[s] = 0;
costque.push(P(s, 0));
timeque.push(P(s, 0));
while (!costque.empty()) {
P p = costque.top();
costque.pop();
int v = p.first;
if (cost[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (cost[e.to] > cost[v] + e.cos) {
cost[e.to] = cost[v] + e.cos;
costque.push(P(e.to, cost[e.to]));
}
}
}
while (!timeque.empty()) {
P p = timeque.top();
timeque.pop();
int v = p.first;
if (time[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (time[e.to] > time[v] + e.tim) {
time[e.to] = time[v] + e.tim;
timeque.push(P(e.to, time[e.to]));
}
}
}
}
int main() {
while (1) {
cin >> n >> m;
if (n == 0&&m == 0) break;
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
edge tmp = { b,c,t };
G[a].push_back(tmp);
}
cin >> k;
for (int i = 0; i < k; i++) {
int p, q, r;
cin >> p >> q >> r;
dijkstra(p);
if (r == 0) cout << cost[q] << endl;
else cout << time[q] << endl;
}
}
return 0;
} | a.cc:25:33: error: 'int time [105]' redeclared as different kind of entity
25 | int n, m, k, cost[105], time[105];
| ^
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 dijkstra(int)':
a.cc:30:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~^~~
a.cc:30:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~~~~~^~~
a.cc:32:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[s] = 0;
| ^
a.cc:32:13: error: assignment of read-only location '*(time + ((sizetype)s))'
32 | time[s] = 0;
| ~~~~~~~~^~~
a.cc:53:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | if (time[v] < p.second) continue;
| ^
a.cc:53:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
53 | if (time[v] < p.second) continue;
| ~~~~~~~~^~~~~~~~~~
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ~~~~~~~~^~~~~~~
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~^~~~~~~
a.cc:57:28: error: assignment of read-only location '*(time + ((sizetype)e.edge::to))'
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:58:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | timeque.push(P(e.to, time[e.to]));
| ^
a.cc:58:48: error: no matching function for call to 'std::pair<int, int>::pair(int&, time_t (&)(time_t*) noexcept)'
58 | timeque.push(P(e.to, time[e.to]));
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
913 | explicit constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
902 | constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
891 | explicit constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
890 | bool>::type=false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
881 | constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
880 | bool>::type=true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
866 | bool> = false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
853 | bool> = true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, |
s390346757 | p00200 | C++ | #include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;
struct edge { int to, cos, tim; };
typedef pair<int, int> P;
vector<edge> G[105];
int n, m, k, cost[105], time[105];
void dijkstra(int s) {
priority_queue<P, vector<P>, greater<P>> costque, timeque;
fill(cost, cost + m + 1, INF);
fill(time, time + m + 1, INF);
cost[s] = 0;
time[s] = 0;
costque.push(P(s, 0));
timeque.push(P(s, 0));
while (!costque.empty()) {
P p = costque.top();
costque.pop();
int v = p.first;
if (cost[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (cost[e.to] > cost[v] + e.cos) {
cost[e.to] = cost[v] + e.cos;
costque.push(P(e.to, cost[e.to]));
}
}
}
while (!timeque.empty()) {
P p = timeque.top();
timeque.pop();
int v = p.first;
if (time[v] < p.second) continue;
for (int i = 0; i < G[v].size(); i++) {
edge e = G[v][i];
if (time[e.to] > time[v] + e.tim) {
time[e.to] = time[v] + e.tim;
timeque.push(P(e.to, time[e.to]));
}
}
}
}
int main() {
while (1) {
cin >> n >> m;
if (n == 0&&m == 0) break;
for (int i = 0; i < n; i++) {
int a, b, c, t;
cin >> a >> b >> c >> t;
edge tmp = { b,c,t };
G[a].push_back(tmp);
}
cin >> k;
for (int i = 0; i < k; i++) {
int p, q, r;
cin >> p >> q >> r;
dijkstra(p);
if (r == 0) cout << cost[q] << endl;
else cout << time[q] << endl;
}
}
return 0;
} | a.cc:25:33: error: 'int time [105]' redeclared as different kind of entity
25 | int n, m, k, cost[105], time[105];
| ^
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 dijkstra(int)':
a.cc:30:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~^~~
a.cc:30:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
30 | fill(time, time + m + 1, INF);
| ~~~~~~~~~^~~
a.cc:32:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
32 | time[s] = 0;
| ^
a.cc:32:13: error: assignment of read-only location '*(time + ((sizetype)s))'
32 | time[s] = 0;
| ~~~~~~~~^~~
a.cc:53:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | if (time[v] < p.second) continue;
| ^
a.cc:53:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
53 | if (time[v] < p.second) continue;
| ~~~~~~~~^~~~~~~~~~
a.cc:56:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ^
a.cc:56:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
56 | if (time[e.to] > time[v] + e.tim) {
| ~~~~~~~~^~~~~~~
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ^
a.cc:57:38: warning: pointer to a function used in arithmetic [-Wpointer-arith]
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~^~~~~~~
a.cc:57:28: error: assignment of read-only location '*(time + ((sizetype)e.edge::to))'
57 | time[e.to] = time[v] + e.tim;
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~
a.cc:58:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
58 | timeque.push(P(e.to, time[e.to]));
| ^
a.cc:58:48: error: no matching function for call to 'std::pair<int, int>::pair(int&, time_t (&)(time_t*) noexcept)'
58 | timeque.push(P(e.to, time[e.to]));
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41:
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
913 | explicit constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:913:28: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<int, _U1>::value) || (! std::is_same<int, _U2>::value)), int, int>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<((! std::is_same<_T1, _U1>::value) || (! std::is_same<_T2, _U2>::value)), _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
902 | constexpr pair(pair<_U1, _U2>&& __p)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:902:19: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_pair.h:891:28: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && (! _ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && (! std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>())), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
891 | explicit constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:891:28: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:890:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
890 | bool>::type=false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: candidate: 'template<class _U1, class _U2, typename std::enable_if<(_MoveConstructiblePair<_U1, _U2>() && _ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U2 = _U1; typename std::enable_if<(std::_PCC<true, _T1, _T2>::_MoveConstructiblePair<_U1, _U2>() && std::_PCC<true, _T1, _T2>::_ImplicitlyMoveConvertiblePair<_U1, _U2>()), bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
881 | constexpr pair(_U1&& __x, _U2&& __y)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:881:19: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:880:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
880 | bool>::type=true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::__not_<std::is_convertible<_U2, _T2> > >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
869 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:869:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:866:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
866 | bool> = false>
| ^~~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: candidate: 'template<class _U2, typename std::enable_if<std::__and_<std::is_pointer<int>, std::__not_<std::is_reference<_Tp> >, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::is_convertible<_Iter, int> >::value, bool>::type <anonymous> > constexpr std::pair<_T1, _T2>::pair(__zero_as_null_pointer_constant, _U2&&, ...) [with typename std::enable_if<std::__and_<std::is_pointer<_Tp>, std::__not_<std::is_reference<_U1> >, std::is_constructible<_T2, _U2>, std::__not_<std::is_constructible<_T1, const _U1&> >, std::is_convertible<_U2, _T2> >::value, bool>::type <anonymous> = _U2; _T1 = int; _T2 = int]'
856 | pair(__zero_as_null_pointer_constant, _U2&& __y, ...)
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:856:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_pair.h:853:38: error: no type named 'type' in 'struct std::enable_if<false, bool>'
853 | bool> = true>
| ^~~~
/usr/include/c++/14/bits/stl_pair.h:843:9: note: candidate: 'template<class _U1, typename std::enable_if<std::__and_<std::__not_<std::is_reference<_Tp> >, std::is_pointer<int>, std::is_constructible<int, _U1>, std::__not_<std::is_constructible<int, const _U1&> >, std::__not_<std::is_convertible<_Iter, int> > >::value, bool>::type <anonymous> > constexpr std::pair<_T1, |
s042930905 | p00200 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)
template< typename T >
struct edge {
int src, to;
T cost;
edge(int to, T cost) : src(-1), to(to), cost(cost) {}
edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s)
{
const auto INF = numeric_limits< T >::max();
vector< T > dist(g.size(), INF);
using Pi = pair< T, int >;
priority_queue< Pi, vector< Pi >, greater< Pi > > que;
dist[s] = 0;
que.emplace(dist[s], s);
while(!que.empty()) {
T cost;
int idx;
tie(cost, idx) = que.top();
que.pop();
if(dist[idx] < cost) continue;
for(auto &e : g[idx]) {
auto next_cost = cost + e.cost;
if(dist[e.to] <= next_cost) continue;
dist[e.to] = next_cost;
que.emplace(dist[e.to], e.to);
}
}
return dist;
}
int main(){
int n, m;
cin >> n >> m;
WeightedGraph<int> roads_cost(m);
WeightedGraph<int> roads_time(m);
for(int i = 0; i < n; i++){
int a, b, cost, time;
cin >> a >> b >> cost >> time;
roads_cost[a - 1].push_back(edge<int>(b - 1, cost));
roads_cost[b - 1].push_back(edge<int>(a - 1, cost));
roads_time[a - 1].push_back(edge<int>(b - 1, time));
roads_time[b - 1].push_back(edge<int>(a - 1, time));
}
int k;
cin >> k;
for(int i = 0; i < k; i++){
int p, q, r;
cin >> p >> q >> r;
if(r){
cout << dijkstra(roads_time, p - 1)[q - 1] << endl;
}else{
cout << dijkstra(roads_cost, p - 1)[q - 1] << endl;
}
}
}
| a.cc: In function 'std::vector<_Tp> dijkstra(WeightedGraph<T>&, int)':
a.cc:50:22: error: 'numeric_limits' was not declared in this scope
50 | const auto INF = numeric_limits< T >::max();
| ^~~~~~~~~~~~~~
a.cc:50:40: error: expected primary-expression before '>' token
50 | const auto INF = numeric_limits< T >::max();
| ^
a.cc:50:46: error: no matching function for call to 'max()'
50 | const auto INF = numeric_limits< T >::max();
| ~~~~~^~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
|
s963847644 | p00200 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)
template< typename T >
struct edge {
int src, to;
T cost;
edge(int to, T cost) : src(-1), to(to), cost(cost) {}
edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s)
{
const auto INF = numeric_limits< T >::max();
vector< T > dist(g.size(), INF);
using Pi = pair< T, int >;
priority_queue< Pi, vector< Pi >, greater< Pi > > que;
dist[s] = 0;
que.emplace(dist[s], s);
while(!que.empty()) {
T cost;
int idx;
tie(cost, idx) = que.top();
que.pop();
if(dist[idx] < cost) continue;
for(auto &e : g[idx]) {
auto next_cost = cost + e.cost;
if(dist[e.to] <= next_cost) continue;
dist[e.to] = next_cost;
que.emplace(dist[e.to], e.to);
}
}
return dist;
}
int main(){
int n, m;
cin >> n >> m;
WeightedGraph<int> roads_cost(m);
WeightedGraph<int> roads_time(m);
for(int i = 0; i < n; i++){
int a, b, cost, time;
cin >> a >> b >> cost >> time;
roads_cost[a - 1].push_back(edge<int>(b - 1, cost));
roads_cost[b - 1].push_back(edge<int>(a - 1, cost));
roads_time[a - 1].push_back(edge<int>(b - 1, time));
roads_time[b - 1].push_back(edge<int>(a - 1, time));
}
int k;
cin >> k;
for(int i = 0; i < k; i++){
int p, q, r;
cin >> p >> q >> r;
if(r){
cout << dijkstra(roads_time, p - 1)[q - 1] << endl;
}else{
cout << dijkstra(roads_cost, p - 1)[q - 1] << endl;
}
}
}
| a.cc: In function 'std::vector<_Tp> dijkstra(WeightedGraph<T>&, int)':
a.cc:50:22: error: 'numeric_limits' was not declared in this scope
50 | const auto INF = numeric_limits< T >::max();
| ^~~~~~~~~~~~~~
a.cc:50:40: error: expected primary-expression before '>' token
50 | const auto INF = numeric_limits< T >::max();
| ^
a.cc:50:46: error: no matching function for call to 'max()'
50 | const auto INF = numeric_limits< T >::max();
| ~~~~~^~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
|
s801108771 | p00200 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class itr, class func> void array_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr, class func> void nint_output(itr start, itr goal, func out = [](itr x) { return x; } ){ string ans; for(auto i = start; i != goal; i++){ ans += string(out(*i)) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)
template< typename T >
struct edge {
int src, to;
T cost;
edge(int to, T cost) : src(-1), to(to), cost(cost) {}
edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
edge &operator=(const int &x) {
to = x;
return *this;
}
operator int() const { return to; }
};
template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;
template< typename T >
vector< T > dijkstra(WeightedGraph< T > &g, int s)
{
const auto INF = numeric_limits< T >::max();
vector< T > dist(g.size(), INF);
using Pi = pair< T, int >;
priority_queue< Pi, vector< Pi >, greater< Pi > > que;
dist[s] = 0;
que.emplace(dist[s], s);
while(!que.empty()) {
T cost;
int idx;
tie(cost, idx) = que.top();
que.pop();
if(dist[idx] < cost) continue;
for(auto &e : g[idx]) {
auto next_cost = cost + e.cost;
if(dist[e.to] <= next_cost) continue;
dist[e.to] = next_cost;
que.emplace(dist[e.to], e.to);
}
}
return dist;
}
int main(){
int n, m;
cin >> n >> m;
WeightedGraph<int> roads_cost(m);
WeightedGraph<int> roads_time(m);
for(int i = 0; i < n; i++){
int a, b, cost, time;
cin >> a >> b >> cost >> time;
roads_cost[a - 1].push_back(edge<int>(b - 1, cost));
roads_cost[b - 1].push_back(edge<int>(a - 1, cost));
roads_time[a - 1].push_back(edge<int>(b - 1, time));
roads_time[b - 1].push_back(edge<int>(a - 1, time));
}
int k;
cin >> k;
for(int i = 0; i < k; i++){
int p, q, r;
cin >> p >> q >> r;
if(r){
cout << (dijkstra(roads_time, p - 1)[q - 1]) << endl;
}else{
cout << (dijkstra(roads_cost, p - 1)[q - 1]) << endl;
}
}
}
| a.cc: In function 'std::vector<_Tp> dijkstra(WeightedGraph<T>&, int)':
a.cc:50:22: error: 'numeric_limits' was not declared in this scope
50 | const auto INF = numeric_limits< T >::max();
| ^~~~~~~~~~~~~~
a.cc:50:40: error: expected primary-expression before '>' token
50 | const auto INF = numeric_limits< T >::max();
| ^
a.cc:50:46: error: no matching function for call to 'max()'
50 | const auto INF = numeric_limits< T >::max();
| ~~~~~^~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 0 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate expects 2 arguments, 0 provided
|
s280156168 | p00200 | C++ | #include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX_V 101
#define MAX_E 3001
#define INF 1e9
using namespace std;
int cost[MAX_V][MAX_V];
int time[MAX_V][MAX_V];
int cost_d[MAX_V];
int time_d[MAX_V];
bool used[MAX_V];
int V;
int E;
void cost_dijkstra(int s) {
for (int i = 0; i < V; i++) {
cost_d[i] = INF;
used[i] = false;
}
cost_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] && (v == -1 || cost_d[u] < cost_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
cost_d[u] = min(cost_d[u], cost_d[v] + cost[v][u]);
}
}
}
}
void time_dijkstra(int s) {
for (int i = 0; i < V; i++) {
time_d[i] = INF;
used[i] = false;
}
time_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] &&( v == -1 || time_d[u] < time_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
time_d[u] = min(time_d[u], time_d[v] + cost[v][u]);
}
}
}
}
int main() {
while (cin >> E >> V, (E != 0 && V != 0)) {
for (int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) {
cost[i][j] = -1;
time[i][j] = -1;
}
}
for (int i = 0; i < E; i++) {
int a, b;
cin >> a >> b;
cin >> cost[a-1][b-1] >> time[a-1][b-1];
}
int k;//クエリの数
cin >> k;
for(int i=0;i<k;i++){
int p, q, r;
cin >> p>>q>>r;
//cost
if (r == 0) {
cost_dijkstra(p-1);
cout << cost_d[q-1] << endl;
}
//time
else if(r==1){
time_dijkstra(p-1);
cout << time_d[q-1] << endl;
}
}
}
return 0;
}
| a.cc:11:22: error: 'int time [101][101]' redeclared as different kind of entity
11 | int time[MAX_V][MAX_V];
| ^
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:3:
/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 'int main()':
a.cc:82:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
82 | time[i][j] = -1;
| ^
a.cc:82:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
82 | time[i][j] = -1;
| ^
a.cc:82:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
82 | time[i][j] = -1;
| ~~~~~~~~~~~^~~~
a.cc:89:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:47: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'})
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~~
| | |
| | time_t(time_t*) noexcept {aka long int(long int*) noexcept}
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'}
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(short int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(short unsigned int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(unsigned int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(long int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:89:63: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive]
89 | cin >> cost[a-1][b-1] >> time[a-1][b-1];
| ~~~~~~~~~~~~~^
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:89:63: error: cannot bind rvalue '(long unsigned int)(time + ((((sizetype)a) + ((sizetype)b)) + 18446744073709551614))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc |
s239592019 | p00200 | C++ | #include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 1e9
int cost[101][101];
int time[101][101];
int cost_d[101];
int time_d[101];
bool used[101];
int V;
int E;
void cost_dijkstra(int s) {
for (int i = 0; i < V; i++) {
cost_d[i] = INF;
used[i] = false;
}
cost_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] && (v == -1 || cost_d[u] < cost_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
cost_d[u] = min(cost_d[u], cost_d[v] + cost[v][u]);
}
}
}
}
void time_dijkstra(int s) {
for (int i = 0; i < V; i++) {
time_d[i] = INF;
used[i] = false;
}
time_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] &&( v == -1 || time_d[u] < time_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
time_d[u] = min(time_d[u], time_d[v] + cost[v][u]);
}
}
}
}
int main() {
while (cin >> E >> V, (E != 0 && V != 0)) {
for (int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) {
cost[i][j] = -1;
time[i][j] = -1;
}
}
for (int i = 0; i < E; i++) {
int a, b,c,t;
cin >> a >> b>>c>>t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
int k;//クエリの数
cin >> k;
for(int i=0;i<k;i++){
int p, q, r;
cin >> p>>q>>r;
//cost
if (r == 0) {
cost_dijkstra(p-1);
cout << cost_d[q-1] << endl;
}
//time
else if(r==1){
time_dijkstra(p-1);
cout << time_d[q-1] << endl;
}
}
}
return 0;
}
| a.cc:10:18: error: 'int time [101][101]' redeclared as different kind of entity
10 | int time[101][101];
| ^
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:3:
/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 'int main()':
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][j] = -1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][j] = -1;
| ^
a.cc:81:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
81 | time[i][j] = -1;
| ~~~~~~~~~~~^~~~
a.cc:89:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
|
s510853138 | p00200 | C++ | #include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 1e9
int cost[101][101];
int time[101][101];
int cost_d[101];
int time_d[101];
bool used[101];
int V;
int E;
void cost_dijkstra(int s) {
for (int i = 0; i < V; i++) {
cost_d[i] = INF;
used[i] = false;
}
cost_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] && (v == -1 || cost_d[u] < cost_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
cost_d[u] = min(cost_d[u], cost_d[v] + cost[v][u]);
}
}
}
}
void time_dijkstra(int s) {
for (int i = 0; i < V; i++) {
time_d[i] = INF;
used[i] = false;
}
time_d[s] = 0;
while (true) {
int v = -1;
for (int u = 0; u < V; u++) {
if (!used[u] &&( v == -1 || time_d[u] < time_d[v])) {
v = u;
}
}
//全ての頂点が到達済み
if (v == -1) {
break;
}
//集合に新たに頂点を追加
used[v] = true;
for (int u = 0; u < V; u++) {
if (cost[v][u] != -1) {
time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
}
}
}
}
int main() {
while (cin >> E >> V, (E != 0 && V != 0)) {
for (int i = 0; i < V; i++) {
for (int j = 0; j < V; j++) {
cost[i][j] = -1;
time[i][j] = -1;
}
}
for (int i = 0; i < E; i++) {
int a, b,c,t;
cin >> a >> b>>c>>t;
cost[a - 1][b - 1] = cost[b - 1][a - 1] = c;
time[a - 1][b - 1] = time[b - 1][a - 1] = t;
}
int k;//クエリの数
cin >> k;
for(int i=0;i<k;i++){
int p, q, r;
cin >> p>>q>>r;
//cost
if (r == 0) {
cost_dijkstra(p-1);
cout << cost_d[q-1] << endl;
}
//time
else if(r==1){
time_dijkstra(p-1);
cout << time_d[q-1] << endl;
}
}
}
return 0;
}
| a.cc:10:18: error: 'int time [101][101]' redeclared as different kind of entity
10 | int time[101][101];
| ^
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:3:
/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 time_dijkstra(int)':
a.cc:67:78: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ^
a.cc:67:81: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ^
a.cc:67:70: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ~~~~~~~~~~^~~~~~~~~~~~
a.cc:67:48: error: no matching function for call to 'min(int&, time_t (*)(time_t*) noexcept)'
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:67:48: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'})
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:67:48: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
67 | time_d[u] = min(time_d[u], time_d[v] + time[v][u]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][j] = -1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][j] = -1;
| ^
a.cc:81:44: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
81 | time[i][j] = -1;
| ~~~~~~~~~~~^~~~
a.cc:89:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:89:65: error: assignment of read-only location '*(time + ((((sizetype)b) + ((sizetype)a)) + 18446744073709551614))'
89 | time[a - 1][b - 1] = time[b - 1][a - 1] = t;
| ~~~~~~~~~~~~~~~~~~~^~~
|
s764869184 | p00200 | C++ | #include<iostream>
#define INF 1001;
using namespace std;
int main(){
int n,m;
while(1){
cin>>n>>m;
if(n==0&&m==0)break;
int s_tim[m][m];
int c_money[m][m];
int a,b,cost,tim;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
s_tim[i][j]=INF;
c_money[i][j]=INF;
}
}
for(int i=0;i<m;i++){
s_tim[i][i]=0;
c_money[i][i]=0;
}
for(int i=0;i<n;i++){
cin>>a>>b>>cost>>tim;
s_tim[a-1][b-1]=tim;s_tim[b-1][a-1]=tim;
c_money[a-1][b-1]=cost;c_money[b-1][a-1]=cost;
}
for(int k=0;k<m;k++){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
if(s_tim[i][j]>s_tim[i][k]+s_tim[k][j]){
s_tim[i][j]=s_tim[i][k]+s_tim[k][j];
}
if(c_money[i][j]>c_money[i][k]+c_money[k][j]){
c_money[i][j]=c_money[i][k]+c_money[k][j];
}
}
}
}
int contacts,p,q,r;
cin>>contacts;
for(int i=0;i<contacts;i++){
cin>>p>>q>>r;
if(r){cout<<s_tim[p-1][q-1];}
else{ cout<<c_money[p-1][q-1];}
| a.cc: In function 'int main()':
a.cc:51:38: error: expected '}' at end of input
51 | else{ cout<<c_money[p-1][q-1];}
| ^
a.cc:48:32: note: to match this '{'
48 | for(int i=0;i<contacts;i++){
| ^
a.cc:51:38: error: expected '}' at end of input
51 | else{ cout<<c_money[p-1][q-1];}
| ^
a.cc:9:11: note: to match this '{'
9 | while(1){
| ^
a.cc:51:38: error: expected '}' at end of input
51 | else{ cout<<c_money[p-1][q-1];}
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s289835175 | p00200 | C++ | #include<iostream>
#define INF ;
using namespace std;
int main(){
int n,m;
while(1){
cin>>n>>m;
if(n==0&&m==0){break;}
int s_tim[m][m];
int c_money[m][m];
int a,b,cost,tim;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
s_tim[i][j]=INF;
c_money[i][j]=INF;
}
}
for(int i=0;i<m;i++){
s_tim[i][i]=0;
c_money[i][i]=0;
}
for(int i=0;i<n;i++){
cin>>a>>b>>cost>>tim;
s_tim[a-1][b-1]=tim;s_tim[b-1][a-1]=tim;
c_money[a-1][b-1]=cost;c_money[b-1][a-1]=cost;
}
for(int k=0;k<m;k++){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
if(s_tim[i][j]>s_tim[i][k]+s_tim[k][j]){
s_tim[i][j]=s_tim[i][k]+s_tim[k][j];
}
if(c_money[i][j]>c_money[i][k]+c_money[k][j]){
c_money[i][j]=c_money[i][k]+c_money[k][j];
}
}
}
}
int contacts,p,q,r;
cin>>contacts;
for(int i=0;i<contacts;i++){
cin>>p>>q>>r;
if(r){cout<<s_tim[p-1][q-1];}
else{ cout<<c_money[p-1][q-1];}
cout<<endl;
}
}
}
| a.cc: In function 'int main()':
a.cc:3:13: error: expected primary-expression before ';' token
3 | #define INF ;
| ^
a.cc:18:21: note: in expansion of macro 'INF'
18 | s_tim[i][j]=INF;
| ^~~
a.cc:3:13: error: expected primary-expression before ';' token
3 | #define INF ;
| ^
a.cc:19:23: note: in expansion of macro 'INF'
19 | c_money[i][j]=INF;
| ^~~
|
s201500347 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
int count=0;
while(count!=50){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
count++;
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | cin >> n >> m;
| ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
59 | cout<<a<<endl;
| ^~~~
| count
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout<<a<<endl;
| ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
77 | cout<<a<<endl;
| ^~~~
| count
a.cc:77:18: error: 'endl' was not declared in this scope
77 | cout<<a<<endl;
| ^~~~
|
s877263605 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
int count=0;
while(count!=50){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | cin >> n >> m;
| ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
59 | cout<<a<<endl;
| ^~~~
| count
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout<<a<<endl;
| ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
77 | cout<<a<<endl;
| ^~~~
| count
a.cc:77:18: error: 'endl' was not declared in this scope
77 | cout<<a<<endl;
| ^~~~
|
s365135105 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
int count=0;
while(count!=50){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
count++;
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | cin >> n >> m;
| ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
59 | cout<<a<<endl;
| ^~~~
| count
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout<<a<<endl;
| ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
77 | cout<<a<<endl;
| ^~~~
| count
a.cc:77:18: error: 'endl' was not declared in this scope
77 | cout<<a<<endl;
| ^~~~
|
s939405813 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
int count=0;
while(count==50){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
count++;
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | cin >> n >> m;
| ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
59 | cout<<a<<endl;
| ^~~~
| count
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout<<a<<endl;
| ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
77 | cout<<a<<endl;
| ^~~~
| count
a.cc:77:18: error: 'endl' was not declared in this scope
77 | cout<<a<<endl;
| ^~~~
|
s993637206 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
int count=0;
while(count=50){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
count++;
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:11:17: error: 'cin' was not declared in this scope
11 | cin >> n >> m;
| ^~~
a.cc:59:9: error: 'cout' was not declared in this scope; did you mean 'count'?
59 | cout<<a<<endl;
| ^~~~
| count
a.cc:59:18: error: 'endl' was not declared in this scope
59 | cout<<a<<endl;
| ^~~~
a.cc:77:9: error: 'cout' was not declared in this scope; did you mean 'count'?
77 | cout<<a<<endl;
| ^~~~
| count
a.cc:77:18: error: 'endl' was not declared in this scope
77 | cout<<a<<endl;
| ^~~~
|
s954101410 | p00200 | C++ | ##include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
while(false){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
for(int i=0;i<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
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];
}
}
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
}
return 0;
}
| a.cc:1:1: error: stray '##' in program
1 | ##include <iostream>
| ^~
a.cc:1:3: error: 'include' does not name a type
1 | ##include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:17: error: 'cin' was not declared in this scope
10 | cin >> n >> m;
| ^~~
a.cc:58:9: error: 'cout' was not declared in this scope
58 | cout<<a<<endl;
| ^~~~
a.cc:58:18: error: 'endl' was not declared in this scope
58 | cout<<a<<endl;
| ^~~~
a.cc:76:9: error: 'cout' was not declared in this scope
76 | cout<<a<<endl;
| ^~~~
a.cc:76:18: error: 'endl' was not declared in this scope
76 | cout<<a<<endl;
| ^~~~
|
s750086898 | p00200 | C++ | #include <iostream>
using namespace std;
const int INF = 1000000000;
int main()
{
while(false){
int n, m;
cin >> n >> m;
if(n==0 && m==0)
break;
int C[100][100];
int T[100][100];
for(int i=0; i<m; i++){
for(int j=0; j<m; j++){
if(i==j){
C[i][j] = T[i][j] = 0;
}else{
C[i][j] = T[i][j] = INF;
}
}
}
for(int i=0; i<n; i++){
int a, b, c, t;
cin >> a >> b >> c >> t;
C[a-1][b-1] = C[b-1][a-1] = c;
T[a-1][b-1] = T[b-1][a-1] = t;
}
int k;
cin>>k;
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<k;i++){
int p, q, r;
int a=0;
cin>>p>>q>>r;
int d[m][m];
if(r==0){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=C[i][j];
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
if(r==1){
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
d[i][j]=T[i][j];
}
}
a=d[p-1][q-1];
cout<<a<<endl;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:14: error: 'd' was not declared in this scope
40 | if(d[i][j]>d[i][k]+d[k][j]){
| ^
|
s546551395 | p00200 | C++ | #include<iostream>
#include<queue>
#define inf 1000000000
using namespace std;
int C[101][101],T[101][101];
int n,m;
class sint{
public:
int n,m;
sint(){}
sint(int a,int b){n=a;m=b;}
operator < (const sint &a) const{
return m>a.m;
}
};
int dike(int st,int en,int va){
priority_queue<sint> state;
int visit[101];
int now[101];
for(int i=0;i<101;i++){
visit[i]=0;
now[i]=inf;
}
state.push(sint(st,0));
now[st]=0;
while(1){
sint u;
u=state.top();
state.pop();
visit[u.n]=1;
/*
printf("come %d %d\n",u.n,u.m);
for(int i=1;i<=m;i++){
printf("%4d",now[i]);
}
puts("");
for(int i=1;i<=m;i++){
printf("%4d",visit[i]);
}puts("");
*/if(u.n==en){
return u.m;
}
for(int i=1;i<=m;i++){
int cost=C[u.n][i];
if(va==1){
cost=T[u.n][i];
}
if(cost==inf||visit[i]==1){
continue;
}
if(cost+u.m < now[i]){
now[i]=cost+u.m;
state.push(sint(i,now[i]));
}
}
}
}
int main(){
while(1){
cin>>n>>m;
if(n==0){
break;
}
for(int i=0;i<101;i++){
for(int j=0;j<101;j++){
C[i][j]=T[i][j]=inf;
}
}
for(int i=0;i<n;i++){
int a,b,c,d;
cin>>a>>b>>c>>d;
C[a][b]=C[b][a]=c;
T[a][b]=T[b][a]=d;
}
int l;
cin>>l;
for(int i=0;i<l;i++){
int a,b,c;
cin>>a>>b>>c;
printf("%d\n",dike(a,b,c));
}
}
} | a.cc:16:9: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
16 | operator < (const sint &a) const{
| ^~~~~~~~
|
s910978069 | p00200 | C++ | #include <iostream>
#include <vector>
using namespace std;
static const int TYPE_COST =0;
static const int TYPE_TIME =1;
class station{
public:
int cost;
bool visited;
vector<int> edge_to;
vector<int> edge_cost;
vector<int> edge_time;
public:
station() : cost(-1), visited(false){}
void add_to(int to, int cost, int time)
{
this->edge_to.push_back(to);
this->edge_cost.push_back(cost);
this->edge_time.push_back(time);
}
};
int dijkstra(station* sta, int size, int from, int to, int type);
bool contain(vector<station> sta, station elem);
void reset(station* sta, int size);
int main(int argc, char** argv)
{
while( 1 ){
int n, m, from, to, cost, time, type;
cin >> n;
cin >> m;
if(n==0 && m==0) break;
station sta[m];
for(int i=0; i<m; i++){
sta[i] = station();
}
for(int i=0; i<n; i++){
cin >> from;
cin >> to;
cin >> cost;
cin >> time;
sta[from-1].add_to(to-1, cost, time);
}
cin >> n;
for(int i=0; i<n; i++){
cin >> from;
cin >> to;
cin >> type;
cout << dijkstra(sta, m, from-1, to-1, type) << endl;
reset(sta, m);
}
}
return 0;
}
int dijkstra(station* sta, int size, int start, int goal, int type)
{
int to, cost;
station done;
vector<station> q;
sta[start].cost = 0;
q.push_back(sta[start]);
while(!q.empty()){
done = q[0];
q.erase(q.begin());
done.visited = true;
for(int i=0; i<done.edge_to.size(); i++){
to = done.edge_to[i];
if(type==TYPE_COST) cost = done.cost + done.edge_cost[i];
if(type==TYPE_TIME) cost = done.cost + done.edge_time[i];
if(sta[to].cost < 0 || cost < sta[to].cost){
sta[to].cost = cost;
if(!contain(q, sta[to])){
q.push_back(sta[to]);
}
}
}
}
return sta[goal].cost;
}
bool contain(vector<station> sta, station elem)
{
int size = sta.size();
bool is_match = false;
for(int i=0; i<size; i++){
if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
is_match = true;
break;
}
}
return is_match;
}
void reset(station* sta, int size)
{
for(int i=0; i<size; i++){
sta[i].visited = false;
sta[i].cost = -1;
}
} | a.cc: In function 'bool contain(std::vector<station>, station)':
a.cc:98:20: error: 'memcmp' was not declared in this scope
98 | if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
| ^~~~~~
a.cc:3:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 |
|
s379708315 | p00200 | C++ | #include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std;
static const int TYPE_COST =0;
static const int TYPE_TIME =1;
class station{
public:
int cost;
bool visited;
vector<int> edge_to;
vector<int> edge_cost;
vector<int> edge_time;
public:
station() : cost(-1), visited(false){}
void add_to(int to, int cost, int time)
{
this->edge_to.push_back(to);
this->edge_cost.push_back(cost);
this->edge_time.push_back(time);
}
};
int dijkstra(station* sta, int size, int from, int to, int type);
bool contain(vector<station> sta, station elem);
void reset(station* sta, int size);
int main(int argc, char** argv)
{
while( 1 ){
int n, m, from, to, cost, time, type;
cin >> n;
cin >> m;
if(n==0 && m==0) break;
station sta[m];
for(int i=0; i<m; i++){
sta[i] = station();
}
for(int i=0; i<n; i++){
cin >> from;
cin >> to;
cin >> cost;
cin >> time;
sta[from-1].add_to(to-1, cost, time);
}
cin >> n;
for(int i=0; i<n; i++){
cin >> from;
cin >> to;
cin >> type;
cout << dijkstra(sta, m, from-1, to-1, type) << endl;
reset(sta, m);
}
}
return 0;
}
int dijkstra(station* sta, int size, int start, int goal, int type)
{
int to, cost;
station done;
vector<station> q;
sta[start].cost = 0;
q.push_back(sta[start]);
while(!q.empty()){
done = q[0];
q.erase(q.begin());
done.visited = true;
for(int i=0; i<done.edge_to.size(); i++){
to = done.edge_to[i];
if(type==TYPE_COST) cost = done.cost + done.edge_cost[i];
if(type==TYPE_TIME) cost = done.cost + done.edge_time[i];
if(sta[to].cost < 0 || cost < sta[to].cost){
sta[to].cost = cost;
if(!contain(q, sta[to])){
q.push_back(sta[to]);
}
}
}
}
return sta[goal].cost;
}
bool contain(vector<station> sta, station elem)
{
int size = sta.size();
bool is_match = false;
for(int i=0; i<size; i++){
if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
is_match = true;
break;
}
}
return is_match;
}
void reset(station* sta, int size)
{
for(int i=0; i<size; i++){
sta[i].visited = false;
sta[i].cost = -1;
}
} | a.cc: In function 'bool contain(std::vector<station>, station)':
a.cc:99:20: error: 'memcmp' was not declared in this scope
99 | if(memcmp(&sta[i], &elem, sizeof(station)) == 0){
| ^~~~~~
a.cc:4:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <stdlib.h>
+++ |+#include <cstring>
4 |
|
s796599181 | p00200 | C++ | 6 5
1 2 200 10
1 4 400 15
1 3 250 25
2 4 100 10
4 5 150 20
3 5 300 20
2
1 5 0
1 5 1 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 6 5
| ^
|
s574668201 | p00200 | C++ | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<int, int> P;
const int INF = 1 << 24;
int c[200][200];
int t[200][200];
int cost[200][200];
int tim[200][200];
int main(){
int n, m, K;
int p, q, r;
while(cin >> n >> m && (n || m)){
fill(&cost[0][0], &cost[199][199] + 1, INF);
fill(&tim[0][0], &tim[199][199] + 1, INF);
for(int i = 1; i <= m; i++){
cost[i][i] = tim[i][i] = 0;
c[i][i] = t[i][i] = 0;
}
for(int i = 0; i < n; i++){
int a, b;
int d, e;
cin >> a >> b;
cin >> d >> e;
cost[b][a] = min(cost[b][a], d);
cost[a][b] = min(cost[a][b], d); | a.cc: In function 'int main()':
a.cc:29:39: error: expected '}' at end of input
29 | cost[a][b] = min(cost[a][b], d);
| ^
a.cc:23:31: note: to match this '{'
23 | for(int i = 0; i < n; i++){
| ^
a.cc:29:39: error: expected '}' at end of input
29 | cost[a][b] = min(cost[a][b], d);
| ^
a.cc:15:35: note: to match this '{'
15 | while(cin >> n >> m && (n || m)){
| ^
a.cc:29:39: error: expected '}' at end of input
29 | cost[a][b] = min(cost[a][b], d);
| ^
a.cc:12:11: note: to match this '{'
12 | int main(){
| ^
|
s200354522 | p00200 | C++ | // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0200
/* http://www.deqnotes.net/acmicpc/dijkstra/
9 6
1 2 5 0
1 3 4 0
1 4 2 0
2 3 2 0
3 4 3 0
2 6 6 0
3 5 2 0
5 6 4 0
4 5 6 0
1
1 6 0
0 0
*/
#include <cstdio>
#include <climits>
#include <cstring>
#define STATION_MAX 101
//#define dprintf(arg1, ... ) printf( arg1, __VA_ARGS__)
#define dprintf(arg1, ... )
/*
typedef struct {
} LINE;
*/
int main(void) {
while(1) {
int line_cnt, stat_cnt;
scanf("%d %d\n", &line_cnt, &stat_cnt);
if ( line_cnt==0 && stat_cnt== 0 ) { break; }
int line_cost[2][STATION_MAX][STATION_MAX];
memset( line_cost, -1, sizeof(int)*2*STATION_MAX*STATION_MAX );
int a; int b; int fee; int time;
for( int i=0; i<line_cnt; i++ ) {
scanf("%d %d %d %d\n", &a, &b, &fee, &time );
line_cost[0][a][b] = line_cost[0][b][a] = fee;
line_cost[1][a][b] = line_cost[1][b][a] = time;
}
int query_cnt;
scanf("%d\n", &query_cnt );
for( int i=0; i<query_cnt; i++ ) {
int start, end, type;
scanf("%d %d %d\n", &start, &end, &type );
int stat_cost[STATION_MAX];
bool stat_flag[STATION_MAX];
memset( stat_cost, -1, sizeof(int)*STATION_MAX );
memset( stat_flag, false, sizeof(bool)*STATION_MAX );
stat_cost[start] = 0;
while(1) {
int minstat = -1;
int minval=INT_MAX;
for ( int i=1; i<stat_cnt+1; i++ ) {
if ( stat_cost[i] == -1 ) { continue; }
if ( stat_flag[i] == true ) { continue; }
if ( stat_cost[i] < minval ) { minstat = i; minval = stat_cost[i]; }
}
if ( minstat == -1 ) { break; }
dprintf("minstat: %d stat_cost=%d\n", minstat, stat_cost[minstat]);
stat_flag[minstat] = true;
//check_tonari
for ( int i=1; i<stat_cnt+1; i++ ) {
if ( lcost[nowstat][i] == -1 ) { continue; }
if ( stat_cost[i] == -1 || stat_cost[i] > stat_cost[nowstat] + lcost[nowstat][i] ) {
dprintf( "Refresh stat_cost[%d]: %d (old: %d)\n", i, stat_cost[nowstat] + lcost[nowstat][i], stat_cost[i]);
stat_cost[i] = stat_cost[nowstat] + lcost[nowstat][i];
}
}
}
printf("%d\n", stat_cost[end]);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:83:38: error: 'lcost' was not declared in this scope
83 | if ( lcost[nowstat][i] == -1 ) { continue; }
| ^~~~~
a.cc:83:44: error: 'nowstat' was not declared in this scope
83 | if ( lcost[nowstat][i] == -1 ) { continue; }
| ^~~~~~~
a.cc:84:94: error: 'nowstat' was not declared in this scope
84 | if ( stat_cost[i] == -1 || stat_cost[i] > stat_cost[nowstat] + lcost[nowstat][i] ) {
| ^~~~~~~
a.cc:84:105: error: 'lcost' was not declared in this scope
84 | if ( stat_cost[i] == -1 || stat_cost[i] > stat_cost[nowstat] + lcost[nowstat][i] ) {
| ^~~~~
|
s191872759 | p00200 | C++ | #include<cstdio>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)
int main(){
while(1){
int m,n;
cin>>m>>n;
if(m==0)break;
int dp[2][111][111];
rep(p,2){
rep(i,111){
rep(j,111){
dpc[p][i][j]=dpt[p][i][j]=1000000000;
}
dpc[p][i][i]=dpt[p][i][i]=0;
}
}
rep(i,m){
int a,b,c,t;
cin>>a>>b>>c>>t;
dp[0][a][b]=c;
dp[1][a][b]=t;
}
rep(p,2){
rep(k,n){
rep(i,n){
rep(j,n){
dp[p][i][j] = min(dp[p][i][j],dp[p][i][k]+dp[p][k][j]);
}
}
}
}
int T;
cin>>T;
rep(i,T){
int a,b,c;
cin>>a>>b>>c;
printf("%d\n",dp[c][a][b]);
}
}
} | a.cc: In function 'int main()':
a.cc:24:41: error: 'dpc' was not declared in this scope; did you mean 'dp'?
24 | dpc[p][i][j]=dpt[p][i][j]=1000000000;
| ^~~
| dp
a.cc:24:54: error: 'dpt' was not declared in this scope; did you mean 'dp'?
24 | dpc[p][i][j]=dpt[p][i][j]=1000000000;
| ^~~
| dp
a.cc:26:33: error: 'dpc' was not declared in this scope; did you mean 'dp'?
26 | dpc[p][i][i]=dpt[p][i][i]=0;
| ^~~
| dp
a.cc:26:46: error: 'dpt' was not declared in this scope; did you mean 'dp'?
26 | dpc[p][i][i]=dpt[p][i][i]=0;
| ^~~
| dp
|
s367836536 | p00200 | C++ | #include<cstdio>
int costs[100][100][2];
int main(){
int n,m,a,b;
scanf("%d%d",&n,&m);
while(n--){
scanf("%d%d",&a,&b);
scanf("%d%d",&costs[a][b][0],&costs[a][b][1]);
costs[b][a][0]=costs[a][b][0];
costs[b][a][1]=costs[a][b][1];
}
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
for(int k=0;k<m;k++){
costs[i][j][0]=costs[i][k][0]+costs[k][j][0];
costs[j][i][0]=costs[i][j][0];
costs[i][j][1]=costs[i][k][1]+costs[k][j][1];
costs[j][i][1]=costs[i][j][1];
}
}
}
scanf("%d",&n);
while(n--){
scanf("%d&d&d",&a,&b,&k);
printf("%d\n",costs[a][b][k]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:24: error: 'k' was not declared in this scope
26 | scanf("%d&d&d",&a,&b,&k);
| ^
|
s560612770 | p00200 | C++ | #include<algorithm>
#define MAX_M 101
#define MAX_N 301
#define MAX_K 201
#define MAX_INT 1 << 28;
using namespace std;
//dx[wa][wb][XCb`(0:àz, 1:Ô)] = (waÆwbÔÌàz or Ô)
int dx[MAX_N][MAX_N][2];
//p©çqÜÅÌŬàzܽÍÅZÔðÔ·
int tell(int p, int q, int n, int m, int r);
int main(){
//n = üHÌîñÌ, m = wÌ
int n, m;
//üHÌîñðüÍ
while(cin >>n >>m){
if(n == 0 && m == 0) break;
//dx[][][]Ìú»(SÄ-1É·é)
for(int i = 0; i < MAX_N; i++){
for(int j = 0; j < MAX_N; j++){
dx[i][j][0] = -1;
dx[i][j][1] = -1;
}
}
for(int i = 0; i < n; i++){
//a = wa, b = wb, cost = wa`wbÌàz, time = wa`wbÌÔ
int a, b, cost, time;
cin >>a >>b >>cost >>time;
dx[a][b][0] = cost;
dx[a][b][1] = time;
}
//k = â¢í¹Ì
int k;
cin >>k;
for(int i = 0; i < k; i++){
//p = ow, q =
w, r = oÍ·élÌíÞ
int p, q, r;
cin >>p >>q >>r;
cout <<tell(p, q, n, m, r) <<endl;
}
}
return 0;
}
int tell(int p, int q, int n, int m, int r){
//checkendnum[wÌÔ] = ŬàzܽÍÅZÔ(¢mèÌêÍMAX_INT)
int checkendnum[MAX_N];
//checkendi[wÌÔ] = ŬàzܽÍÅZÔªmèµ½©Ç¤©(false:¢mè, true:mè)
bool checkendi[MAX_N] = {false};
//checkendnum[1 ` MAX_N]ðMAX_INTÅú»
for(int i = 0; i < MAX_N; i++){
checkendnum[i] = MAX_INT;
}
//p = ¡²×Ä¢ém[h
int node = p;
//owÍà¤0ÅmèµÄ¢é
checkendnum[node] = 0;
checkendi[node] = true;
//EoðÍmè³ê½m[h = q
while(1){
//SÄÌüHÌîñð²×é
for(int i = 0; i < MAX_N; i++){
//p©çiÉsàzܽÍÔÌîñª èA»êªmèµÄ¢È¯êÎ
if(dx[node][i][r] != -1){
if(checkendi[i] == false){
//¡ÜÅiÌm[hÉüÁÄ¢½óâÌîñÆAVµXV³êéûÌA¬³¢ûðóâÆ·é
checkendnum[i] = min(checkendnum[i], (dx[node][i][r] + checkendnum[node]));
}
//àµÍAp©çiÉsàzܽÍÔÌîñª èA»êªmèµÄ¢È¯êÎ
} else if(dx[i][node][r] != -1){
if(checkendi[i] == false){
//¡ÜÅiÌm[hÉüÁÄ¢½îñÆAVµXV³êéûÌA¬³¢ûðóâÆ·é
checkendnum[i] = min(checkendnum[i], (dx[i][node][r] + checkendnum[node]));
}
}
}
//minnum = mèµÄ¢È¢wÌÅAŬÌàzܽÍÅZÌÔ, mini = minnumðÂwÌÔ
int minnum = MAX_INT;
int mini = -1;
//SÄÌwð²×é
for(int i = 1; i <= m; i++){
//àzܽÍÔªmèµÄ¨ç¸Aminnumæè¬³¢àzܽÍÔðÂÈç
if(checkendi[i] == false && checkendnum[i] < minnum){
minnum = checkendnum[i];
mini = i;
}
}
//miniÌwÌàzܽÍÔðmè
checkendi[mini] = true;
//̲×ém[hðminiÉ·é
node = mini;
//qÌŬàzܽÍÅZÔªmèµ½ÈçI¹(I¹ð)
if(checkendi[q] == true){
break;
}
}
return checkendnum[q];
} | a.cc: In function 'int main()':
a.cc:19:15: error: 'cin' was not declared in this scope
19 | while(cin >>n >>m){
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<algorithm>
+++ |+#include <iostream>
2 | #define MAX_M 101
a.cc:50:25: error: 'cout' was not declared in this scope
50 | cout <<tell(p, q, n, m, r) <<endl;
| ^~~~
a.cc:50:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:50:54: error: 'endl' was not declared in this scope
50 | cout <<tell(p, q, n, m, r) <<endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<algorithm>
+++ |+#include <ostream>
2 | #define MAX_M 101
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.