Submission #713490
Source Code Expand
#include<iostream>
#include<vector>
using namespace std;
int main(void){
int N;
int M;
vector<int> A;
vector<int> B;
vector<int> C;
vector<int> cost;
cin >> N >> M;
int count=0;
for (int i = 0; i < M; i++)
{
cin >> C[i] >> A[i] >> B[i];
}
for(int i = 0; i < N; i++){
if (i == 0)
cost[i] = 0;
for (int j = 0; j < M; j++){
if (B[j] == i){
if (C[j] == 0)
cost[i] = cost[A[j]] + 1;
else{
count++;
cost[i] = cost[A[j]] + count;
}
}
}
cout << cost[i] << endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - 高橋くんと不思議な道 |
| User | ken260 |
| Language | C++14 (GCC 5.4.1) |
| Score | 0 |
| Code Size | 561 Byte |
| Status | RE |
| Exec Time | 204 ms |
| Memory | 256 KiB |
Judge Result
| Set Name | Sample | Subtask1 | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt |
| Subtask1 | sample1.txt, sample2.txt, sample3.txt, A1.txt, A10.txt, A11.txt, A12.txt, A13.txt, A14.txt, A15.txt, A16.txt, A17.txt, A2.txt, A3.txt, A4.txt, A5.txt, A6.txt, A7.txt, A8.txt, A9.txt, B1.txt, B10.txt, B11.txt, B12.txt, B13.txt, B14.txt, B15.txt, B16.txt, B17.txt, B18.txt, B19.txt, B2.txt, B20.txt, B21.txt, B22.txt, B23.txt, B24.txt, B25.txt, B26.txt, B4.txt, B5.txt, B6.txt, B7.txt, B8.txt, B9.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| A1.txt | RE | 188 ms | 256 KiB |
| A10.txt | RE | 188 ms | 256 KiB |
| A11.txt | RE | 191 ms | 256 KiB |
| A12.txt | RE | 188 ms | 256 KiB |
| A13.txt | RE | 187 ms | 256 KiB |
| A14.txt | RE | 187 ms | 256 KiB |
| A15.txt | RE | 188 ms | 256 KiB |
| A16.txt | RE | 188 ms | 256 KiB |
| A17.txt | RE | 188 ms | 256 KiB |
| A2.txt | RE | 190 ms | 256 KiB |
| A3.txt | RE | 187 ms | 256 KiB |
| A4.txt | RE | 189 ms | 256 KiB |
| A5.txt | RE | 188 ms | 256 KiB |
| A6.txt | RE | 188 ms | 256 KiB |
| A7.txt | RE | 189 ms | 256 KiB |
| A8.txt | RE | 189 ms | 256 KiB |
| A9.txt | RE | 187 ms | 256 KiB |
| B1.txt | RE | 190 ms | 256 KiB |
| B10.txt | RE | 188 ms | 256 KiB |
| B11.txt | RE | 188 ms | 256 KiB |
| B12.txt | RE | 189 ms | 256 KiB |
| B13.txt | RE | 190 ms | 256 KiB |
| B14.txt | RE | 190 ms | 256 KiB |
| B15.txt | RE | 190 ms | 256 KiB |
| B16.txt | RE | 189 ms | 256 KiB |
| B17.txt | RE | 189 ms | 256 KiB |
| B18.txt | RE | 187 ms | 256 KiB |
| B19.txt | RE | 188 ms | 256 KiB |
| B2.txt | RE | 188 ms | 256 KiB |
| B20.txt | RE | 188 ms | 256 KiB |
| B21.txt | RE | 188 ms | 256 KiB |
| B22.txt | RE | 188 ms | 256 KiB |
| B23.txt | RE | 188 ms | 256 KiB |
| B24.txt | RE | 188 ms | 256 KiB |
| B25.txt | RE | 188 ms | 256 KiB |
| B26.txt | RE | 186 ms | 256 KiB |
| B4.txt | RE | 186 ms | 256 KiB |
| B5.txt | RE | 191 ms | 256 KiB |
| B6.txt | RE | 188 ms | 256 KiB |
| B7.txt | RE | 204 ms | 256 KiB |
| B8.txt | RE | 193 ms | 256 KiB |
| B9.txt | RE | 190 ms | 256 KiB |
| sample1.txt | RE | 187 ms | 256 KiB |
| sample2.txt | RE | 189 ms | 256 KiB |
| sample3.txt | RE | 189 ms | 256 KiB |