Submission #1026879


Source Code Expand

//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n, m;
int st, en;

struct EDGE
{
	int s, e, v, re, rv;
	EDGE(){}
	EDGE(int s, int e, int v, int re, int rv):s(s), e(e), v(v), re(re), rv(rv){}
};

vector<EDGE> edge[300000];

int rd[300000];
int d[300000];
int check[300000];
priority_queue<pii, vector<pii>, greater<pii>> pq;

int main()
{
	int i, j, k, l;
	cin>>n>>m>>st>>en;
	for(i=0;i<m;i++)
	{
		vector<int> a, b;
		vector<int> s;
		int u;
		scanf("%d", &u);
		a.resize(u), b.resize(u);
		s.resize(u);
		for(j=0;j<u;j++) scanf("%d", &a[j]);
		for(j=0;j<u-1;j++) scanf("%d", &b[j]), s[j+1]=b[j];
		partial_sum(all(s), s.begin());
		for(j=0;j<u-1;j++)
		{
			edge[a[j]].emplace_back(a[j], a[j+1], b[j], a[0], s[j+1]);
			edge[a[j+1]].emplace_back(a[j+1], a[j], b[j], a[u-1], s[u-1]-s[j]);
		}
	}
	memset(rd, 0x3f, sizeof(rd));
	rd[en]=0;
	pq.emplace(rd[en], en);
	while(pq.size())
	{
		int now=pq.top().second;
		pq.pop();
		if(check[now]) continue;
		check[now]=1;
		for(auto e : edge[now])
		{
			if(!check[e.e] && rd[e.e] > rd[now]+e.v) rd[e.e]=rd[now]+e.v, pq.emplace(rd[e.e], e.e);
		}
	}
	memset(d, 0x3f, sizeof(d));
	memset(check, 0, sizeof(check));
	d[en]=0;
	pq.emplace(d[en], en);
	while(pq.size())
	{
		int now=pq.top().second;
		pq.pop();
		if(check[now]) continue;
		check[now]=1;
		for(auto e : edge[now])
		{
			if(!check[e.e] && d[e.e] > max(d[now]+e.v, e.rv+rd[e.re])) d[e.e]=max(d[now]+e.v, e.rv+rd[e.re]), pq.emplace(d[e.e], e.e);
		}
	}
	cout<<d[st]<<endl;
	return 0;
}
//*/

Submission Info

Submission Time
Task C - メンテナンス明け
User polequoll
Language C++11 (GCC 4.9.2)
Score 100
Code Size 2160 Byte
Status AC
Exec Time 65 ms
Memory 14116 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:57:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &u);
                  ^
./Main.cpp:60:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   for(j=0;j<u;j++) scanf("%d", &a[j]);
                                      ^
