QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#184795 | #6443. Windblume Festival | KAZE_mae# | WA | 475ms | 3672kb | C++17 | 1.4kb | 2023-09-21 12:46:18 | 2023-09-21 12:46:18 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define mod 998244353
#define ffor(n) for(int i = 0;i < n;++i)
const int N = 2000006;
using namespace std;
void build_log();
int mv_x[4] = {1,0,-1,0};
int mv_y[4] = {0,1,0,-1};
int year[2][15] = {{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};//1æ¯é°å¹´,0æ¯éé°å¹´
int t;
int m_log2[500005]; // log2(x) + 1
int k;
int n,m;
int h;
vector<int>v;
signed main()
{
//ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
cin>>t;
while(t--)
{
cin>>n;
int a;
int sum = 0;
int mmin = 10000000000;
int mmax = -10000000000;
ffor(n)
{
cin>>a;
if(a < 0)
{
sum -= a;
}
else
{
sum += a;
}
mmin = min(mmin,a);
mmax = max(mmax,a);
}
if(mmin > 0)
{
sum -= 2 * mmin;
}
if(mmax < 0)
{
sum += mmax*2;
}
cout<<sum<<endl;
}
return 0;
}
void build_log()
{
for(int i = 1;i <= n;i++)
{
m_log2[i] = m_log2[i-1] + ((1 << m_log2[i-1]) == i);
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
5 4 1 -3 2 -4 11 91 66 73 71 32 83 72 79 84 33 93 12 91 66 73 71 32 83 72 79 84 33 33 93 13 91 66 73 71 32 83 72 79 84 33 33 33 93 1 0
output:
10 713 746 779 0
result:
ok 5 number(s): "10 713 746 779 0"
Test #2:
score: -100
Wrong Answer
time: 475ms
memory: 3592kb
input:
1000000 1 2 1 -2 1 1 1 -1 1 2 1 1 1 2 1 -2 1 -2 1 2 1 1 1 1 1 2 1 2 1 2 1 -2 1 -2 1 0 1 2 1 1 1 -1 1 0 1 -2 1 0 1 1 1 1 1 -2 1 -2 1 2 1 1 1 2 1 1 1 1 1 0 1 2 1 0 1 -1 1 -1 1 -2 1 -2 1 0 1 -2 1 0 1 1 1 -1 1 2 1 0 1 -2 1 -2 1 0 1 1 1 -1 1 -2 1 -1 1 0 1 -1 1 -1 1 -1 1 -1 1 1 1 2 1 0 1 0 1 -2 1 2 1 2 1 ...
output:
-2 -2 -1 -1 -2 -1 -2 -2 -2 -2 -1 -1 -2 -2 -2 -2 -2 0 -2 -1 -1 0 -2 0 -1 -1 -2 -2 -2 -1 -2 -1 -1 0 -2 0 -1 -1 -2 -2 0 -2 0 -1 -1 -2 0 -2 -2 0 -1 -1 -2 -1 0 -1 -1 -1 -1 -1 -2 0 0 -2 -2 -2 -1 -2 -2 -1 -2 -1 -2 -2 -1 -1 0 -2 0 0 0 -1 -1 -2 -1 -1 0 -2 -1 -2 -1 -1 0 -1 -2 -2 -1 -1 0 -2 -2 -2 -1 0 -1 0 -1 ...
result:
wrong answer 1st numbers differ - expected: '2', found: '-2'