이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define pii pair<int, int>
#define ppi pair<int, pii>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
const ll maxn = 1e5+5;
const ll maxm = 2e5+5;
map<pii, bool> occ; // the special dp[i][j] state (if it is alr determined or not)
vector<int> dpv(maxn);
priority_queue<ppi, vector<ppi>, greater<ppi> > pq;
map<pii, int> vord;
struct edge{
int to, c, p;
int idc; // for that node, the rank of the color
bool operator <(edge b){
return c<b.c;
}
};
vector<edge> e[maxn];
vector<vector<int> > ec[maxm];
int n, m;
signed main(){
cin>>n>>m;
REP(i, m){
int u, v, c, p; cin>>u>>v>>c>>p;
e[u].pb({v, c, p, 0});
e[v].pb({u, c, p, 0});
}
REP1(i, n){
sort(ALL(e[i]));
int cnt = 1;
REP(j, SZ(e[i])){
if (j!=0 && e[i][j].c!=e[i][j-1].c){
cnt++;
}
e[i][j].idc = cnt;
}
ec[i].resize(cnt+1);
REP(j, SZ(e[i])){
ec[i][e[i][j].idc].pb(j);
}
}
// compute dp
pq.push({0, {1, 0}});
while(pq.size()){
ppi tmp = pq.top(); pq.pop();
if (occ.count(tmp.s)) continue;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |