| Task: | Bus lines |
| Sender: | Team Purkka |
| Submission time: | 2015-09-30 19:24:55 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.18 s | details |
| #2 | WRONG ANSWER | 0.78 s | details |
| #3 | RUNTIME ERROR | 0.18 s | details |
| #4 | RUNTIME ERROR | 0.19 s | details |
| #5 | RUNTIME ERROR | 0.21 s | details |
| #6 | RUNTIME ERROR | 0.18 s | details |
| #7 | RUNTIME ERROR | 0.18 s | details |
| #8 | RUNTIME ERROR | 0.20 s | details |
| #9 | WRONG ANSWER | 0.76 s | details |
| #10 | TIME LIMIT EXCEEDED | -- | details |
| #11 | WRONG ANSWER | 0.40 s | details |
| #12 | RUNTIME ERROR | 0.17 s | details |
| #13 | TIME LIMIT EXCEEDED | -- | details |
| #14 | TIME LIMIT EXCEEDED | -- | details |
| #15 | TIME LIMIT EXCEEDED | -- | details |
| #16 | TIME LIMIT EXCEEDED | -- | details |
| #17 | TIME LIMIT EXCEEDED | -- | details |
| #18 | TIME LIMIT EXCEEDED | -- | details |
| #19 | TIME LIMIT EXCEEDED | -- | details |
| #20 | TIME LIMIT EXCEEDED | -- | details |
| #21 | TIME LIMIT EXCEEDED | -- | details |
| #22 | TIME LIMIT EXCEEDED | -- | details |
| #23 | TIME LIMIT EXCEEDED | -- | details |
| #24 | TIME LIMIT EXCEEDED | -- | details |
| #25 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'void haku(int*, vint*, int, int)':
input/code.cpp:15:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < v[s].size(); i++)
^Code
#include <iostream>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
void haku(int *t, vint *v, int s, int c) {
if (t[s]) return;
t[s] = c;
for (int i = 0; i < v[s].size(); i++)
haku(t, v, v[s][i], c);
}
int main()
{
cin.sync_with_stdio(false);
int n,m,k;
cin>>n>>m>>k;
pint y[m];
bool poistettu[m];
for(int i=0;i<m;i++)poistettu[i]=0;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
a--;b--;
y[i]=make_pair(a,b);
}
pint poistetut[k];
for(int i=0;i<k;i++){
int j;
cin>>j;
j--;
poistetut[i]=y[j];
poistettu[j]=1;
}
vint yv[n];
for(int i=0;i<m;i++){
if(!poistettu[i]){
yv[y[i].first].push_back(y[i].second);
yv[y[i].second].push_back(y[i].first);
}
}
int t[n];
for(int i=0;i<n;i++)t[i]=0;
int c=0;
for(int i=0;i<n;i++){
if(t[i])continue;
haku(t,yv,i,c++);
}
int muutto[c];
for(int i=0;i<c;i++)muutto[i]=i;
for(int i=0;i<n;i++)cout<<(i+1)<<" on "<<(muutto[i]+1)<<endl;
int tul[k];
tul[0]=c;
int koh=1;
int d=c;
for(int i=k-1;i>0;i--){
int a=muutto[t[poistetut[i].first]];
int b=muutto[t[poistetut[i].second]];
if(a!=b){
cout<<"connected "<<a<<" to "<<b<<endl;
d--;
for(int j=0;j<c;j++){
if(muutto[j]==a)muutto[j]=b;
}
}
tul[koh++]=d;
}
for(int i=k-1;i>=0;i--)cout<<tul[i]<<" ";
cout<<endl;
return 0;
}
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 42712 59669 3327 27393 5935 40762 40800 33005 34639 19131 2850 ... |
| correct output |
|---|
| 2937 2937 2937 2937 2937 2938 ... |
| user output |
|---|
| (empty) |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 76287 96164 41787 58072 25022 46787 62110 30339 48282 73612 52159 ... |
| correct output |
|---|
| 6969 6969 6969 6969 6970 6970 ... |
| user output |
|---|
| 1 on 1 2 on 2 3 on 3 4 on 4 5 on 5 ... |
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 18336 40887 13506 13131 7525 2330 5108 1053 8852 2934 4194 ... |
| correct output |
|---|
| 208 208 208 208 208 208 208 20... |
| user output |
|---|
| (empty) |
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 10251 91042 26842 3863 3691 4990 6580 3722 1896 1240 6558 ... |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 75339 65466 44858 37059 62665 14790 65885 12864 58973 70022 19675 ... |
| correct output |
|---|
| 16333 16334 16335 16336 16336 ... |
| user output |
|---|
| (empty) |
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 2086 66519 52411 361 1822 723 1145 1914 914 2075 1759 ... |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 38126 95132 68427 15424 17170 2781 12706 33834 13802 13405 25848 ... |
| correct output |
|---|
| 246 246 246 246 246 246 246 24... |
| user output |
|---|
| (empty) |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 13057 86973 49052 5610 4743 1062 7853 6391 10993 5814 10957 ... |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 88876 29498 13976 16610 72903 2735 47496 44512 709 3413 60896 ... |
| correct output |
|---|
| 59380 59381 59382 59383 59384 ... |
| user output |
|---|
| 1 on 1 2 on 2 3 on 3 4 on 4 5 on 5 ... |
Test 10
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 54386 40792 30938 11372 35684 36569 35851 24804 11443 2433 7140 ... |
| correct output |
|---|
| 15500 15501 15502 15502 15503 ... |
| user output |
|---|
| (empty) |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 18637 33277 33188 6803 17956 14954 12901 7331 13934 15280 6584 ... |
| correct output |
|---|
| 560 560 560 561 561 561 561 56... |
| user output |
|---|
| 1 on 1 2 on 2 3 on 3 4 on 4 5 on 5 ... |
Test 12
Verdict: RUNTIME ERROR
| input |
|---|
| 2637 72943 18160 897 1538 720 703 1919 2314 1803 1644 ... |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 87033 99257 40607 9856 32664 94458 61822 19892 ... |
| correct output |
|---|
| 16212 16212 16212 16213 16213 ... |
| user output |
|---|
| (empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 4621 68476 54853 81760 28147 87423 33351 48197 ... |
| correct output |
|---|
| 16294 16295 16295 16295 16296 ... |
| user output |
|---|
| (empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 51596 84775 65582 47330 87748 35647 53679 16442 ... |
| correct output |
|---|
| 16120 16121 16122 16122 16123 ... |
| user output |
|---|
| (empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 69292 26196 54314 63616 95 16072 19077 67875 ... |
| correct output |
|---|
| 16149 16149 16149 16149 16150 ... |
| user output |
|---|
| (empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 97541 89807 88261 42118 68387 12007 50630 50 ... |
| correct output |
|---|
| 16105 16105 16105 16105 16106 ... |
| user output |
|---|
| (empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 91853 52153 10866 98151 37463 6198 60814 65027 ... |
| correct output |
|---|
| 16154 16155 16155 16155 16156 ... |
| user output |
|---|
| (empty) |
Test 19
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 40682 32628 80240 43316 2162 93003 59820 88267 ... |
| correct output |
|---|
| 16398 16398 16398 16398 16398 ... |
| user output |
|---|
| (empty) |
Test 20
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 55437 43499 70984 56856 86259 35090 95150 56215 ... |
| correct output |
|---|
| 16044 16045 16045 16045 16046 ... |
| user output |
|---|
| (empty) |
Test 21
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 4134 98627 66480 41168 90133 75501 94062 11019 ... |
| correct output |
|---|
| 16251 16252 16252 16252 16253 ... |
| user output |
|---|
| (empty) |
Test 22
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 6352 451 19430 47543 18870 69498 10423 18161 ... |
| correct output |
|---|
| 16118 16118 16118 16119 16119 ... |
| user output |
|---|
| (empty) |
Test 23
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 47553 72232 19034 64055 24491 39922 98399 16192 ... |
| correct output |
|---|
| 16199 16200 16201 16202 16202 ... |
| user output |
|---|
| (empty) |
Test 24
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 69140 89073 95544 9460 45106 70799 50772 94371 ... |
| correct output |
|---|
| 16196 16196 16197 16198 16198 ... |
| user output |
|---|
| (empty) |
Test 25
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 100000 100000 22639 28340 10882 29245 74076 54240 87341 51204 ... |
| correct output |
|---|
| 16129 16129 16129 16129 16129 ... |
| user output |
|---|
| (empty) |
