Submission #39522

#TimeUsernameProblemLanguageResultExecution timeMemory
39522smu201111192Tropical Garden (IOI11_garden)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <cstdio> #include <cassert> #include <string> #include <sstream> #include <algorithm> #include <set> #include <numeric> #include <cmath> #include <map> #include <vector> #include <queue> #include <stack> #include <cstring> #include <queue> #include <numeric> #include <iomanip> #define ll long long using namespace std; map<pair<int,int>,int> mp; const int dy[4]={0,0,1,-1}; const int dx[4]={1,-1,0,0}; vector<int> adj[4005]; const int mod = 1000000000; int dist[4005]; int convert[4005]; void addEdge(int u,int v){ adj[u].push_back(v); adj[v].push_back(u); } int bfs(int here,int n){ memset(dist,-1,sizeof(dist)); dist[here] = 0; queue<int> q; q.push(here); while(!q.empty()){ int here = q.front(); q.pop(); for(int i=0;i<adj[here].size();i++){ int there = adj[here][i]; if(dist[there] == -1){ dist[there] = dist[here] + 1; q.push(there); } } } int ret = 0; for(int i = 0;i<4000;i++){ //if(i > here){ ret += max(dist[i],0); ret %= mod; //} } return ret; } int DistanceSum(int N, int *X, int *Y) { for(int i=0;i<N;i++){ mp[make_pair(Y[i],X[i])]; } int id = 0; for(auto it = mp.begin();it!=mp.end();it++){ it->second = ++id; } for(int i=0;i<N;i++){ int x = X[i]; int y = Y[i]; for(int k=0;k<4;k++){ int ny = y + dy[k]; int nx = x + dx[k]; if(mp.find(make_pair(ny,nx)) != mp.end()){ addEdge(mp[make_pair(y,x)],mp[make_pair(ny,nx)]); } } } int tot = 0; for(int i=1;i<=N;i++){ tot += bfs(i,N); tot %= mod; } return tot; }

Compilation message (stderr)

garden.cpp: In function 'int bfs(int, int)':
garden.cpp:38:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<adj[here].size();i++){
                     ~^~~~~~~~~~~~~~~~~
/tmp/ccn6UIlA.o: In function `main':
grader.cpp:(.text.startup+0x38): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status