QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#247399 | #6443. Windblume Festival | Determinant# | Compile Error | / | / | C++14 | 463b | 2023-11-11 14:17:04 | 2023-11-11 14:17:04 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n;cin>>n;if(n==1){cout<<a[0]<<endl;return;}
vector<int> a(n);
int s=0,mx=-2e9,mn=2e9;
for(int i=0;i<n;i++){
cin>>a[i];
s+=abs(a[i]);
mx=max(mx,a[i]);
mn=min(mn,a[i]);
}
s-=abs(mx);
s-=abs(mn);
cout<<mx-mn+s<<endl;
}
signed main(){
int t;cin>>t;
while(t--)solve();
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:6:33: error: ‘a’ was not declared in this scope 6 | int n;cin>>n;if(n==1){cout<<a[0]<<endl;return;} | ^