QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#492912 | #6135. Books | Ink_bai | Compile Error | / | / | C++14 | 2.5kb | 2024-07-26 17:10:20 | 2024-07-26 17:10:21 |
Judging History
This is the latest submission verdict.
- [2024-07-26 17:10:21]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-07-26 17:10:20]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 100005
int a[N];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
int c=0;
int mini=0x3f3f3f3f;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]==0)c++;
if(a[i]!=0)
mini=min(a[i],mini);
}
if(n==m)puts("Richman");
else if(c>m) puts("Impossible");
else
{
if(m==0||c==m) printf("%lld\n",mini-1);
else
{
int ans=0;
int pos;
for(int i=1;i<=n;i++)
{
if(a[i]==0)continue;
if(c<m)ans+=a[i],c++;
if(c==m)
{
pos=i;
break;
}
}
mini=0x3f3f3f3f;
for(int j=pos+1;j<=n;j++)
{
if(a[j]!=0)mini=min(mini,a[j]);
}
ans+=mini-1;
cout<<ans<<endl;
}
}
}
}#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 100005
int a[N];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
int c=0;
int mini=0x3f3f3f3f;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]==0)c++;
if(a[i]!=0)
mini=min(a[i],mini);
}
if(n==m)puts("Richman");
else if(c>m) puts("Impossible");
else
{
if(m==0||c==m) printf("%lld\n",mini-1);
else
{
int ans=0;
int pos;
for(int i=1;i<=n;i++)
{
if(a[i]==0)continue;
if(c<m)ans+=a[i],c++;
if(c==m)
{
pos=i;
break;
}
}
mini=0x3f3f3f3f;
for(int j=pos+1;j<=n;j++)
{
if(a[j]!=0)mini=min(mini,a[j]);
}
ans+=mini-1;
cout<<ans<<endl;
}
}
}
}
詳細信息
answer.code:54:2: error: stray ‘#’ in program 54 | }#include<bits/stdc++.h> | ^ answer.code:54:3: error: ‘include’ does not name a type 54 | }#include<bits/stdc++.h> | ^~~~~~~ answer.code:58:6: error: redefinition of ‘long long int a [100005]’ 58 | int a[N]; | ^ answer.code:5:6: note: ‘long long int a [100005]’ previously declared here 5 | int a[N]; | ^ answer.code:59:8: error: redefinition of ‘int main()’ 59 | signed main() | ^~~~ answer.code:6:8: note: ‘int main()’ previously defined here 6 | signed main() | ^~~~