提交记录 9818


用户 题目 状态 得分 用时 内存 语言 代码长度
evenbao noi19a. 【NOI2019】回家路线 Time Limit Exceeded 70 1 s 50068 KB C++ 2.36 KB
提交时间 评测时间
2019-07-16 17:12:14 2020-08-01 01:54:03
#include<bits/stdc++.h>
using namespace std;

#ifndef LOCAL
		#define eprintf(...) fprintf(stderr, _VA_ARGS_)
#else
		#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll , int> pli;
typedef pair<ll , ll> pll;
typedef long double ld;
typedef vector< int > vi;
typedef unsigned long long ull;
#define mp make_pair
#define fi first
#define se second
const int N = 2e6 + 10;
const int INF = 2e9;

struct info {
		int u , v;
		int L , R;
} a[N];

struct edge {
		int to , w , nxt;
} e[N << 1];

int n , m , S , T , tot , A , B , C;
int head[N] , dist[N];
bool visited[N];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x) {
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}
inline void addedge(int u , int v , int w) {
		++tot;
		e[tot] = (edge){v , w , head[u]};
		head[u] = tot;
} 
inline void dijkstra(int s) {
		priority_queue< pii , vector< pii > , greater< pii > > q;
		q.push(mp(0 , s));
		for (int i = 1; i <= T; ++i)
				dist[i] = INF;
		dist[s] = 0;	
		while (!q.empty()) {
				int cur = q.top().se; q.pop();
				if (visited[cur]) continue;
				visited[cur] = true;
				for (int i = head[cur]; i; i = e[i].nxt) {
						int v = e[i].to , w = e[i].w;
						if (dist[cur] + w < dist[v]) {
								dist[v] = dist[cur] + w;
								q.push(mp(dist[v] , v));
						}
				}
		}
}

int main() {
		
//		#ifndef evenbao
//		freopen("route.in" , "r" , stdin);
//		freopen("route.out" , "w" , stdout);
//		#endif
			
		read(n); read(m); read(A); read(B); read(C);
		for (int i = 1; i <= m; ++i) {
				read(a[i].u); 
				read(a[i].v);
				read(a[i].L);
				read(a[i].R);	
		}
		for (int i = 1; i <= m; ++i) {
				for (int j = 1; j <= m; ++j) {
						if (i == j) continue;
						if (a[j].u == a[i].v && a[j].L >= a[i].R)
								addedge(i , j , A * (a[j].L - a[i].R) * (a[j].L - a[i].R) + B * (a[j].L - a[i].R) + C);
				}		
		}
		S = m + 1 , T = S + 1;
		for (int i = 1; i <= m; ++i)
				if (a[i].u == 1) addedge(S , i , A * a[i].L * a[i].L + B * a[i].L + C);
		for (int i = 1; i <= m; ++i)
				if (a[i].v == n) addedge(i , T , a[i].R);
		dijkstra(S);
		printf("%d\n" , dist[T]);
		
		return 0;
	
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #151.23 us64 KBAcceptedScore: 5

Testcase #257.63 us64 KBAcceptedScore: 5

Testcase #357.84 us64 KBAcceptedScore: 5

Testcase #451.59 us64 KBAcceptedScore: 5

Testcase #521.281 ms4 MB + 500 KBAcceptedScore: 5

Testcase #613.279 ms1 MB + 776 KBAcceptedScore: 5

Testcase #725.252 ms5 MB + 888 KBAcceptedScore: 5

Testcase #816.357 ms3 MB + 292 KBAcceptedScore: 5

Testcase #924.549 ms7 MB + 84 KBAcceptedScore: 5

Testcase #1012.157 ms1 MB + 580 KBAcceptedScore: 5

Testcase #1131.321 ms8 MB + 160 KBAcceptedScore: 5

Testcase #1220.948 ms4 MB + 196 KBAcceptedScore: 5

Testcase #1323.673 ms5 MB + 396 KBAcceptedScore: 5

Testcase #1427.68 ms6 MB + 216 KBAcceptedScore: 5

Testcase #151 s48 MB + 916 KBTime Limit ExceededScore: 0

Testcase #161 s48 MB + 916 KBTime Limit ExceededScore: 0

Testcase #171 s48 MB + 916 KBTime Limit ExceededScore: 0

Testcase #181 s48 MB + 916 KBTime Limit ExceededScore: 0

Testcase #191 s48 MB + 916 KBTime Limit ExceededScore: 0

Testcase #201 s48 MB + 916 KBTime Limit ExceededScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-30 16:39:52 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