Submission #962111

#TimeUsernameProblemLanguageResultExecution timeMemory
962111IUA_HasinRail (IOI14_rail)C++17
0 / 100
50 ms648 KiB
#include "rail.h" #include <bits/stdc++.h> #define endl "\n" #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define ll long long using namespace std; const ll M = 5001; ll vis[M]; void findLocation(int N, int first, int location[], int stype[]) { location[0] = first; stype[0] = 1; vector<pair<ll, ll>> v; for(int i=1; i<N; i++){ ll a = getDistance(0, i); v.push_back({a, i}); } ll mn = v[0].first; ll mnind = v[0].second; for(int i=0; i<v.size(); i++){ ll a = v[i].first; ll b = v[i].second; // cout << a << " " << b << endl; if(a<mn){ mn = a; mnind = b; } } // cout<<endl; // cout << mn << " " << mnind << endl; // cout<<endl; location[mnind] = first+mn; stype[mnind] = 2; for(int i=1; i<N; i++){ if(i!=mnind){ ll a = getDistance(0, i); ll b = getDistance(mnind, i); // cout << a << " " << b << endl; if((mn+b)==a){ stype[i] = 1; location[i] = location[mnind]-b; } } } // cout<<endl; // for(int i=0; i<N; i++){ // cout << stype[i] << " " << location[i] << endl; // } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0; i<v.size(); i++){
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...