Submission #3607533
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;
vector<int> a;
int n, max1, max2, min1, min2;
int main()
{
cin>>n;
REP(i,n) {
int tmp;
cin>>tmp;
a.push_back(tmp);
}
vector<int> b(a.begin(), a.end());
SORT(b);
max1 = max(b[n-1], 0);
max2 = max(b[n-2], 0);
min1 = min(b[0], 0);
min2 = min(b[1], 0);
//cout<<max1<<" "<<max2<<" "<<min1<<" "<<min2<<endl;
REP(i,n) {
if (a[i] == max1) {
cout<<(max2-min1)*2<<endl;
} else if (a[i] == min1) {
cout<<(max1-min2)*2<<endl;
} else {
cout<<(max1-min1)*2<<endl;
}
}
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Traveling Plan |
User |
Cmer |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1147 Byte |
Status |
WA |
Exec Time |
196 ms |
Memory |
1784 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample-01.txt, sample-02.txt, sample-03.txt |
All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
WA |
191 ms |
1784 KB |
02.txt |
WA |
196 ms |
1784 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
WA |
196 ms |
1784 KB |
05.txt |
WA |
189 ms |
1784 KB |
06.txt |
WA |
194 ms |
1784 KB |
07.txt |
WA |
190 ms |
1784 KB |
08.txt |
WA |
189 ms |
1784 KB |
09.txt |
WA |
186 ms |
1656 KB |
10.txt |
WA |
183 ms |
1656 KB |
11.txt |
WA |
183 ms |
1656 KB |
12.txt |
WA |
182 ms |
1656 KB |
sample-01.txt |
AC |
1 ms |
256 KB |
sample-02.txt |
AC |
1 ms |
256 KB |
sample-03.txt |
WA |
1 ms |
256 KB |