Submission #9458

# Submission time Handle Problem Language Result Execution time Memory
9458 2014-09-28T06:35:00 Z levant916 Your life (kriii2_Y) C++14
0 / 4
0 ms 2064 KB
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int dp[100001];
int M, N;

int main(void) {
	
	int x, y;
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		cin >> x >> y;
		if (dp[y] == 0) {
			dp[y] = dp[x] + 1;
		}
		else if( dp[y] > dp[x] + 1){
			dp[y] = dp[x] + 1;
		}
	}
	cout << dp[N] << endl;
	
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -