Submission #704102

# Submission time Handle Problem Language Result Execution time Memory
704102 2023-03-01T15:08:54 Z 1075508020060209tc Coin Collecting (JOI19_ho_t4) C++14
0 / 100
1 ms 308 KB
//#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

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 time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -