Submission #954782

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9547822024-03-28 14:23:34BbtTJakarta Skyscrapers (APIO15_skyscraper)C++17
0 / 100
1 ms440 KiB
#include<bits/stdc++.h>
using namespace std;
struct edge{
int n,w;
};
bool operator<(edge a,edge b){
return a.w<b.w;
}
int main(){
int N,M;
cin>>N>>M;
vector<vector<edge>> edges(N);
for(int i=0;i<M;i++){
int b,p;
scanf("%d%d",&b,&p);
vector<edge> temp;
for(int j=b-p;j>=0;j-=p)temp.push_back((edge){j,(b-j)/p});
for(int j=b+p;j<N;j+=p)temp.push_back((edge){j,(j-b)/p});
edges.push_back(temp);
edges[b].push_back((edge){edges.size()-1,0});
}
bitset<30005> vis;
priority_queue<edge> pq;
vis[0]=1;
pq.push((edge){0,0});
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:25:47: warning: narrowing conversion of '(edges.std::vector<std::vector<edge> >::size() - 1)' from 'std::vector<std::vector<edge> >::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
   25 |         edges[b].push_back((edge){edges.size()-1,0});
      |                                   ~~~~~~~~~~~~^~
skyscraper.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d%d",&b,&p);
      |         ~~~~~^~~~~~~~~~~~~~
#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...