Submission #1072657

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10726572024-08-24 02:00:13kymBuilding Skyscrapers (CEOI19_skyscrapers)C++14
54 / 100
354 ms24516 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pi;
const int oo = 1'000'000'000'000'000'000ll;
int dx[]={-1,0,1,-1,1,-1,0,1};
int dy[]={-1,-1,-1,0,0,1,1,1};
vector<int>ord;
map<pi,int>idx;
map<pi,bool>done;
int32_t main(){
int n,t;cin>>n>>t;
pi mn={oo,oo};
for(int i=1;i<=n;i++){
int x,y;cin>>x>>y;
idx[{x,y}]=i;
mn=min(mn,make_pair(x,y));
}
priority_queue<pi,vector<pi>,greater<pi>>pq;
pq.push(mn);
done[mn]=1;
while(pq.size()){
pi cur=pq.top();pq.pop();
int x=cur.first,y=cur.second;
ord.push_back(idx[{x,y}]);
for(int k=0;k<8;k++){
int nx=x+dx[k],ny=y+dy[k];
if(idx.find({nx,ny}) != idx.end() && !done[{nx,ny}]){
done[{nx,ny}]=1;
pq.push({nx,ny});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

skyscrapers.cpp: In function 'int32_t main()':
skyscrapers.cpp:34:16: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   34 |  if(ord.size() != n)cout<<"NO\n";
      |     ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...