제출 #148300

#제출 시각아이디문제언어결과실행 시간메모리
148300youssefbou62이상적인 도시 (IOI12_city)C++14
0 / 100
1084 ms1912 KiB
#include <bits/stdc++.h> // #include "city.h" #pragma GCC optimize ("O3") using namespace std; #define mp make_pair #define fi first #define se second #define all(v) v.begin(),v.end() #define allarr(a) a , a + n #define ll long long #define ull unsigned long long #define pb push_back #define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL) typedef pair<int, int> pi; typedef pair<ll,ll> pll; typedef pair<int,pi> trp ; typedef vector<pi> vpi; typedef vector<pll> vpll ; // int ab (int x ) { return (x>0?x:-x); } ll ans ; int root ; const int N = 2e5+5; // int visited[N] ; const ll mod = 1e9 ; ll x[N],y[N]; // void bfs(int root ){ // int u = root; // queue<int> q; // q.push(u); // visited[u]=0; // int dx [][2] ={{0,-1},{0,1},{1,0},{-1,0}}; // while(!q.empty()){ // u = q.front(); // q.pop(); // // cout << visited[u]<<" " << ans <<endl; // if( u >= root )ans += visited[u] , ans %= mod; // for(int i = 0 ; i < 4 ; i++ ){ // int xx = x[u]+dx[i][0] ; // int yy = y[u]+dx[i][1] ; // if( xx >= 0 && yy >= 0 &&notE[xx][yy]!=-1&& visited[notE[xx][yy]]==-1 ){ // visited[notE[xx][yy]] = visited[u]+1; // q.push(notE[xx][yy]); // } // } // } // } int DistanceSum(int N, int *X, int *Y){ ll sum = 0 ; for(int i = 0 ; i < N ; i++ ){ x[i] = X[i] ; y[i] = Y[i] ; } ll ans = 0 ; for(int i = 0 ; i < N ; i++ ){ for(int j = i + 1 ; j < N ; j++ ){ ans += abs(x[j]-x[i])+abs(y[j]-y[i]) ; ans %= mod ; } } return ans; } // int main(){ // int n ; cin >> n ; for(int i = 0 ; i < n ; i++ )cin >> x[i]>>y[i] ; cout << DistanceSum(n,x,y)<<endl; // }

컴파일 시 표준 에러 (stderr) 메시지

city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:52:5: warning: unused variable 'sum' [-Wunused-variable]
  ll sum = 0 ; 
     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...