Task: | 3-sum |
Sender: | Ipek Guren |
Submission time: | 2019-09-14 04:29:01 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | TIME LIMIT EXCEEDED | -- | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | 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 |
#26 | TIME LIMIT EXCEEDED | -- | details |
#27 | TIME LIMIT EXCEEDED | -- | details |
#28 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <stdio.h> #include <cstdlib> #include <iostream> int main(){ //take the input and place into the double char array char myin [605]; std::cin >> myin; char number_n [2]; int m=0; while(myin[m] != '\n'){ number_n[m] = myin[m]; } //getting the actual number n int n = atoi(number_n); //declaring the double char array char array[n][5] = { 0 }; int k=m+1; int no_rows=0; int column=0; while (myin[k] != '\0') { if(myin[k] != ' '){ //it is not a blank space array[no_rows][column]= myin[k]; } else{ //it is a blank space no_rows++; column=0; } k++; } //from double char array, turn into an int array int final_array [n] = {} ; for (int i = n ; i<n ; i++) { final_array[i] = atoi(array[i]); } //traverse the int array to find the biggest 3 ints int max1 = -1001; int max2 = -1001; int max3 = -1001; for (int i = n ; i<n ; i++) { if(final_array[i]>max1){ max1=final_array[i]; } } for (int i = n ; i<n ; i++) { if(final_array[i]>max2 && final_array[i] != max1){ max2=final_array[i]; } } for (int i = n ; i<n ; i++) { if(final_array[i]>max3 && final_array[i] != max1 && final_array[i] != max2){ max3=final_array[i]; } } //print out the integers printf( "%d %d %d", max1, max2, max3); }
Test details
Test 1
Verdict: TIME LIMIT EXCEEDED
input |
---|
3 -702 391 288 |
correct output |
---|
-702 391 288 |
user output |
---|
(empty) |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
3 -609 886 -448 |
correct output |
---|
-609 886 -448 |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
3 484 -459 605 |
correct output |
---|
484 -459 605 |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 491 934 -395 -873 -822 447 -90... |
correct output |
---|
491 934 447 |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 -293 853 267 -762 -647 843 35 ... |
correct output |
---|
853 843 744 |
user output |
---|
(empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 -389 -908 441 187 993 -68 -593... |
correct output |
---|
441 187 993 |
user output |
---|
(empty) |
Test 7
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 -195 251 -11 423 |
correct output |
---|
251 -11 423 |
user output |
---|
(empty) |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 -522 -222 -909 294 |
correct output |
---|
-522 -222 294 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 141 764 -262 3 |
correct output |
---|
141 764 3 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 669 -567 -224 160 194 |
correct output |
---|
669 160 194 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 294 783 -60 -637 126 |
correct output |
---|
294 783 126 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
5 -941 391 -339 -982 808 |
correct output |
---|
391 -339 808 |
user output |
---|
(empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
11 726 997 -588 -186 465 472 -865... |
correct output |
---|
726 997 472 |
user output |
---|
(empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
input |
---|
11 -346 950 -522 106 278 265 531 ... |
correct output |
---|
950 531 678 |
user output |
---|
(empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
input |
---|
11 633 -52 -771 449 409 684 -516 ... |
correct output |
---|
633 449 684 |
user output |
---|
(empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
input |
---|
57 714 -738 -127 -549 613 11 263 ... |
correct output |
---|
880 887 947 |
user output |
---|
(empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
input |
---|
57 -599 -338 -960 581 -979 -85 -1... |
correct output |
---|
830 988 852 |
user output |
---|
(empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
input |
---|
57 -346 -990 -893 -109 876 438 -5... |
correct output |
---|
876 910 885 |
user output |
---|
(empty) |
Test 19
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 621 189 655 890 -48 -440 276 6... |
correct output |
---|
945 962 994 |
user output |
---|
(empty) |
Test 20
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 -617 799 -960 436 725 -177 -30... |
correct output |
---|
976 930 968 |
user output |
---|
(empty) |
Test 21
Verdict: TIME LIMIT EXCEEDED
input |
---|
99 -34 722 -880 -572 -241 415 -28... |
correct output |
---|
944 893 930 |
user output |
---|
(empty) |
Test 22
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 -992 368 517 -516 -307 -813 -3... |
correct output |
---|
987 983 978 |
user output |
---|
(empty) |
Test 23
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 -410 683 -411 -720 -559 -997 4... |
correct output |
---|
996 997 1000 |
user output |
---|
(empty) |
Test 24
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 42 -652 -295 -94 -213 -974 658... |
correct output |
---|
960 997 933 |
user output |
---|
(empty) |
Test 25
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 230 16 1000 314 599 242 -921 4... |
correct output |
---|
1000 999 998 |
user output |
---|
(empty) |
Test 26
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 -557 -203 -490 -20 -187 -727 -... |
correct output |
---|
-20 -12 -6 |
user output |
---|
(empty) |
Test 27
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 -857 -525 -888 -592 -468 -378 ... |
correct output |
---|
-1 -16 -34 |
user output |
---|
(empty) |
Test 28
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 -985 -939 -972 -976 -936 -971 ... |
correct output |
---|
-900 -901 -902 |
user output |
---|
(empty) |