./Main.cpp:61:53: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   for(j=0;j<u-1;j++) scanf("%d", &b[j]), s[j+1]=b[j];
                                                     ^

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 50 / 50 50 / 50
Status
AC × 52
AC × 6
Set Name Test Cases
Subtask1 small/00_sample00, small/00_sample01, small/00_sample02, small/10_small-0000, small/10_small-0001, small/10_small-0002, small/10_small-0003, small/10_small-0004, small/10_small-0005, small/10_small-0006, small/10_small-0007, small/10_small-0008, small/10_small-0009, small/10_small-0010, small/10_small-0011, small/10_small-0012, small/10_small-0013, small/10_small-0014, small/10_small-0015, small/10_small-0016, small/10_small-0017, small/10_small-0018, small/10_small-0019, small/30_max_small, small/40_simple_0000, small/40_simple_0001, small/40_simple_0002, small/40_simple_0003, small/40_simple_0004, small/40_simple_0005, small/40_simple_0006, small/40_simple_0007, small/40_simple_0008, small/40_simple_0009, small/40_simple_0010, small/40_simple_0011, small/40_simple_0012, small/40_simple_0013, small/40_simple_0014, small/40_simple_0015, small/40_simple_0016, small/40_simple_0017, small/40_simple_0018, small/40_simple_0019, small/90_dijkstra_killer_00, small/90_dijkstra_killer_01, small/91_tayama_killer_00, small/91_tayama_killer_01, small/91_tayama_killer_02, small/91_tayama_killer_03, small/91_tayama_killer_04, small/91_tayama_killer_05
Subtask2 large/20_large-00, large/20_large-01, large/20_large-02, large/20_large-03, large/20_large-04, large/31_max_large
Case Name Status Exec Time Memory
large/20_large-00 AC 65 ms 14108 KB
large/20_large-01 AC 62 ms 14044 KB
large/20_large-02 AC 61 ms 14116 KB
large/20_large-03 AC 63 ms 13984 KB
large/20_large-04 AC 64 ms 14108 KB
large/31_max_large AC 43 ms 12712 KB
small/00_sample00 AC 32 ms 11300 KB
small/00_sample01 AC 33 ms 11296 KB
small/00_sample02 AC 31 ms 11248 KB
small/10_small-0000 AC 31 ms 11300 KB
small/10_small-0001 AC 31 ms 11376 KB
small/10_small-0002 AC 32 ms 11256 KB
small/10_small-0003 AC 31 ms 11416 KB
small/10_small-0004 AC 32 ms 11300 KB
small/10_small-0005 AC 32 ms 11292 KB
small/10_small-0006 AC 31 ms 11252 KB
small/10_small-0007 AC 30 ms 11252 KB
small/10_small-0008 AC 31 ms 11416 KB
small/10_small-0009 AC 31 ms 11296 KB
small/10_small-0010 AC 31 ms 11248 KB
small/10_small-0011 AC 33 ms 11296 KB
small/10_small-0012 AC 34 ms 11292 KB
small/10_small-0013 AC 32 ms 11300 KB
small/10_small-0014 AC 32 ms 11296 KB
small/10_small-0015 AC 32 ms 11300 KB
small/10_small-0016 AC 32 ms 11412 KB
small/10_small-0017 AC 32 ms 11304 KB
small/10_small-0018 AC 32 ms 11292 KB
small/10_small-0019 AC 32 ms 11296 KB
small/30_max_small AC 30 ms 11252 KB
small/40_simple_0000 AC 30 ms 11248 KB
small/40_simple_0001 AC 32 ms 11296 KB
small/40_simple_0002 AC 32 ms 11252 KB
small/40_simple_0003 AC 32 ms 11420 KB
small/40_simple_0004 AC 31 ms 11248 KB
small/40_simple_0005 AC 32 ms 11420 KB
small/40_simple_0006 AC 33 ms 11252 KB
small/40_simple_0007 AC 32 ms 11292 KB
small/40_simple_0008 AC 32 ms 11296 KB
small/40_simple_0009 AC 31 ms 11416 KB
small/40_simple_0010 AC 32 ms 11296 KB
small/40_simple_0011 AC 32 ms 11296 KB
small/40_simple_0012 AC 31 ms 11296 KB
small/40_simple_0013 AC 32 ms 11252 KB
small/40_simple_0014 AC 31 ms 11296 KB
small/40_simple_0015 AC 32 ms 11236 KB
small/40_simple_0016 AC 31 ms 11420 KB
small/40_simple_0017 AC 32 ms 11300 KB
small/40_simple_0018 AC 30 ms 11292 KB
small/40_simple_0019 AC 32 ms 11288 KB
small/90_dijkstra_killer_00 AC 32 ms 11296 KB
small/90_dijkstra_killer_01 AC 30 ms 11252 KB
small/91_tayama_killer_00 AC 30 ms 11252 KB
small/91_tayama_killer_01 AC 30 ms 11300 KB
small/91_tayama_killer_02 AC 30 ms 11292 KB
small/91_tayama_killer_03 AC 30 ms 11252 KB
small/91_tayama_killer_04 AC 31 ms 11296 KB
small/91_tayama_killer_05 AC 32 ms 11252 KB