Submission #104432

#TimeUsernameProblemLanguageResultExecution timeMemory
104432CaroLindaDreaming (IOI13_dreaming)C++14
0 / 100
68 ms10232 KiB
#include <bits/stdc++.h> #include "dreaming.h" #define MAXN 100005 #define lp(i,a,b) for(int i = a ; i < b ; i++) #define pb push_back #define pii pair<int,int> #define ff first #define ss second using namespace std; //declarations int N , M , L , c1=-1, c2=-1, C; int degree[MAXN] ; int mat[2][MAXN] ; bool marc[MAXN] ; vector<pii> adj[MAXN] ; void dfs(int x) { marc[x] = 1 ; lp(i,0,adj[x].size() ) { int v = adj[x][i].ff , w = adj[x][i].ss ; if(mat[C][v] > 0) continue ; mat[C][v] = mat[C][x] + w ; dfs(v) ; } } int travelTime( int n , int m , int l , int A[] , int B[] , int T[] ) { N = n , M = m , L = l; lp(i,0,M) { int a = A[i] , b = B[i] ; adj[a].pb( pii(b, T[i]) ) ; adj[b].pb( pii(a, T[i]) ) ; degree[a] ++ ; degree[b]++ ; } lp(i,0,N) if( degree[i] == 1) if(!marc[i]) { //I found a set! if(c1 != -1) c2 = i , C = 1; else c1 = i , C = 0 ; dfs(i) ; } int d1 = *max_element(mat[0] , mat[0] + N) ; int d2 = *max_element(mat[1] , mat[1]+N) ; int radio1 = d1, radio2 = d2; lp(i,0,N) radio1 = min( radio1 , max( mat[0][i] , d1 - mat[0][i] ) ) ; lp(i,0,N) radio2 = min( radio2 , max(mat[1][i] , d2 - mat[1][i] ) ) ; return radio1+radio2+L ; } /*int main() { int n , m , l , a[MAXN] , b[MAXN] , t[MAXN] ; scanf("%d %d %d", &n, &m, &l) ; lp(i,0,m) scanf("%d%d%d", &a[i] , &b[i] , &t[i]) ; printf("%d\n",travelTime(n,m,l,a,b,t)) ; }*/

Compilation message (stderr)

dreaming.cpp: In function 'void dfs(int)':
dreaming.cpp:5:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define lp(i,a,b) for(int i = a ; i < b ; i++)
dreaming.cpp:26:8:
     lp(i,0,adj[x].size() )
        ~~~~~~~~~~~~~~~~~             
dreaming.cpp:26:5: note: in expansion of macro 'lp'
     lp(i,0,adj[x].size() )
     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...