QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340469 | #4441. BIT Subway | Terac# | WA | 0ms | 6272kb | C++14 | 2.4kb | 2024-02-29 08:17:45 | 2024-02-29 08:17:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace IO {
#if ONLINE_JUDGE
#define getc() (IS == IT && (IT = (IS = ibuf) + fread(ibuf, 1, IL, stdin), IS == IT) ? EOF : *IS++)
#else
#define getc() getchar()
#endif
const int IL = 1 << 21, OL = 1 << 21;
int olen = 0;
char ibuf[IL], *IS = ibuf, *IT = ibuf, obuf[OL];
inline int read() {
register char ch = getc(); register int x = 0, f = 1;
while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getc(); }
while(isdigit(ch)) x = x * 10 + ch - 48, ch = getc();
return x * f;
}
inline double readdb() {
register char ch = getc(); register double x = 0, f = 1;
while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getc(); }
while(isdigit(ch)) x = x * 10 + ch - 48, ch = getc();
if(ch == '.') {
register double b = 0.1;
ch = getc();
while(isdigit(ch)) x += (ch - 48) * b, b *= 0.1, ch = getc();
}
return x * f;
}
inline int readstr(char *s) {
register char ch = getc(); register int len = 0;
while(!isalpha(ch)) ch = getc();
while(isalpha(ch)) s[++len] = ch, ch = getc();
return len;
}
inline void flush() { fwrite(obuf, 1, olen, stdout); olen = 0; }
inline void putc(register char ch) { obuf[olen++] = ch; }
template<class T>
inline void write(register T x) {
if(x < 0) obuf[olen++] = '-', x = -x;
if(x > 9) write(x / 10);
obuf[olen++] = x % 10 + 48;
}
} using namespace IO;
const int N = 5e2 + 10, mod = 1e9 + 7;
int n, a[N];
void MAIN() {
n = read();
for(int i = 1; i <= n; i++)
a[i] = read();
double res1 = 0, res2 = 0;
for(int i = 1; i <= n; i++) {
if(res2 >= 200) res2 += 0.5 * a[i];
else if(res2 >= 100) res2 += 0.8 * a[i];
else res2 += 1. * a[i];
if(res1 + a[i] < 100) { res1 += a[i]; continue; }
else if(res1 < 100 && res1 + a[i] >= 100) {
double t = 100. - res1;
double k = 0.8 * (a[i] - t);
double rr = a[i] - t;
res1 = 100.;
if(res1 + 0.8 * rr <= 200) {
res1 += 0.8 * rr;
continue;
}
t = 200 - res1;
k = 0.8 * rr;
res1 = 200. + (k - t) / 0.8 * 0.5;
}
else if(res1 >= 100 && res1 < 200) {
if(res1 + 0.8 * a[i] <= 200) { res1 += 0.8 * a[i]; continue; }
double t = 200 - res1;
double k = 0.8 * a[i];
res1 = 200. + (k - t) / 0.8 * 0.5;
}
else if(res1 >= 200) { res1 += 0.5 * a[i]; continue; }
}
printf("%.2lf %.2lf\n", res1, res2);
}
int main() {
int T = read();
while(T--) MAIN();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 6272kb
input:
10 10 20 50 105 200 11 31 88 177 30 122 12 75 200 65 200 200 1 2 3 4 5 6 10 10 95 5 125 200 10 20 70 60 55 7 10 99 126 70 10 32 22 200 199 20 77 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
504.50 564.50 473.00 523.00 411.00 411.00 515.00 540.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00
result:
wrong answer 1st lines differ - expected: '504.500 564.500', found: '504.50 564.50'