제출 #335072

#제출 시각아이디문제언어결과실행 시간메모리
335072daniel920712Rail (IOI14_rail)C++14
30 / 100
3087 ms132336 KiB
#include "rail.h"
#include <stdio.h>
#include <stdlib.h>
#include <queue>
#include <utility>
#include <unordered_set>
using namespace std;
priority_queue < pair < pair < int , int > , pair < int , int >  > , vector < pair < pair < int , int > , pair < int , int > > > , greater < pair < pair < int , int > , pair < int , int > > > > all;

bool have[5005];
unordered_set < int > use;
void findLocation(int N, int first, int location[], int stype[])
{
    int x,y,z,i,j,t,w;
    location[0]=first;
    stype[0]=1;
    all.push(make_pair(make_pair(0,0),make_pair(0,-1)));
    for(i=0;i<N;i++) use.insert(i);
    while(!all.empty())
    {
        y=all.top().first.first;
        x=all.top().second.first;
        z=all.top().second.second;
        w=all.top().first.second;
        all.pop();
        if(have[x]) continue;
        have[x]=1;
        use.erase(x);
        if(z!=-1)
        {
            if(stype[z]==1)
            {
                stype[x]=2;
                location[x]=location[z]+w;
            }
            else
            {
                stype[x]=1;
                location[x]=location[z]-w;
            }
        }
        for(auto i:use)
        {
            //if(have[i]) continue;
            t=getDistance(x,i);
            all.push(make_pair(make_pair(y+t,t),make_pair(i,x)));
        }

    }

}

컴파일 시 표준 에러 (stderr) 메시지

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:14:17: warning: unused variable 'j' [-Wunused-variable]
   14 |     int x,y,z,i,j,t,w;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...