Submission #704102

#TimeUsernameProblemLanguageResultExecution timeMemory
7041021075508020060209tcCoin Collecting (JOI19_ho_t4)C++14
0 / 100
1 ms308 KiB
//#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; pair<int,int>ar[500005]; int vsa[500005]; int vsb[500005]; signed main(){ cin>>n; for(int i=1;i<=n+n;i++){ cin>>ar[i].X>>ar[i].Y; } vector<pair<int,pair<int,int>>>seq; for(int j=1;j<=n;j++){ for(int i=1;i<=n+n;i++){ int cst=abs(ar[i].X-j)+abs(ar[i].Y-1); seq.push_back({cst,{i,j}}); } } for(int j=1;j<=n;j++){ for(int i=1;i<=n+n;i++){ int cst=abs(ar[i].X-j)+abs(ar[i].Y-2); seq.push_back({cst,{i,j+n}}); } } sort(seq.begin(),seq.end()); int ans=0; for(int i=0;i<seq.size();i++){ if(vsa[seq[i].second.first]==0&&vsb[seq[i].second.second]==0){ ans+=seq[i].first; } } cout<<ans<<endl; }

Compilation message (stderr)

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