# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108383 | nxteru | Jakarta Skyscrapers (APIO15_skyscraper) | C++14 | 701 ms | 50472 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define B 173
struct t{
int c,x,y;
};
int n,m,b[30005],p[30005];
vector<int>g[30005];
int vis[30005],d[30005][200],q[30005][200];
int main(void){
scanf("%d%d",&n,&m);
for(int i=0;i<m;i++){
scanf("%d%d",b+i,p+i);
g[b[i]].push_back(i);
}
for(int i=0;i<n;i++){
vis[i]=-1;
for(int j=0;j<B;j++)d[i][j]=-1;
}
for(int i=0;i<m;i++)for(int j=0;j<=n/B;j++)q[i][j]=-1;
queue<t>bfs;
bfs.push(t{0,b[0],0});
while(!bfs.empty()){
int c=bfs.front().c,x=bfs.front().x,y=bfs.front().y,z=(x-b[y]%p[y])/p[y];
bfs.pop();
if(x<0||n<=x)continue;
if(vis[x]==-1){
vis[x]=c;
for(int i=0;i<g[x].size();i++){
int u=g[x][i];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |