# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550253 | Antekb | Treatment Project (JOI20_treatment) | C++14 | 3079 ms | 5968 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>
#define st first
#define nd second
using namespace std;
using ll = long long;
const int N=1<<17;
const ll INF=1e18;
ll dist[N];
bool vis[N];
int main(){
int l, n;
cin>>l>>n;
vector<pair<pair<int, int>, pair<int, int>> > V(n);
for(int i=0; i<n; ++i){
cin>>V[i].nd.st>>V[i].st.st>>V[i].st.nd>>V[i].nd.nd;
V[i].st.st--;
}
for(int i=0; i<n; i++){
if(V[i].st.st)dist[i]=INF;
else dist[i]=V[i].nd.nd;
}
for(int ii=0; ii<n; ii++){
int opt=0;
for(int j=0; j<n; j++){
//cout<<dist[j]<<" \n"[j==n-1];
if(!vis[j] && (vis[opt] || dist[j]<dist[opt]))opt=j;
}
vis[opt]=1;
if(V[opt].st.nd==l && dist[opt]!=INF){
cout<<dist[opt];
# | 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... |