| Task: | Tietoverkko |
| Sender: | Kargeri |
| Submission time: | 2021-10-17 21:57:23 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
| #2 | WRONG ANSWER | 0.01 s | 2, 3 | details |
| #3 | WRONG ANSWER | 0.22 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:28:6: warning: overflow in implicit constant conversion [-Woverflow]
l = 10000000000;
^~~~~~~~~~~Code
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
int n, a, b, x, l;
long long ans;
vector<int> c;
int main()
{
ans = 0;
cin >> n;
for (int i = 0; i < n - 1; i++)
{
cin >> a >> b >> x;
c.push_back(x);
}
sort(c.begin(), c.end());
reverse(c.begin(), c.end());
l = 10000000000;
for (int i = 0; i < n - 1; i++)
{
if (i == n - 2)
{
ans += (i + 1) * c[i];
break;
}
if (c[i] < l && c[i + 1] < c[i])
{
ans += (i + 1) * c[i];
}
}
cout << ans;
return 0;
}Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
| correct output |
|---|
| 88687 |
| user output |
|---|
| 100205 |
Test 2
Group: 2, 3
Verdict: WRONG ANSWER
| input |
|---|
| 5000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
| correct output |
|---|
| 1103702320243776 |
| user output |
|---|
| -23660256049 |
Test 3
Group: 3
Verdict: WRONG ANSWER
| input |
|---|
| 200000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
| correct output |
|---|
| 1080549209850010931 |
| user output |
|---|
| 98494290150 |
