submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s991469209 | p03700 | C++ | #include <stdio.h>
#include <queue>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
ll n,attack1,attack2;
vector<int> hp;
const ll INF=1e9;
inline bool check(ll x){
ll cost=0;
ll i;
for(i=0;i<hp.size();i++){
if(hp[i]-x*attack2>0){
ll tmp=hp[i]-x*attack2;
ll tmp2=(tmp+(attack1-attack2)-1)/(attack1-attack2);
if(tmp>0)cost+=tmp2;
}
}
return cost<=x;
}
int main(){
scanf("%d%d%d",&n,&attack1,&attack2);
hp.resize(n);
ll i;
for(i=0;i<n;i++){
scanf("%d",&hp[i]);
}
ll l=1,r=INF,ans;
while(l<=r){
ll mid=(l+r)>>1;
if(check(mid)){
ans=mid;
r=mid-1;
}
else{
l=mid+1;
}
}
printf("%I64d\n",ans);
return 0;
} | a.cc:7:1: error: 'll' does not name a type
7 | ll n,attack1,attack2;
| ^~
a.cc:9:7: error: 'll' does not name a type
9 | const ll INF=1e9;
| ^~
a.cc:10:19: error: 'll' was not declared in this scope
10 | inline bool check(ll x){
| ^~
a.cc: In function 'int main()':
a.cc:23:25: error: 'n' was not declared in this scope
23 | scanf("%d%d%d",&n,&attack1,&attack2);
| ^
a.cc:23:28: error: 'attack1' was not declared in this scope
23 | scanf("%d%d%d",&n,&attack1,&attack2);
| ^~~~~~~
a.cc:23:37: error: 'attack2' was not declared in this scope
23 | scanf("%d%d%d",&n,&attack1,&attack2);
| ^~~~~~~
a.cc:25:9: error: 'll' was not declared in this scope
25 | ll i;
| ^~
a.cc:26:13: error: 'i' was not declared in this scope
26 | for(i=0;i<n;i++){
| ^
a.cc:29:11: error: expected ';' before 'l'
29 | ll l=1,r=INF,ans;
| ^~
| ;
a.cc:30:15: error: 'l' was not declared in this scope
30 | while(l<=r){
| ^
a.cc:30:18: error: 'r' was not declared in this scope
30 | while(l<=r){
| ^
a.cc:31:19: error: expected ';' before 'mid'
31 | ll mid=(l+r)>>1;
| ^~~~
| ;
a.cc:32:26: error: 'mid' was not declared in this scope
32 | if(check(mid)){
| ^~~
a.cc:32:29: error: 'check' cannot be used as a function
32 | if(check(mid)){
| ^
a.cc:33:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
33 | ans=mid;
| ^~~
| abs
a.cc:40:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
40 | printf("%I64d\n",ans);
| ^~~
| abs
|
s487480299 | p03700 | C++ | #include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define rep(b,a,c) for(b=a;b<c;b++)
#define ll long long
#define re return
#define fi first
#define se second
using namespace std;
//Please Hake Me
//by Eyes
/*
int main(){
freopen("gomn.out","w",stdout);
for(int a=1;a<=12;a++)
for(int b=a+1;b<=12;b++)
for(int c=b+1;c<=12;c++)
for(int d=c+1;d<=12;d++)if(a+b+c+d==26)cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
}
int i,j,par[N],root[N],n,r[N];
bool fa[N];
int Find(int x){
if(par[x]==x)return x;
else returnFind(par[x]);
}
int main(){
scanf("%d",&n);
rep1(i,n){
cin>>par[i];fa[par[i]]=true;
}
rep1(i,n)root[i]=Find[i];
int flag=1;
rep1(i,n){
bool f=false;
rep1(j,flag-1){
if(root[i]==r[j]){
f=true;
break;
}
if(f)r[flag]=root[i];
}
}
cout<<flag-1<<endl;
rep1(i,n){
if(!fa[i]&&flag>1&&root[i]!=r[flag]){
par[r[flag]]=i;
flag--;
}else if(flag==1)break;}
rep1(i,n)cout<<par[i]<<" ";
puts("");
return 0;
}
int i,j,par[200100],n,tot,ab[20010077];
bool vi[200100],rubbish;
void dfs(int a){
if(par[a]==a)return;
if(vi[par[a]])
}
//ANT ON THE TREE (第一种做法)
int n,i,j,x,y;
vector <int> v[301],ans;
inline bool dfs(int a,int b,int la) {
if(b==a)return true;
rep0(i,v[a].size()) {
if(la==v[a][i])continue;
if(dfs(v[a][i],b,a)) {
ans.push_back(a);
return true;
}
return false;
}
}
int main() {
cin>>n;
rep0(i,n-1) {
int a,b;
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
y=1;
while(scanf("%d",&x)!=EOF) {
dfs(x,y,0);
y=x;
}
dfs(1,y,0);
if(ans.size()!=(2*n-1)) {
cout<<"-1"<<endl;
return 0;
}
//不懂悲欢离合煎熬的我们
rep0(i,ans.size()) {
cout<<ans[i]<<" ";
}
cout<<endl;
return 0;
}
//BEAUTIFUL IP ADDRESS
const int N=300;
const int I=1e5;
int n,tmp,g[N],kd[N],d[N][N],mask[N],q[N],aw[I],ax[I],ay[I],az[I],i,j;
bool b[N],good[N];
int main(){
int w,x,y,z;
cin>>n;
rep0(i,10)b[i]=false;
int need=0;
rep0(i,n){
cin>>tmp;
need|=(i<<tmp);
b[tmp]=true;
}
if(n>6){
puts("0");
re 0;
}
int kg=0;
memset(good,true,sizeof(good));
rep0(i,256){
good[i]=true;
int x=i;mask[i]=0;
kd[i]=0;
while(x>0){
d[i][kd[i]++]=x%10;
if(!b[x%10])good[i]=false;
mask[i]=(1<<(x%10));
x/=10;
}
if(i==0&&!b[0])good [i]=false;
if(i==0){
d[i][kd[i]++]=0;
mask[i]|=(1<<0);
}
if(good[i])g[kg++]=i;
}
int ka=0;
rep0(w,256)if(good[w])
rep0(x,256)if(good[x])
rep0(y,256)if(good[y]){
if(mask[w]|mask[x]|mask[y]!=need)continue;
rep0(z,256)if(good[z]){
int u=0;
for(i=kd[w]-1;i>=0;i--)q[u++]=d[w][i];
for(i=kd[x]-1;i>=0;i--)q[u++]=d[x][i];
for(i=kd[y]-1;i>=0;i--)q[u++]=d[y][i];
for(i=kd[z]-1;i>=0;i--)q[u++]=d[z][i];
bool ok=true;
rep0(i,u-i-1)if(q[i]!=q[u-i-1]){
ok=false;
break;
}
if(ok){
aw[ka]=w;
ax[ka]=x;
ay[ka]=y;
az[ka]=z;
ka++;
}
}
}
cout<<ka<<endl;
rep0(i,ka)cout<<aw[i]<<"."<<ax[i]<<"."<<ay[i]<<"."<<az[i]<<endl;
return 0;
}
//TIC-TAC-TOE
int n,m;
int main(){
cin>>n>>m;
if(n==1){cout<<(m+2)/3<<endl;re 0;
}else if(n==2){cout<<m/2+1<<endl;re 0;
}else if(n==3){cout<<m+(m-1)/4<<endl;re 0;
}else if(m==1){cout<<(n+2)/3<<endl;re 0;
}else if(m==2){cout<<n/2+1<<endl;re 0;
}else if(m==3){cout<<n+(n-1)/4<<endl;re 0;
}else if(n==4){cout
}
}
//CLIkB ON THE WALLS
int n,k;
char s[2][100010];
bool vi[2][100010]
inline void dfs(int a,int b,int dep){
if(s[a][b]=='X'||vi[a][b]||b<dep||b<0)return;
vi[a][b]=true;
if(b>n){
puts("YES");
exit(0);
}
dfs(a,b+1,dep+1);
dfs(a,b-1,dep+1);
dfs((a+1)%2,b+k,dep+1);
}
int kain(){
scanf("%d%d%s%s",&n,&k,s[0],s[1]);n--;
dfs(0,1,1);
dfs(1,k,1);
puts("NO");
return 0;
}
//GREAT+SWERC=PORTO(Gym100783)
bool letters[26],nu[10],nonz[26];
int num[26],i,j,n,ans;
char s[10][21];
inline void check(){
int a[9];
rep(i,0,n){
rep(j,0,strlen(s[i]))a[i]=a[i]*10+num[s[i][j]-'A'];
}
int tot;
rep(i,0,n-1)tot+=a[i];
if(tot==a[n])ans++;
cout<<"OK"<<endl;
}
inline void dfs(int c){
rep(i,0,10){
if(nonz[c]&&i==0)continue;
if(!nu[i]){
num[c]=i;
nu[i]=true;for(int k=25;k>=0;k--)if(letters[k]){
if(num[k]!=-1){
check();
}else break;
}
rep(j,c,26)if(letters[j])dfs(j);
nu[i]=false;num[c]=-1;
}
}
cout<<"YEAH"<<endl;
}
inline int binarysearch(int x,int v[],int m){
int high,low,mid;
high=n-1;low=0;
while(low<high){
mid=(high-low)/2;
if(x<v[i])high=mid-1;
else if(x>v[mid])low=mid+1;
else return mid;
}
return -1;
}
int main(){
scanf("%d",&n);
rep(i,0,n){
scanf("%s",s[i]);
nonz[s[i][0]-'A']=true;
rep(j,0,strlen(s[i]))if(!letters[s[i][j]-'A'])letters[s[i][j]-'A']=true;
}
cout<<"OK1"<<endl;
memset(num,-1,sizeof num);
rep(i,0,26)if(letters[i]){
dfs(i);break;
}
cout<<"OK2"<<endl;
printf("%d\n",&ans);
cout<<"odshods"<<endl;
}
//460c
int i,j,n,a[100005],c[200010],w,m;
inline bool check(int h){
memset(c,0,sizeof c);
int add=0,used=0;
rep(i,0,n){
add+=c[i];
int now=max(0,h-a[i]+add);
used+=now;
add+=now;
c[i+w]-=now;
if(used>m)re false;
}
re true;
}
int main(){
cin>>n>>m>>w;
rep(i,0,n);
cin>>a[i];
int low=1,high=1000100000;
while (high-low>1){
int mid=(high-low)/2;
if(check(mid))low=mid;
else high=mid;
}
cout<<low<<endl;
}
//IPv4
int n,num[256],i,j,x,y,ans,z;
bool a[10],used[10];
vector <string> s;
inline void Find(){
int a[4];
rep(i,0,flag){
a[0]=num[i];used[a[0]/100]=used[a[0]/10%10]=used[a[0]%10]=true;
rep(j,0,flag){
a[1]=num[j];used[a[1]/100]=used[a[1]/10%10]=used[a[1]%10]=true;
rep(x,0,flag){
a[2]=num[x];used[a[2]/100]=used[a[2]/10%10]=used[a[2]%10]=true;int cnt=0;rep(z,0,10){if(!used[z]&&a[z])cnt++};
if(cnt<4)
rep(y,0,flag){
a[3]=num[x];used[a[3]/100]=used[a[3]/10%10]=used[a[3]%10]=true;
bool b=true;
rep(z,0,10)if(!used[z]&&a[z])b=false;
if(b){ans++;
cout<<a[0]<<"."<<a[1]<<"."<<a[2]<<"."<<a[3]<<endl;
}
}
}
}
}
}
int main(){
cin>>n;int x;
rep(i,0,n){
int x;
a[x]=true;
}int flag=0;
rep(i,0,256)
if(a[i/100]&&a[(i%100)/10]&&(a[i]%10)){
num[flag++]=a;
}
Find();
cout<<ans<<endl;
re 0;
}
//Number 24
int a,b,c,d,CASE=1,i,j,ans,k;
inline void check(){
int a[9];
rep(i,0,n){
rep(j,0,strlen(s[i]))a[i]=a[i]*10+num[s[i][j]-'A'];
}
int tot;
rep(i,0,n-1)tot+=a[i];
if(tot==a[n])ans++;
cout<<"OK"<<endl;
}
inline void dfs(int c){
rep(i,0,10){
if(nonz[c]&&i==0)continue;
if(!nu[i]){
num[c]=i;
nu[i]=true;for(int k=25;k>=0;k--)if(letters[k]){
if(num[k]!=-1){
check();
}else break;
}
rep(j,c,26)if(letters[j])dfs(j);
nu[i]=false;num[c]=-1;
}
}
cout<<"YEAH"<<endl;
}
inline void solve(){
}
int main(){
cin>>a>>b>>c>>d;
while(a&&b&&c&&d){
cout<<"Case "<<CASE<<": ";
}
re 0;
}
int n,i,j,k;
string s,t;
int main(){
cin>>n;
rep(i,0,n){
cin>>s;int len=0;
rep(j,0,;s.size()){
if(s[j]==":"){
if(len>0&&)
}
}
}
}*/
//Widespread
priority_queue <ll> q;
ll h,i,j,k,t,deathline,a,b,n,ans=0,m=1e9+10;
int main(){
scanf("%lld%lld%lld",&n,&a,&b);
deathline=0;
rep(i,0,n){
scanf("%lld",&h);q.push(h);m=min(m,h);
}
a-=b;eathline){
t=q.top();q.pop();
t-=a;q.push(t);
ans++;
deathline+=b;
}
printf("%lld\n",&ans);
re 0;
} | a.cc: In function 'int main()':
a.cc:482:14: error: 'eathline' was not declared in this scope; did you mean 'deathline'?
482 | a-=b;eathline){
| ^~~~~~~~
| deathline
|
s637277543 | p03700 | C++ | //Widespread
priority_queue <int> q;
int h,i,j,k,t,deathline,a,b,n,ans=0;
int main(){
cin>>n>>a>>b;
deathline=0;
rep(i,0,n){
cin>>h;q.push(h);
}
a-=b;
while(q.top()>deathline){
t=q.top();q.pop();
t-=a;q.push(t);
ans++;
deathline+=b;
}
cout<<ans<<endl;
return 0;
} | a.cc:2:1: error: 'priority_queue' does not name a type
2 | priority_queue <int> q;
| ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin>>n>>a>>b;
| ^~~
a.cc:7:9: error: 'rep' was not declared in this scope
7 | rep(i,0,n){
| ^~~
a.cc:11:15: error: 'q' was not declared in this scope
11 | while(q.top()>deathline){
| ^
a.cc:17:9: error: 'cout' was not declared in this scope
17 | cout<<ans<<endl;
| ^~~~
a.cc:17:20: error: 'endl' was not declared in this scope
17 | cout<<ans<<endl;
| ^~~~
|
s937114934 | p03700 | C++ | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
long long h[100005],tem;
long long n,a,b;
bool check(long long mid)
{
long long res=0;
for(int i=0;i<n;i++)
{
tem=(long long)(h[i])-(long long)(mid*b);
if(tem>0) res+=long long(tem/a)+(tem%a!=0);
}
return res<=mid;
}
int main()
{
cin>>n>>a>>b;
for(int i=0;i<n;i++)
{
cin>>h[i];
}
a-=b;
long long l=0,r=1e15,mid,re=1e15;
while(r>l+1)
{
mid=(l+r)/2ll;
if(check(mid))
{
r=mid;
re=min(mid,re);
}
else l=mid;
}
cout<<re;
} | a.cc: In function 'bool check(long long int)':
a.cc:25:32: error: expected primary-expression before 'long'
25 | if(tem>0) res+=long long(tem/a)+(tem%a!=0);
| ^~~~
|
s602483979 | p03700 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long LL;
const int maxn = 1e5;
int n, a, b, m[maxn+3];
bool judge(LL x)
{
LL sum = 0;
for(int i=0; i<n; ++i)
{
LL t = m[i]-x*b;
if(t>0)
{
sum += ceil(t*1.0/(a-b));
if(sum > x || sum < 0)
return false;
}
}
return true;
}
int main()
{
scanf("%d%d%d",&n,&a,&b);
int imax = 0;
for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]);
LL l=0, r=1e14;
while(l<r)
{
LL mid = (l+r)/2;
if(judge(mid)) r=mid;
else l=mid+1;
}
printf("%lld\n",mid);
return 0;
} | a.cc: In function 'int main()':
a.cc:39:21: error: 'mid' was not declared in this scope
39 | printf("%lld\n",mid);
| ^~~
|
s339770553 | p03700 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;
const int MAX_N = 10000;
#define ll long long
int N, A, B;
vector<int> h;
bool enough(int T)
{
ll cnt = 0;
for (int i = 0; i < N; i++)
{
if (h[i] <= B*T) continue;
cnt += (h[i]-B*T) / (A-B)
if( (h[i]-B*T) % (A-B) ) cnt++;
}
return cnt <= T;
}
int main()
{
//widespread
cin >> N >> A >> B;
h.resize(N);
for (int i = 0; i < N; i++)
{
cin>>h[i];
}
sort(h.begin(), h.end());
int l = -1;
int r = h.back() / B + 1;
while (r-l>1)
{
int m = (r+l) / 2;
(enough(m) ? r : l) = m;
}
cout << r << endl;
return 0;
} | a.cc: In function 'bool enough(int)':
a.cc:18:42: error: expected ';' before 'if'
18 | cnt += (h[i]-B*T) / (A-B)
| ^
| ;
19 | if( (h[i]-B*T) % (A-B) ) cnt++;
| ~~
|
s007393686 | p03700 | C++ | #include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;
const int MAX_N = 10000;
#define ll long long
int N, A, B;
vector<int> h;
bool enough(int T)
{
ll cnt = 0;
for (int i = 0; i < N; i++)
{
if (h[i] <= B*T) continue;
cnt += (int)ceil((double)(h[i]-B*T) / (A-B));
}
return cnt <= T;
}
int main()
{
//widespread
cin >> N >> A >> B;
h.resize(N);
for (int i = 0; i < N; i++)
{
cin>>h[i];
}
sort(h.begin(), h.end());
int l = -1;
int r = h.back() / B + 1;
while (r-l>1)
{
int m = (r+l) / 2;
(enough(m) ? r : l) = m;
}
cout << r << endl;
return 0;
}
| a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s444299328 | p03700 | C++ | int main()
{
//widespread
int N,A,B;
scanf("%d %d %d", &N,&A,&B);
vector<int> h(N);
for (int i = 0; i < N; i++)
{
scanf("%d", &h[i]);
}
int cnt= 0;
while (true)
{
bool flag = true;
int max = h[0];
int index = 0;
for (int i = 0; i < N; i++)
{
if (max < h[i])
{
max = h[i];
index = i;
}
if (h[i] > 0)
{
flag = false;
}
}
if (flag) break;
cnt++;
for (int i = 0; i < N; i++)
{
if (index == i)
{
h[i] -= A;
}
else
{
h[i] -= B;
}
}
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
5 | scanf("%d %d %d", &N,&A,&B);
| ^~~~~
a.cc:6:9: error: 'vector' was not declared in this scope
6 | vector<int> h(N);
| ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
6 | vector<int> h(N);
| ^~~
a.cc:9:30: error: 'h' was not declared in this scope
9 | scanf("%d", &h[i]);
| ^
a.cc:15:27: error: 'h' was not declared in this scope
15 | int max = h[0];
| ^
a.cc:43:9: error: 'cout' was not declared in this scope
43 | cout << cnt << endl;
| ^~~~
a.cc:43:24: error: 'endl' was not declared in this scope
43 | cout << cnt << endl;
| ^~~~
|
s497975919 | p03700 | C++ | #include <iostream>
#include <cstdio.h>
#include <math.h>
using namespace std;
typedef long long LL;
int N, A, B, h[(int)1e5];
bool judge(LL K) {
LL sum = 0;
for(int i = 0; i < N; i++) {
LL t = (LL)h[i]-K*B;
if (t > 0) {
sum += (int)ceil(t*1.0/(A-B));
if(sum > K)
return false;
}
}
return true;
}
int main()
{
cin >> N >> A >> B;
for (int i = 0; i < N; i++)
scanf("%ld", &h[i]);
LL low = 0, high = 1e9;
while (low < high) {
LL mid = (low + high) / 2;
if (judge(mid))
high = mid;
else
low = mid+1;
}
cout << low << endl;
return 0;
} | a.cc:2:10: fatal error: cstdio.h: No such file or directory
2 | #include <cstdio.h>
| ^~~~~~~~~~
compilation terminated.
|
s235931984 | p03700 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
bool p (vector <long long> health, int a, int b, long long tr) {
int n = (int)health.size();
long long sum = tr * (a-b);
for (int i = 0; i < n; i++)
health[i] -= tr*b;
for (int i = 0; i < n; i++) {
if (health[i] > 0) {
sum -= (a-b) * ceil((double)health[i]/(a-b));
}
}
if (sum < 0)
return false;
else
return true;
}
int binary_search (vector <int> &health, int left, int right, int a, int b) {
if (left > right)
return -1;
if (left == right) {
if (p(health, a, b, left))
return left;
else
return -1;
}
if ((left+1) == right) {
if (p(health, a, b, left))
return left;
else if (p(health, a, b, right))
return right;
else
return -1;
}
int mid = (left+right)/2;
if (p(health, a, b, mid))
return binary_search(health, left, mid, a, b);
else
return binary_search(health, mid, right, a, b);
}
int main (void) {
long long n, a, b; cin >> n >> a >> b;
vector <long long> health(n);
for (int i = 0; i < n; i++)
cin >> health[i];
sort(health.rbegin(), health.rend());
int r = (health[0]/b)+1;
int l = 0;
cout << binary_search(health, l, r, a, b) << endl;
return 0;
} | a.cc: In function 'int binary_search(std::vector<int>&, int, int, int, int)':
a.cc:25:23: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
25 | if (p(health, a, b, left))
| ^~~~~~
| |
| vector<int>
a.cc:31:23: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
31 | if (p(health, a, b, left))
| ^~~~~~
| |
| vector<int>
a.cc:33:28: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
33 | else if (p(health, a, b, right))
| ^~~~~~
| |
| vector<int>
a.cc:39:15: error: could not convert 'health' from 'vector<int>' to 'vector<long long int>'
39 | if (p(health, a, b, mid))
| ^~~~~~
| |
| vector<int>
a.cc: In function 'int main()':
a.cc:54:30: error: no matching function for call to 'binary_search(std::vector<long long int>&, int&, int&, long long int&, long long int&)'
54 | cout << binary_search(health, l, r, a, b) << endl;
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:21:5: note: candidate: 'int binary_search(std::vector<int>&, int, int, int, int)'
21 | int binary_search (vector <int> &health, int left, int right, int a, int b) {
| ^~~~~~~~~~~~~
a.cc:21:34: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&'
21 | int binary_search (vector <int> &health, int left, int right, int a, int b) {
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate: 'template<class _FIter, class _Tp> bool std::binary_search(_FIter, _FIter, const _Tp&)'
2194 | binary_search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2194:5: note: candidate expects 3 arguments, 5 provided
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> bool std::binary_search(_FIter, _FIter, const _Tp&, _Compare)'
2228 | binary_search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:2228:5: note: candidate expects 4 arguments, 5 provided
a.cc: In function 'int binary_search(std::vector<int>&, int, int, int, int)':
a.cc:38:13: warning: control reaches end of non-void function [-Wreturn-type]
38 | int mid = (left+right)/2;
| ^~~
|
s683502973 | p03700 | C++ | #include<iostream>
using namespace std;
int max_num(int *h, int& n)
{
int i;
int tmp=h[0];
int ans=0;
for(i=1;i<n;i++)
{
if(tmp<h[i])
{
tmp=h[i];
ans=i;
}
}
return ans;
}
int main()
{
int n;
int a,b;
cin>>n>>a>>b;
int h[n];
int sum=0,t;
int i;
int max_mon;
for(i = 0; i<n;i++)
{
cin>>h[i];
sum+=h[i];
}
t=sum/n*a;
for(i=0; i<n; i++)
{
h[n]=h[n]-t*b;
}
int ans=0;
ans+t;
sum=1;
while(sum>0){
sum=0;
ans++;
max_mon=max_num(h, n);
for(i=0;i<n;i++)
{
if(i==max_mon){
h[i]=h[i]-a;
if(h[i]>0)
{
sum=sum+1;
}
}
else{
h[i]=h[i]-b;
if(h[i]>0){
sum=sum+1;
}
}
}
}
cout<<ans<<"\n";
return 0; | a.cc: In function 'int main()':
a.cc:71:14: error: expected '}' at end of input
71 | return 0;
| ^
a.cc:24:1: note: to match this '{'
24 | {
| ^
|
s749853033 | p03700 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int N;
cin>>N;
vector<int>h(N);
int a,b;
cin>>a>>b;
int ans=0;
for(int i=0;i<N;i++)
cin>>h[i];
while(!(h.empty())){
sort(h.begin(),h.end(),greater<int>());
for(int i=1;i<h.size();i++)
h[i]-=b;
h[0]-=a;
while(h.end()<=0)
h.pop_back();
ans++;
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:18: error: no match for 'operator<=' (operand types are 'std::vector<int>::iterator' and 'int')
20 | while(h.end()<=0)
| ~~~~~~~^~~
| | |
| | int
| std::vector<int>::iterator
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
469 | operator<=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
513 | operator<=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1704 | operator<=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::move_iterator<_IteratorL>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1767 | operator<=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::move_iterator<_IteratorL>'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::pair<_T1, _T2>'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
717 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/string_view:724:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
724 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
732 | operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:732:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/basic_string.h:3956:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3956 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3956:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/basic_string.h:3970:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3970 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3970:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/basic_string.h:3983:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3983 | operator<=(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3983:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: mismatched types 'const _CharT*' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2625:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2625 | operator<=(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2625:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::tuple<_UTypes ...>'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:2108:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2108 | operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2108:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::vector<_Tp, _Alloc>'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:4:
/usr/include/c++/14/bits/stl_deque.h:2356:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2356 | operator<=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2356:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::deque<_Tp, _Alloc>'
20 | while(h.end()<=0)
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:418:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator<=(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
418 | operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:418:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: 'std::vector<int>::iterator' is not derived from 'const std::queue<_Tp, _Seq>'
20 | while(h.end()<=0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1273:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<=(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1273 | operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1273:5: note: template argument deduction/substitution failed:
a.cc:20:20: note: mis |
s507926542 | p03700 | C | #include <stdio.h>
int main(void)
{
int n, a, b, c, h[100005], h2;
int mid, low, high, flg, max, x, x2, i;
scanf("%d %d %d", &n, &a, &b);
c = a-b;
max = -1;
for(i = 0; i < n; i++){
scanf("%d", &h[i]);
if(max < h[i]) max = h[i];
}
low = 1;
high = max/b+1;
while(low <= high){
mid = (low + high)/2;
flg = 1;
x = mid;
for(i = 0; i < n; i++){
h2 = h[i]-b*mid;
if(h2 > 0){
x2 = h2/c;
if(h2%c != 0) x2++;
x -= x2;
if(x<0){
flg = 0;
break;
}
}
}
if(flag != 1) low = mid+1;
else high = mid-1;
}
printf("%d\n", low);
return 0;
} | main.c: In function 'main':
main.c:25:17: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:19: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:21: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:23: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:33:8: error: 'flag' undeclared (first use in this function); did you mean 'flg'?
33 | if(flag != 1) low = mid+1;
| ^~~~
| flg
main.c:33:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:5: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:7: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:9: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:29: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:31: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
|
s208984875 | p03700 | C | #include <stdio.h>
int main(void)
{
int n, a, b, c, h[100005], h2;
int mid, low, high, flg, max, x, x2, i;
scanf("%d %d %d", &n, &a, &b);
c = a-b;
max = -1;
for(i = 0; i < n; i++){
scanf("%d", &h[i]);
if(max < h[i]) max = h[i];
}
low = 1;
high = max/b+1;
while(low <= high){
mid = (low + high)/2;
flg = 1;
x = mid;
for(i = 0; i < n; i++){
h2 = h[i]-b*mid;
if(h2 > 0){
x2 = h2/c;
if(h2%c != 0) x2++;
x -= x2;
if(x<0){
flg = 0;
break;
}
}
}
if(flag != 1) low = mid+1;
else high = mid-1;
}
printf("%d\n", low);
return 0;
} | main.c: In function 'main':
main.c:25:17: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:19: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:21: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:25:23: error: stray '\343' in program
25 | x -= x2;<U+3000><U+3000><U+3000><U+3000>
| ^~~~~~~~
main.c:33:8: error: 'flag' undeclared (first use in this function); did you mean 'flg'?
33 | if(flag != 1) low = mid+1;
| ^~~~
| flg
main.c:33:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:5: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:7: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:9: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:29: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
main.c:34:31: error: stray '\343' in program
34 | <U+3000><U+3000><U+3000>else high = mid-1;<U+3000><U+3000>
| ^~~~~~~~
|
s782862718 | p03700 | C++ | #include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
const int MAX_n = 100000;
int n,h;
int a;
int b;
bool solve(int mid){
int sum=0;
while(int x:h){
if(x-mid*b>0){
sum+=(x-mid*b+(a-b-1))/(a-b);
}
}
if(sum<=mid)
return true;
else {
return false;
}
}
signed main(){
scanf("%d", &n);
scanf("%d", &a);
scanf("%d", &b);
vector<int> remains;
for(int i = 0;i < n;i++){
scanf("%d", &h);
remains.pb(h);
}
int ok=0;
int ng=INF;
while (abs(ok-ng)>1){
int mid = (ok+ng)/2;
if(solve(mid)){
ok=mid;
}else{
ng = mid;
}
}
printf("%d\n", ok);
return 0;
} | a.cc: In function 'bool solve(int)':
a.cc:24:16: error: found ':' in nested-name-specifier, expected '::'
24 | while(int x:h){
| ^
| ::
a.cc:24:15: error: 'x' has not been declared
24 | while(int x:h){
| ^
a.cc:24:18: error: qualified-id in declaration before ')' token
24 | while(int x:h){
| ^
a.cc:25:12: error: 'x' was not declared in this scope
25 | if(x-mid*b>0){
| ^
|
s044561719 | p03700 | C++ | #include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
const int MAX_n = 100000;
int n,h;
int a;
int b;
bool solve(int mid){
int sum=0;
while(x:h){
if(x-mid*b>0){
sum+=(x-mid*b+(a-b-1))/(a-b);
}
}
if(sum<=mid)
return true;
else {
return false;
}
}
signed main(){
scanf("%d", &n);
scanf("%d", &a);
scanf("%d", &b);
vector<int> remains;
for(int i = 0;i < n;i++){
scanf("%d", &h);
remains.pb(h);
}
int ok=0;
int ng=INF;
while (abs(ok-ng)>1){
int mid = (ok+ng)/2;
if(solve(mid)){
ok=mid;
}else{
ng = mid;
}
}
printf("%d\n", ok);
return 0;
} | a.cc: In function 'bool solve(int)':
a.cc:24:12: error: found ':' in nested-name-specifier, expected '::'
24 | while(x:h){
| ^
| ::
a.cc:24:11: error: 'x' has not been declared
24 | while(x:h){
| ^
a.cc:25:12: error: 'x' was not declared in this scope
25 | if(x-mid*b>0){
| ^
|
s965372260 | p03700 | C++ | #include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
const int MAX_n = 100000;
int n,h;
int a;
int b;
bool solve(mid){
int sum=0;
while(x:h){
if(x-mid*b>0){
sum+=(x-mid*b+(a-b-1))/(a-b);
}
}
if(sum<=mid)
return true;
else {
return false;
}
}
signed main(){
scanf("%d", &n);
scanf("%d", &a);
scanf("%d", &b);
vector<int> remains;
for(int i = 0;i < n;i++){
scanf("%d", &h);
remains.pb(h);
}
int ok=0;
int ng=INF;
while (abs(ok-ng)>1){
int mid = (ok+ng)/2;
if(solve(mid)){
ok=mid;
}else{
ng = mid;
}
}
printf("%d\n", ok);
return 0;
} | a.cc:22:12: error: 'mid' was not declared in this scope
22 | bool solve(mid){
| ^~~
a.cc: In function 'int main()':
a.cc:58:17: error: 'solve' cannot be used as a function
58 | if(solve(mid)){
| ~~~~~^~~~~
|
s933500539 | p03700 | C++ | #include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long // %d=>%lld
#define pb push_back
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
const int MAX_n = 100000;
int n,h;
int a;
int b;
bool solve(mid){
int sum=0;
while(x:h){
if(x-mid*b>0){
sum+=(x-mid*b+(a-b-1))/(a-b)
}
}
if(sum<=mid)
return true;
else {
return false;
}
}
signed main(){
scanf("%d", &n);
scanf("%d", &a);
scanf("%d", &b);
vector<int> remains;
for(int i = 0;i < n;i++){
scanf("%d", &h);
remains.pb(h);
}
// 最大・最小共に使える.okが答え.
int ok=0; // 解が存在する値
int ng=INF; // 解が存在しない値
while (abs(ok-ng)>1){
int mid = (ok+ng)/2;
if(solve(mid)){
ok=mid;
}else{
ng = mid;
}
}
printf("%d\n", ok);
return 0;
} | a.cc:22:12: error: 'mid' was not declared in this scope
22 | bool solve(mid){
| ^~~
a.cc: In function 'int main()':
a.cc:58:17: error: 'solve' cannot be used as a function
58 | if(solve(mid)){
| ~~~~~^~~~~
|
s277096968 | p03700 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int a,b[100],c,min;
min=0;
c=0;
cin>>a;
for(int i=0;i<a;i++){
cin>>a[i];
c=c+a[i]
}
if(c%10>0){
cout<<c<<endl;
}
for(int j=0;j<2;j++){
for(int k=0;k>a;k++){
if(min>a[k] && a[k]%10>0){
min=a[k];
}
}
}
if(min==0){
cout<<0<<endl;
}
cout<<c-min<<endl;
} | a.cc: In function 'int main()':
a.cc:11:23: error: invalid types 'int[int]' for array subscript
11 | cin>>a[i];
| ^
a.cc:12:22: error: invalid types 'int[int]' for array subscript
12 | c=c+a[i]
| ^
a.cc:19:33: error: invalid types 'int[int]' for array subscript
19 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:19:41: error: invalid types 'int[int]' for array subscript
19 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:20:38: error: invalid types 'int[int]' for array subscript
20 | min=a[k];
| ^
|
s349269642 | p03700 | C | #include<stdio.h>
int main(void){
long long int N,A,B;
long long int i;
long long int h[100000];
long long int K;
long long int left,right;
long long int sum;
scanf("%d %d %d",&N,&A,&B);
for(i=0;i<N;i++){
scanf("%d",&h[i]);
}
left=0;
right=1000000000;
K=(right+left)/2
while(1){
sum=0;
for(i=0;i<N;i++){
if(h[i]-K*B > 0){
sum += (h[i]-B*K)%(A-B) ? (h[i]-B*K)/(A-B)+1 : (h[i]-B*K)/(A-B);
}
}
if(sum<=K){
right=(right+left)/(long long int)2;
}else{
left=(right+left)/(long long int)2;
}
K=(right+left)/2;
if(left==right-1){
break;
}
}
printf("%d\n", right);
return 0;
}
| main.c: In function 'main':
main.c:19:19: error: expected ';' before 'while'
19 | K=(right+left)/2
| ^
| ;
20 |
21 | while(1){
| ~~~~~
|
s388882528 | p03700 | C | #include<stdio.h>
#include<math.h>
int main(void){
long long N,A,B;
long long i,max;
long long h[100000];
long long K;
long long left,right;
long long sum;
scanf("%d %d %d",&N,&A,&B);
/*N=5;
A=2;
B=1;
max=0;*/
for(i=0;i<N;i++){
scanf("%10d",&h[i]);
if(h[i]>max){
max=h[i];
}
}
/*h[0]=900000000;
h[1]=900000000;
h[2]=1000000000;
h[3]=1000000000;
h[4]=1000000000;*/
left=0;
right=1000000000;
while(left!=right){
K=(right+left)/2;
sum=0;
for(i=0;i<N;i++){
if(h[i]-K*B>=0){
sum += h[i]%(A-B) ? (h[i]-B*K)/(A-B)+1 : (h[i]-B*K)/(A-B);
}
}
}
// printf("sum=%llu\n",sum);
if(sum<=K){
right=K;
}else{
left=K+1;
}
// printf("left=%llu,right=%llu\n",left,right);
}
printf("%llu\n", left);
return 0;
}
| main.c:53:10: error: expected declaration specifiers or '...' before string constant
53 | printf("%llu\n", left);
| ^~~~~~~~
main.c:53:20: error: unknown type name 'left'
53 | printf("%llu\n", left);
| ^~~~
main.c:55:3: error: expected identifier or '(' before 'return'
55 | return 0;
| ^~~~~~
main.c:56:1: error: expected identifier or '(' before '}' token
56 | }
| ^
|
s799982972 | p03700 | Java | import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int n , k = 0;
long a, b;
n = stdin.nextInt();
a = stdin.nextLong();
b = stdin.nextLong();
long[] A = new long[n];
for (int i = 0; i < n; i++) {
A[i] = stdin.nextInt();
}
long Tmax=1000000000;
long Tmin=0;
long T=0;
//二分探索
while(Tmax-Tmin>1){
T=Tmin+(Tmax-Tmin)/2;
k=0;
for(int i=0;i<n;i++){
//何回爆発すれば全員殺せるかカウントする
if(A[i]>b*T){
k+=Math.ceil((double)(A[i]-b*T)/(double)(a-b));
}
}
if(k>T){
Tmin=T;
}
else if(k<=T){
Tmax=T;
}
}
System.out.println(Tmax);
}
} | Main.java:3: error: class D is public, should be declared in a file named D.java
public class D {
^
1 error
|
s621919991 | p03700 | Java | import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int n , k = 0;
int a, b, x = 0;
n = stdin.nextInt();
a = stdin.nextInt();
b = stdin.nextInt();
long[] A = new long[n];
for (int i = 0; i < n; i++) {
A[i] = stdin.nextInt();
}
int Tmax=1000000000;
int Tmin=0;
int T=0;
//二分探索
while(Tmax-Tmin>1){
T=Tmin+(Tmax-Tmin)/2;
k=0;
for(int i=0;i<n;i++){
if(A[i]>b*T){
k+=Math.ceil((double)(A[i]-b*T)/(double)(a-b));
}
}
if(k>T){
Tmin=T;
}
else if(k<=T){
Tmax=T;
}
}
System.out.println(Tmax);
}
} | Main.java:3: error: class D is public, should be declared in a file named D.java
public class D {
^
1 error
|
s966323819 | p03700 | C++ | #include <iostream>
#include <queue>
bool check_knock(std::vector<int> hp, int a, int b, int search_num) {
int less = hp[hp.size() - 1];
int div = a - b;
int total = 0;
for (int i = 0; i < hp.size(); i++) {
hp[i] -= search_num * b;
if (hp[i] > 0) {
total += (hp[i] / div);
if (hp[i] % div != 0) {
total++;
}
}
}
if (total > search_num) {
return false;
} else {
return true;
}
}
int main(void) {
int n;
int a;
int b;
std::cin >> n >> a >> b;
std::vector<int> hp(n);
for (int i = 0; i < n; i++) {
std::cin >> hp[i];
}
std::sort(hp.begin(), hp.end(), std::greater<int>());
int left;
int right;
int middle;
left = 0;
right = 1e09;
while (left < right) {
middle = (left + right) / 2;
if (check_knock(hp, a, b, middle) == false) {
left = middle + 1;
} else {
right = middle;
}
}
std::cout << middle << std::endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
35 | std::sort(hp.begin(), hp.end(), std::greater<int>());
| ^~~~
| qsort
|
s646196795 | p03700 | C++ | #include <limits>
#include <bits/stdc++.h>
using namespace std;
bool vis[10005]={false};
int a[100005],n;
int main()
{
long long int int i,sum=0,c,b,x;
cin>>n>>c>>b;
x =c-b;
for(i=0;i<n;i++)
{cin>>a[i];
}
long long int moves =1000000000000000,temp;
long long int high,low,mid;
high = 100000000000000;
low = 1;
while(high>low)
{temp=0;
mid = (high+low)/2;
for(i=0;i<n;i++)
{
if(a[i]-mid*b>0)
{
temp += (a[i]-mid*b+x-1)/x;
}
}
if(temp<=mid)
{
moves = min(moves,mid);
high = mid;
}
else
low = mid+1;
}
cout<<low;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:19: error: two or more data types in declaration of 'i'
9 | long long int int i,sum=0,c,b,x;
| ^~~
a.cc:9:19: error: two or more data types in declaration of 'sum'
a.cc:9:19: error: two or more data types in declaration of 'c'
a.cc:9:19: error: two or more data types in declaration of 'b'
a.cc:9:19: error: two or more data types in declaration of 'x'
a.cc:10:17: error: 'c' was not declared in this scope
10 | cin>>n>>c>>b;
| ^
a.cc:10:20: error: 'b' was not declared in this scope
10 | cin>>n>>c>>b;
| ^
a.cc:11:9: error: 'x' was not declared in this scope
11 | x =c-b;
| ^
a.cc:12:13: error: 'i' was not declared in this scope
12 | for(i=0;i<n;i++)
| ^
a.cc:25:15: error: 'i' was not declared in this scope
25 | for(i=0;i<n;i++)
| ^
|
s321910286 | p03700 | C++ | #include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
class Solution {
public:
int n, a, b;
vector<int> h;
bool enough(int t)
{
bool ret = true;
int sum = 0;
for (int i = 0; i < n; i++)
{
sum += ceil((h[i] - b * t) / (double)(a - b));
}
if (sum <= t)
{
ret = true;
}
else
{
ret = false;
}
return ret;
}
void solve(std::istream& in, std::ostream& out) {
in >> n >> a >> b;
for (int i = 0; i < n; i++)
{
int tmp;
in >> tmp;
h.push_back(tmp);
}
int l,c,r;
l = 1;
r = (int)10e9;
while (l < r)
{
c = (l + r) / 2;
if (enough(c))
{
r = c;
}
else
{
l = c + 1;
}
}
c = (l + r) / 2;
out << c;
}
};
void solve(std::istream& in, std::ostream& out)
{
out << std::setprecision(12);
Solution solution;
solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
istream& in = cin;
ostream& out = cout;
solve(in, out);
return 0;
}
| a.cc: In member function 'bool Solution::enough(int)':
a.cc:28:20: error: 'ceil' was not declared in this scope
28 | sum += ceil((h[i] - b * t) / (double)(a - b));
| ^~~~
|
s833077061 | p03700 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define PII pair<int,int>
#define LL long long
LL n,a,b;
LL h[100010];
LL sum=0;
bool check(LL t){
LL cnt=0;
LL base = t*b;
REP(i,n){
LL r=h[i]-base;
cnt+=r/(a-b) + (r%(a-b)!=0);
}
if(cnt>t){
return false;
}else{
return true;
}
}
int nibutan(LL left,LL right){
while(left<right){
LL mid = (left + right)/2;
if(check(mid)){
right=mid;
}else{
left=mid+1;
}
}
return right;
}
int main(){
cin>>n>>a>>b;
REP(i,n){
cin>>h[i];
}
sort(h,h+n);
cout<<nibutan(1,INT_MAX)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:51:19: error: 'INT_MAX' was not declared in this scope
51 | cout<<nibutan(1,INT_MAX)<<endl;
| ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <math.h>
+++ |+#include <climits>
6 | using namespace std;
|
s323364725 | p03700 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, a, b;
ll h[100000], h2[100000], hmax = 0;
int main() {
cin >> n >> a >> b;
for (int i = 0; i < n; i++) {
cin >> h[i];
hmax = max(h[i], hmax);
}
int left = 1, right = hmax, mid;
while (right != left+1) {
mid = (left + right) / 2;
for (int i = 0; i < n; i++)h2[i] = h[i] - mid*b;
ll sum = 0;
for (int i = 0; i < n; i++) {
if (h2[i] > 0) {
sum += ceil(h2[i] / (a - b));
}
}
if (sum > mid) {
left = mid;
}
else {
right = mid;
}
}
cout << right << endl;
} | a.cc: In function 'int main()':
a.cc:24:40: error: 'ceil' was not declared in this scope
24 | sum += ceil(h2[i] / (a - b));
| ^~~~
|
s927785497 | p03700 | C++ | #include <cstdio>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
long N,A,B;
long out = 0;
long C;
long h[1000000];
long x[1000000];
long tem;
bool q(long k){
long t = 0;
REP(N){
t += ceil((double)(h[i]-(k*B))/C );
}
if(t<=k){
return true;
}
else{
return false;
}
}
int main(){
cin >> N >> A >> B;
C = A - B;
REP(N){
cin >> h[i];
}
long long max = 1000000000;//10^9
long long min = 0;
long long mid;
//にぶたん
while(max-min>1){
mid = (max + min)/2;
if(q(mid)){
max = mid;
}
else{
min = mid++;
}
}
mid -=10;
while(!q(mid)){
q++;
}
cout << mid << endl;
} | a.cc: In function 'int main()':
a.cc:66:17: warning: ISO C++ forbids incrementing a pointer of type 'bool (*)(long int)' [-Wpointer-arith]
66 | q++;
| ^
a.cc:66:18: error: lvalue required as increment operand
66 | q++;
| ^~
|
s050127805 | p03700 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A = sc.nextLong();
long B = sc.nextLong();
long h[] = new long[N];
for(int i=0; i<N; i++){
h[i]=sc.nextLong();
}
long fin;
fin = Long.MAX_VALUE/B;
long answer = binarytree(0,fin,A,B,N,h);
System.out.println(answer);
}
public static long binarytree(long startrange, long endrange, long A,long B,int N,long h[]){
if(startrange>endrange) return startrange;
long mid = (startrange+endrange)/2;
if(kansuu(mid,A,B,N,h)){
return binarytree(startrange,mid-1,A,B,N,h);
}
else{
return binarytree(mid+1,endrange,A,B,N,h);
}
}
public static boolean kansuu(long T,long A,long B,int N,long h[]){
double times=0;
for(int i=0; i<N; i++){
for(int k=0; k<T; k++){
double U =(double)(h[i]-B*T);
double K = U/(double)(A-B);
double Y = Math.ceil(K);
if(Y>0){
times = times + Y;
}
}
if(times<=T) return true;
else return false;
}
} | Main.java:45: error: reached end of file while parsing
}
^
1 error
|
s896061261 | p03700 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A = sc.nextLong();
long B = sc.nextLong();
long h[] = new long[N];
for(int i=0; i<N; i++){
h[i]=sc.nextLong();
}
long answer = binarytree(0,Long.MAX_VALUE,A,B,N,h);
System.out.println(answer);
}
public static long binarytree(long startrange, long endrange, long A,long B,int N,long h[]){
if(startrange>endrange) return startrange;
long mid = (startrange+endrange)/2;
if(kansuu(mid,A,B,N,h)){
return binarytree(startrange,mid-1,A,B,N,h);
}
else{
return binarytree(mid+1,endrange,A,B,N,h);
}
}
public static boolean kansuu(long T,long A,long B,int N,long h[]){
long times=0;
for(int i=0; i<N; i++){
double U =((double)(h[i]-B*T))/((double)(A-B));
double Y = Math.ceil(U);
if(Y>0){
times = times + Y;
}
}
if(times<=T) return true;
else return false;
}
} | Main.java:35: error: incompatible types: possible lossy conversion from double to long
times = times + Y;
^
1 error
|
s242581314 | p03700 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
ll h[100005];
ll n,a,b;
bool check(ll k){
ll cnt = k*b;
int num = upper_bound(h+1,h+1+n,cnt) - h;
ll sum = 0;
for(int i = num;i <= n;i++)
{
//printf("h[i]=%lld\n",h[i]);
ll tmp = h[i] - cnt;
sum += (tmp+a-b-1) / (a-b);
//tmp/(a-b)+bool(tmp%(a-b));
}
//printf("%lld %lld\n",sum,k);
return sum <= k;
}
int main(){
scanf("%lld%lld%lld",&n,&a,&b);
for(int i = 1;i <= n;i++)
scanf("%lld",&h[i]);
sort(h+1,h+1+n);
ll l = 0,r = INT_MAX,mid;
while(l < r){
mid = (l+r)/2;
if(!check(mid))
l = mid+1;
else
r = mid;
}
printf("%lld\n",r);
return 0;
}
//2 3 2 3 1 2 1 1 5 5 3 5
| a.cc: In function 'int main()':
a.cc:30:18: error: 'INT_MAX' was not declared in this scope
30 | ll l = 0,r = INT_MAX,mid;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<cstring>
+++ |+#include <climits>
4 | using namespace std;
a.cc:32:9: error: 'mid' was not declared in this scope
32 | mid = (l+r)/2;
| ^~~
|
s818979671 | p03700 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll h[100005];
ll n,a,b;
bool check(ll k){
ll cnt = k*b;
int num = upper_bound(h+1,h+1+n,cnt) - h;
ll sum = 0;
for(int i = num;i <= n;i++)
{
//printf("h[i]=%lld\n",h[i]);
ll tmp = h[i] - cnt;
sum += (tmp+a-b-1) / (a-b);
//tmp/(a-b)+bool(tmp%(a-b));
}
//printf("%lld %lld\n",sum,k);
return sum <= k;
}
int main(){
scanf("%lld%lld%lld",&n,&a,&b);
for(int i = 1;i <= n;i++)
scanf("%lld",&h[i]);
sort(h+1,h+1+n);
ll l = 0,r = INT_MAX,mid;
while(l < r){
mid = (l+r)/2;
if(!check(mid))
l = mid+1;
else
r = mid;
}
printf("%lld\n",r);
return 0;
}
//2 3 2 3 1 2 1 1 5 5 3 5
| a.cc: In function 'int main()':
a.cc:29:18: error: 'INT_MAX' was not declared in this scope
29 | ll l = 0,r = INT_MAX,mid;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include<algorithm>
+++ |+#include <climits>
3 | using namespace std;
a.cc:31:9: error: 'mid' was not declared in this scope
31 | mid = (l+r)/2;
| ^~~
|
s515507497 | p03700 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll h[100005];
ll n,a,b;
bool check(ll k){
ll cnt = k*b;
int num = upper_bound(h+1,h+1+n,cnt) - h;
ll sum = 0;
for(int i = num;i <= n;i++)
{
//printf("h[i]=%lld\n",h[i]);
ll tmp = h[i] - cnt;
sum += (tmp+a-b-1) / (a-b);
//tmp/(a-b)+bool(tmp%(a-b));
}
//printf("%lld %lld\n",sum,k);
return sum <= k;
}
int main(){
scanf("%lld%lld%lld",&n,&a,&b);
for(int i = 1;i <= n;i++)
scanf("%lld",&h[i]);
sort(h+1,h+1+n);
ll l = 0,r = INT_MAX,mid;
while(l < r){
mid = (l+r)/2;
if(!check(mid))
l = mid+1;
else
r = mid;
}
printf("%lld\n",r);
return 0;
}
//2 3 2 3 1 2 1 1 5 5 3 5
| a.cc: In function 'int main()':
a.cc:29:18: error: 'INT_MAX' was not declared in this scope
29 | ll l = 0,r = INT_MAX,mid;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<algorithm>
+++ |+#include <climits>
4 | using namespace std;
a.cc:31:9: error: 'mid' was not declared in this scope
31 | mid = (l+r)/2;
| ^~~
|
s413079458 | p03700 | C++ | #include <cstdio>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
long n, a, b;
scanf("%ld", &n);
scanf("%ld", &a);
scanf("%ld", &b);
vector<long> v;
vector<long> w;
for (int i = 0; i < n; i++)
{
scanf("%ld", &v[i]);
}
sort(v.begin(), v.end(), greater<long>());
long l = 0;
long r = v[0]/b;
long m,count;
bool flag = false;
while (l != r)
{
flag = false;
m = (l + r) / 2;
count = m;
copy(v.begin(), v.end(), w.begin());
for (int i = 0; i < n; i++)
{
w[i] -= b*m;
if (w[i] <= 0)
{
flag = true;
break;
}
count -= ceil((double)(w[i])/(a-b));
if (count < 0) break;
if (i == n - 1)
{
flag = true;
}
}
if (flag)
{
r = m;
}
else
{
l = m + 1;
}
}
printf("%ld\n", l);
} | a.cc: In function 'int main()':
a.cc:40:34: error: 'ceil' was not declared in this scope
40 | count -= ceil((double)(w[i])/(a-b));
| ^~~~
|
s135299795 | p03700 | C++ | #include <bits/stdc++.h>
using namespace std;
int N, A, B, h[100010];
bool check(long long S) {
long long cpy = S;
for (int i = 0; i < N; i++) {
long long x = (h[i] - B * S + A - B - 1) / (A - B);
if (x > S) return false;
else cpy -= max(0, x);
}
if (cpy < 0) return false;
return true;
}
int main(void) {
cin >> N >> A >> B;
long long sum = 0;
for (int i = 0; i < N; i++) {
cin >> h[i];
sum += h[i];
}
long long l = 0, r = sum / N + 1;
while (l < r) {
long long m = (l + r) / 2;
if (check(m)) r = m;
else l = m + 1;
}
cout << l << endl;
return 0;
} | a.cc: In function 'bool check(long long int)':
a.cc:12:24: error: no matching function for call to 'max(int, long long int&)'
12 | else cpy -= max(0, x);
| ~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:12:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
12 | else cpy -= max(0, x);
| ~~~^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:12:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
12 | else cpy -= max(0, x);
| ~~~^~~~~~
|
s661647144 | p03700 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int n, a, b;
vector<int> h;
bool enough(int ii) {
int an = 0;
for (int i = 0; i < n; i++) {
if (h[i] > b * ii) an += (h[i] - b * ii - 1) / a + 1;
else break;
}
return an <= ii;
}
void main() {
cin >> n >> a >> b;
int max = 0;
for (int i = 0; i < n; i++) {
int hoge; cin >> hoge;
h.push_back(hoge);
if (max < hoge) max = hoge;
}
int r = 0, l = (max - 1) / b + 1;
while (r != l) {
int mid = (r + l) / 2;
if (enough(mid)) l = mid;
else r = mid + 1;
}
cout << r << endl;
} | a.cc:21:1: error: '::main' must return 'int'
21 | void main() {
| ^~~~
|
s657442579 | p03700 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main (void){
ll n, a, b;
cin >> n >> a >> b;
cin.ignore();
vector<ll> h;
ll tmp;
for (int i = 0; i < n; i++){
cin >> tmp;
cin.ignore();
h.push_back(tmp);
}
// 最初から一体だけ
if(n == 1){
cout << h[0] / a + 1 << endl;
return 0;
}
// 体力が大きい奴を優先的に消す!
priority_queue <ll> q;
for (auto itr = h.begin(); itr != h.end(); itr++){
q.push(*itr);
}
ll max = q.top();
ll tmp_cnt = 0;
while(!q.empty()){
max = q.top() - b * tmp_cnt;
if(max <= 0) break;
tmp_cnt = max/a+1;
cnt += max / a + 1;
q.pop();
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
39 | cnt += max / a + 1;
| ^~~
| int
a.cc:42:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
42 | cout << cnt << endl;
| ^~~
| int
|
s561350777 | p03700 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main (void){
ll n, a, b;
cin >> n >> a >> b;
cin.ignore();
vector<ll> h;
ll tmp;
for (int i = 0; i < n; i++){
cin >> tmp;
cin.ignore();
h.push_back(tmp);
}
// 最初から一体だけ
if(n == 1){
cout << h[0] / a + 1 << endl;
return 0;
}
// 体力が大きい奴を優先的に消す!
priority_queue <ll> q;
for (auto itr = h.begin(); itr != h.end(); itr++){
q.push(*itr);
}
ll max = q.top();
ll tmp_cnt = 0;
while(!q.empty()){
max = q.top() - b * tmp_cnt;
tmp_cnt = max/a+1;
cnt += max / a + 1;
q.pop();
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:38:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
38 | cnt += max / a + 1;
| ^~~
| int
a.cc:41:11: error: 'cnt' was not declared in this scope; did you mean 'int'?
41 | cout << cnt << endl;
| ^~~
| int
|
s952984681 | p03700 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define reps(i,s,n) for(int (i) = (s); (i) < (n); ++(i))
#define rep(i,n) reps(i,0,n)
const int sqrtN = 512;
struct SqrtDecomposition {
int N, K;
vector<int> data;
vector<int> bucketSum;
vector<int> bucketAdd;
SqrtDecomposition(int n) : N(n) {
K = (N + sqrtN - 1) / sqrtN;
data.assign(K * sqrtN, 0);
bucketSum.assign(K, 0);
bucketAdd.assign(K, 0);
}
// [s, t)
void add(int s, int t, int x) {
for (int k = 0; k < K; ++k) {
int l = k * sqrtN, r = (k + 1) * sqrtN;
if (r <= s || t <= l)
continue;
if (s <= l && r <= t) {
bucketAdd[k] += x;
} else {
for (int i = max(s, l); i < min(t, r); ++i) {
data[i] += x;
bucketSum[k] += x;
}
}
}
}
// [s, t)
int getSum(int s, int t) {
int sum = 0;
for (int k = 0; k < K; ++k) {
int l = k * sqrtN, r = (k + 1) * sqrtN;
if (r <= s || t <= l)
continue;
if (s <= l && r <= t) {
sum += bucketSum[k] + bucketAdd[k] * sqrtN;
} else {
for (int i = max(s, l); i < min(t, r); ++i) {
sum += data[i] + bucketAdd[k];
}
}
}
return sum;
}
};
struct SqrtDecomposition2 {
int N, K;
vector<int> data;
vector<int> bucketMax;
SqrtDecomposition2(int n) : N(n) {
K = (N + sqrtN - 1) / sqrtN;
data.assign(K * sqrtN, 0);
bucketMax.assign(K, 0);
}
// [x, y)
int find(int x, int y) {
int maxVal = 0;
for (int k = 0; k < K; ++k) {
int l = k * sqrtN, r = (k + 1) * sqrtN;
if (r <= x || y <= l)
continue;
if (x <= l && r <= y) {
maxVal = max(maxVal, bucketMax[k]);
} else {
for (int i = max(x, l); i < min(y, r); ++i) {
maxVal = max(maxVal, data[i]);
}
}
}
return maxVal;
}
};
int main(){
int N,A,B;
cin >> N >> A >> B;
vector<int> h;
struct SqrtDecomposition seg(N);//RSQ hpを管理
struct SqrtDecomposition2 seg2(N);//RMQ最大値
for(int i = 0; i < N; i++) cin >> seg.data[i];
seg2.data = seg.data;
int max = 0;
int count = 0;
while(1){
count++;
max = seg2.find(0,N);
seg.update(max,max+1,-B);
seg.update(max,max+1,B-A);
seg2.data = seg.data;
if(seg2.find(0,N) <= 0){
break;
}
}
cout << count << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:98:21: error: 'struct SqrtDecomposition' has no member named 'update'
98 | seg.update(max,max+1,-B);
| ^~~~~~
a.cc:99:21: error: 'struct SqrtDecomposition' has no member named 'update'
99 | seg.update(max,max+1,B-A);
| ^~~~~~
|
s250827850 | p03700 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long
ll cmpfunc(const void *a, const void *b){
return (*(ll*)b - *(ll*)a);
}
int max(int a,int b){
return (a>b)?a:b;
}
int main(void){
ll n,i,a,b;
scanf("%lld %lld %lld",&n,&a,&b);
int h[n+1];
ll sum=0;
for(i=1;i<=n;i++) {scanf("%d",&h[i]);sum+=h[i];}
qsort(h+1,n,sizeof(int),cmpfunc);
ll up=(ll)ceil(1.0*h[1]/b);
ll ans=0;
ans=sum/(a-b+b*n);
ll left=ans;
ll right=up;
ll cur=(left+right)/2;
while(left<=right && cur>=left && cur<=right){
ll count=0;
for(i=1;i<=n;i++) {
if(h[i]<=b*cur) continue;
else {
count+=(ll)ceil(1.0*(h[i]-b*cur)/(a-b));
if(count>cur) break;
}
}
if(count>cur){
left=cur+1;
cur=(left+right)/2;
} else if(count==cur || left>=right-1){
if(left>=right-1){
printf("%lld\n",cur);
return 0;
}
while(count==cur){
cur--;
count=0;
for(i=1;i<=n;i++) {
if(h[i]<=b*cur) continue;
else {
count+=(ll)ceil(1.0*(h[i]-b*cur)/(a-b));
if(count>cur) break;
}
}
if(count!=cur){
printf("%lld\n",cur+1);
return 0;
}
}
} else{
right=cur-1;
cur=(left+right)/2;
}
//printf("%d %d %d %d\n",count,cur,left,right);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:29: error: invalid conversion from 'long long int (*)(const void*, const void*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
23 | qsort(h+1,n,sizeof(int),cmpfunc);
| ^~~~~~~
| |
| long long int (*)(const void*, const void*)
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/stdlib.h:36,
from a.cc:2:
/usr/include/stdlib.h:971:34: note: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s816758632 | p03700 | C++ | // ConsoleApplication2.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include"stdio.h"
#include <string.h>
#include <stdlib.h>
int cmp(const void *a, const void *b)
{
if (*(long long*)a < *(long long*)b){
return -1;
}
else if (*(long long*)a == *(long long*)b) {
return 0;
}
return 1;
}
int main()
{
long long N,A,B;
long long i,j;
long long* h;
long long x,sum=0;
long long hantei = 0;//残っている敵の数
scanf("%lld %lld %lld", &N, &A, &B);
h = (long long*)malloc(N);
for (i = 0; i < N; i++) {
h[i] = scanf("%lld", &(h[i]));
}
qsort(h, N, sizeof(long long), cmp);
printf("%lld %lld\n", h[0], h[1]);
for (i = 0; i > N; i++) {
x = h[i] / A;
if (h[i] % A > 0) { x = x + 1; }//中心の敵に攻撃する回数
h[i] = 0;
hantei = 0;
for (j = i+1; j < N; j++) {
h[j] -= B * x;//周囲の敵へのダメージ
if (h[j] > 0) { hantei++; }
}
sum += x;
if (hantei == 0) {
printf("%lld\n", sum);
}
}
return 0;
} | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s142479957 | p03700 | C++ | #include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, A, B; cin >> N >> A >> B;
int hits = 0;
vector<int> healths;
while(N--)
{
int num; cin >> num;
healths.push_back(num);
}
sort(healths.begin(), healths.end());
for(int i=healths.size()-1; i>=1; i--)
{
if(healths[i] <= B*hits)
break;
hits += ceil((healths[i]-healths[i-1])/(A-B));
}
if(healths[0] > hits*B)
{
hits += healths[0]/A;
}
cout << hits << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:17: error: 'ceil' was not declared in this scope
22 | hits += ceil((healths[i]-healths[i-1])/(A-B));
| ^~~~
|
s577934062 | p03700 | C++ | #include <iostream>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, A, B; cin >> N >> A >> B;
int hits = 0;
vector<int> healths;
while(N--)
{
int num; cin >> num;
healths.push_back(num);
}
sort(healths.begin(), healths.end());
for(int i=healths.size()-1; i>=0; i--)
{
if(healths[i] <= B*hits)
break;
hits += ceil((healths[i]-healths[i-1])/(A-B));
}
cout << hits << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:17: error: 'ceil' was not declared in this scope
22 | hits += ceil((healths[i]-healths[i-1])/(A-B));
| ^~~~
|
s883063065 | p03700 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
new Main.start();
}
int a,b;
int[] hp;
void start(){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
a = in.nextInt();
b = in.nextInt();
hp = new int[n];
for(int i = 0; i < n; i++){
hp[i] = in.nextInt();
}
int count = 0;
int attackDist = a - b;
while(getMax(hp) > 0){
int dist = getMax(hp) - getNextMax(hp);
if(dist < attackDist){
attack(getMaxIndex(hp));
count++;
}else{
int attackCount = 0;
if(dist % attackDist == 0){
attackCount = dist / attackDist;
}else{
attackCount = dist / attackDist + 1;
}
multAttack(getMaxIndex(hp),attackCount);
count += attackCount;
}
}
System.out.println(count);
in.close();
}
int getMaxIndex(int[] a){
int max = Integer.MIN_VALUE;
int index = 0;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
max = a[i];
index = i;
}
}
return index;
}
int getMax(int[] a){
int max = Integer.MIN_VALUE;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
max = a[i];
}
}
return max;
}
int getNextMax(int[] a){
int max = a[0];
int nextmax = 0;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
nextmax = max;
max = a[i];
}else if(a[i] > nextmax){
nextmax = a[i];
}
}
return nextmax;
}
void attack(int index){
for(int i = 0; i < hp.length; i++){
if(index == i) hp[i] -= a;
else hp[i] -= b;
}
}
void multAttack(int index, int count){
for(int i = 0; i < hp.length; i++){
if(index == i) hp[i] -= a * count;
else hp[i] -= b * count;
}
}
}
| Main.java:9: error: cannot find symbol
new Main.start();
^
symbol: class start
location: class Main
1 error
|
s575162362 | p03700 | C++ | using namespace std;
int main()
{
int n, a, b;
scanf("%d", &n);
scanf("%d", &a);
scanf("%d", &b);
vector<int> v(20,0);
int sum = 0;
for (int i = 0; i < n; i++)
{
scanf("%d", &v[i]);
sum += v[i];
}
printf("%d\n", (sum) / (a + (n - 1)*b));
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
6 | scanf("%d", &n);
| ^~~~~
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<int> v(20,0);
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | using namespace std;
a.cc:9:16: error: expected primary-expression before 'int'
9 | vector<int> v(20,0);
| ^~~
a.cc:13:30: error: 'v' was not declared in this scope
13 | scanf("%d", &v[i]);
| ^
a.cc:16:9: error: 'printf' was not declared in this scope
16 | printf("%d\n", (sum) / (a + (n - 1)*b));
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | using namespace std;
|
s450840624 | p03700 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
new ABC_4().start();
}
int a,b;
int[] hp;
void start(){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
a = in.nextInt();
b = in.nextInt();
hp = new int[n];
for(int i = 0; i < n; i++){
hp[i] = in.nextInt();
}
int count = 0;
int attackDist = a - b;
while(getMax(hp) > 0){
int dist = getMax(hp) - getNextMax(hp);
if(dist < attackDist){
attack(getMaxIndex(hp));
count++;
}else{
int attackCount = 0;
if(dist % attackDist == 0){
attackCount = dist / attackDist;
}else{
attackCount = dist / attackDist + 1;
}
multAttack(getMaxIndex(hp),attackCount);
count += attackCount;
}
}
System.out.println(count);
in.close();
}
int getMaxIndex(int[] a){
int max = Integer.MIN_VALUE;
int index = 0;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
max = a[i];
index = i;
}
}
return index;
}
int getMax(int[] a){
int max = Integer.MIN_VALUE;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
max = a[i];
}
}
return max;
}
int getNextMax(int[] a){
int max = a[0];
int nextmax = 0;
for(int i = 0; i < a.length; i++){
if(a[i] > max){
nextmax = max;
max = a[i];
}else if(a[i] > nextmax){
nextmax = a[i];
}
}
return nextmax;
}
void attack(int index){
for(int i = 0; i < hp.length; i++){
if(index == i) hp[i] -= a;
else hp[i] -= b;
}
}
void multAttack(int index, int count){
for(int i = 0; i < hp.length; i++){
if(index == i) hp[i] -= a * count;
else hp[i] -= b * count;
}
}
}
| Main.java:9: error: cannot find symbol
new ABC_4().start();
^
symbol: class ABC_4
location: class Main
1 error
|
s125314944 | p03700 | C++ | #include <cstdio>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
int n, a, b;
scanf_s("%d", &n);
scanf_s("%d", &a);
scanf_s("%d", &b);
vector<int> v(20,0);
int sum = 0;
for (int i = 0; i < n; i++)
{
scanf_s("%d", &v[i]);
sum += v[i];
}
printf("%d\n", (sum) / (a + (n - 1)*b));
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
11 | scanf_s("%d", &n);
| ^~~~~~~
| scanf
|
s383756780 | p03700 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int N,A,B;
cin >> N >> A >> B;
vector<int> h(N);
for(int i = 0; i < N; i++){
cin >> h[i];
}
sort(h.begin(),h.end());
long cnt = 0;
int right = N - 1;
while(h[right] > 0){
cnt++;
for(int i = 0; i < right + 1; i++){
if(i == right) h[i] -= A;
else h[i] -= B;
if(h[i] <= 0){
remove(h,i);
right--;
i--;
}
}
int tmp = right;
for(int i = right - 1; i >= 0; i--){
if(h[tmp] < h[i]){
swap(h[tmp],h[i]);
tmp = i;
}else{
break;
}
}
}
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:28:15: error: no matching function for call to 'remove(std::vector<int>&, int&)'
28 | remove(h,i);
| ~~~~~~^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::remove(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
224 | remove(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:224:1: note: candidate expects 4 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate: 'template<class _FIter, class _Tp> _FIter std::remove(_FIter, _FIter, const _Tp&)'
788 | remove(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:788:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdio.h:158:12: note: candidate: 'int remove(const char*)'
158 | extern int remove (const char *__filename) __THROW;
| ^~~~~~
/usr/include/stdio.h:158:12: note: candidate expects 1 argument, 2 provided
|
s632072609 | p03700 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
//#define EVEL 1
#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif
lli N, B, A, in, sum=0, ans;
vector<lli> H;
int main(){
cin >> N >> A >> B;
for(int i = 0; i < N; i++){
cin >> in;
H.push_back(in);
sum += in;
}
sort(H.begin(), H.end());
if( (sum % (A + B * (N-1))) != 0 ){
for(int i = N-1; i > 0; i--){
if(H[i] <= 0) continue;
cnt= (H[i] - H[i-1]) / A;
if(H[i] % A != 0) cnt++;
for(int j = i-1; j >= 0; j--){
H[j] -= cnt * B;
}
ans += cnt;
}
}else{
ans = sum / (A + B * (N-1));
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:25: error: 'cnt' was not declared in this scope; did you mean 'int'?
37 | cnt= (H[i] - H[i-1]) / A;
| ^~~
| int
|
s714485880 | p03700 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
//#define EVEL 1
#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif
lli N, B, A, in, sum=0;
vector<lli> H;
int main(){
cin >> N >> A >> B;
for(int i = 0; i < N; i++){
cin >> in;
H.push_back(in);
sum += in;
}
/*
sort(H.begin(), H.end());
for(int i = N-1; i > 0; i--){
if(H[i] <= 0) continue;
cnt= (H[i] - H[i-1]) / A;
if(H[i] % A != 0) cnt++;
for(int j = i-1; j >= 0; j--){
H[j] -= cnt * B;
}
ans += cnt;
}*/
ans = sum / (A + B * (N-1));
if( (sum % (A + B * (N-1))) != 0)ans++;
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:43:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
43 | ans = sum / (A + B * (N-1));
| ^~~
| abs
|
s079816046 | p03700 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
long gcd(long a, long b){
if (a%b==0){
return b;
}
else{
return gcd(b,a%b);
}
}
long lcm(long a, long b){
return (a*b) / gcd(a,b);
}
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
ll h[102345];
int main(){
ll n, a, b;
int max = 0, m_n;
cin >> n >> a >> b;
REP(i,n){
scanf("%lld", &h[i]);
if (max < h[i]){
max = h[i];
m_n = i;
}
}
int cnt = 0;
while (max > 0){
REP(i,n){
if (i == m_n) h[i] -= a;
else h[i] -= b;
}
max = 0;
REP(i,n){
if (max < h[i]){
max = h[i];
m_n = i;
}
}
cnt++;
}
cout << cnt << endl
return 0;
} | a.cc: In function 'int main()':
a.cc:72:28: error: expected ';' before 'return'
72 | cout << cnt << endl
| ^
| ;
73 |
74 | return 0;
| ~~~~~~
|
s675555408 | p03700 | C++ | #include <cstdio>
#include <vector>
#include <functional>
using namespace std;
int main()
{
int N,A,B;
std::vector<int> h;
scanf("%d %d %d", &N, &A, &B);
h.resize(N);
for (int i = 0; i < N; i++) {
scanf("%d", h.data() + i);
}
sort(h.begin(), h.end(), std::greater<int>());
int ans = 0;
while(h.front() > 0) {
ans++;
h.front() -= A;
for (auto it = h.begin() + 1; it != h.end(); it++) {
*it -= B;
}
sort(h.begin(), h.end(), std::greater<int>());
}
printf("%d\n", ans);
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:3: error: 'sort' was not declared in this scope; did you mean 'short'?
19 | sort(h.begin(), h.end(), std::greater<int>());
| ^~~~
| short
|
s544960209 | p03701 | C++ | #include <bits/stdc++.h>
int main() {
int N;
cin >> N;
vector < int>t;
int suma = 0;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
suma += a;
if (a % 10 != 0) {
t.push_back(a);
}
}
int minElement = *std::min_element(t.begin(), t.end());
if (suma % 10 == 0 && !t.empty()) {
suma -= minElement;
cout << suma << endl;
}
else if (t.empty()) {
cout << 0 << endl;
}
else cout << suma << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:17: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin >> N;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:17: error: 'vector' was not declared in this scope
6 | vector < int>t;
| ^~~~~~
a.cc:6:17: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:6:26: error: expected primary-expression before 'int'
6 | vector < int>t;
| ^~~
a.cc:13:33: error: 't' was not declared in this scope
13 | t.push_back(a);
| ^
a.cc:16:52: error: 't' was not declared in this scope
16 | int minElement = *std::min_element(t.begin(), t.end());
| ^
a.cc:21:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
21 | cout << suma << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:21:41: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
21 | cout << suma << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:25:25: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
25 | cout << 0 << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:25:38: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
25 | cout << 0 << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:27:22: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
27 | else cout << suma << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:27:38: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
27 | else cout << suma << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s919395583 | p03701 | C++ | #include <bits/stdC++.h>
int main() {
int N;
cin >> N;
vector < int>t;
int suma = 0;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
suma += a;
if (a % 10 != 0) {
t.push_back(a);
}
}
int minElement = *std::min_element(t.begin(), t.end());
if (suma % 10 == 0 && !t.empty()) {
suma -= minElement;
cout << suma << endl;
}
else if (t.empty()) {
cout << 0 << endl;
}
else cout << suma << endl;
return 0;
} | a.cc:1:10: fatal error: bits/stdC++.h: No such file or directory
1 | #include <bits/stdC++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s859384279 | p03701 | C++ | #include <bits/stdC++. H>
int main() {
int N;
cin >> N;
vector < int>t;
int suma = 0;
for (int i = 0; i < N; i++) {
int a;
cin >> a;
suma += a;
if (a % 10 != 0) {
t.push_back(a);
}
}
int minElement = *std::min_element(t.begin(), t.end());
if (suma % 10 == 0 && !t.empty()) {
suma -= minElement;
cout << suma << endl;
}
else if (t.empty()) {
cout << 0 << endl;
}
else cout << suma << endl;
return 0;
} | a.cc:1:10: fatal error: bits/stdC++. H: No such file or directory
1 | #include <bits/stdC++. H>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s564739203 | p03701 | C++ | using namespace std;
int main() {
vector<int>s;
bool x = true;
int n;
int aux;
int total = 0;
int rest = 105;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> aux;
s.push_back(aux);
total += aux;
}
if (total % 10 != 0){
cout << total << endl;
x = false;
}
else if (total % 10 == 0) {
for (int i = 0; i < n; i++) {
if (s[i] % 10 > 0)
rest = min(rest, s[i]);
}
if (rest<105) {
cout << total-rest << endl;
x = false;
}
}
if (x == true) cout << 0 << endl;
return(0);
} | a.cc: In function 'int main()':
a.cc:3:9: error: 'vector' was not declared in this scope
3 | vector<int>s;
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | using namespace std;
a.cc:3:16: error: expected primary-expression before 'int'
3 | vector<int>s;
| ^~~
a.cc:9:9: error: 'cin' was not declared in this scope
9 | cin >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:12:17: error: 's' was not declared in this scope
12 | s.push_back(aux);
| ^
a.cc:16:17: error: 'cout' was not declared in this scope
16 | cout << total << endl;
| ^~~~
a.cc:16:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:16:34: error: 'endl' was not declared in this scope
16 | cout << total << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
a.cc:21:29: error: 's' was not declared in this scope
21 | if (s[i] % 10 > 0)
| ^
a.cc:22:32: error: 'min' was not declared in this scope; did you mean 'main'?
22 | rest = min(rest, s[i]);
| ^~~
| main
a.cc:26:17: error: 'cout' was not declared in this scope
26 | cout << total-rest << endl;
| ^~~~
a.cc:26:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:39: error: 'endl' was not declared in this scope
26 | cout << total-rest << endl;
| ^~~~
a.cc:26:39: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:30:24: error: 'cout' was not declared in this scope
30 | if (x == true) cout << 0 << endl;
| ^~~~
a.cc:30:24: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:30:37: error: 'endl' was not declared in this scope
30 | if (x == true) cout << 0 << endl;
| ^~~~
a.cc:30:37: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s562220615 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
ll n;
cin>>n;
ll a[n]={};
ll counter=0;
ll f=0;
for(ll i=0;i<n;i++){
cin>>a[i];
counter+=a[i];}
sort(a,a+n);
if(counter%10!=0){
cout<<counter<<endl;}
else{
for(ll i=0;i<n;i++){
if(a[i]%10!=0){
cout<<counter-a[i]<<endl;
f++;
break;}}
if(f==0){
cout<<0<<endl;}}
| a.cc: In function 'int main()':
a.cc:25:17: error: expected '}' at end of input
25 | cout<<0<<endl;}}
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s385635877 | p03701 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main() {
vector<int>s;
int n;
int aux;
int total = 0;
int cont = 0;
int menor = 101;
int indice;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> aux;
if (aux % 10 == 0)
cont++;
s.push_back(aux);
total += aux;
}
if (cont == n)
cout << "0";
else if (total%10!=0)
cout << total;
else if (total % 10 == 0) {
for(int i=0;i<n;i++){
if (s[i] < menor) {
aux = s[i];
menor = aux;
indice = i;
}
total -= menor;
if (total % 10 != 0)
break;
}
if(s.size!=0)
s.erase(s.begin() + indice);
cout << total;
}
return(0);
} | a.cc: In function 'int main()':
a.cc:35:6: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
35 | if(s.size!=0)
| ~~^~~~
| ()
|
s146432552 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
int main (){
int n,s,contador, min;
int sum=0;
multiset <int> notas;
cin >>n;
for (int i=0;i<n;i++){
cin >> s;
notas.insert(s);
}
for (int i=0;i<n;i++){a
for (auto &it:notas){
sum += it;
}
if (sum % 10 == 0){
min = 101;
for (auto &it:notas){
if (it < min) min = it;
}
contador = notas.count(min);
if (contador >1){
notas.erase(min);
for (int j=0;j<contador-1;j++){
notas.insert(contador);
}
}
else {
notas.erase(min);
}
}
else {
break;
}
sum =0;
}
cout << sum;
} | a.cc: In function 'int main()':
a.cc:15:31: error: 'a' was not declared in this scope
15 | for (int i=0;i<n;i++){a
| ^
|
s028948191 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
int dp[105][10], a[105];
int main(){
memset(dp, -1, sizeof(dp));
int n;
scanf("%d", &n);
for(int i=1;i<=n;i++) scanf("%d", &a[i]);
dp[0][0] = 0;
for(int i=1;i<=n;i++){
for(int j=0;j<10;j++){
if(dp[i-1][j] == -1) continue;
int nt = (j+a[i])%10;
dp[i][nt] = max(dp[i][nt], dp[i-1][j] + a[i]);
dp[i][j] = max(dp[i][j], dp[i-1][j]);
}
}
int ans = 0;
for(int j=1;j<10;j++) ans = max(ans, dp[n/][j]);
printf("%d\n", ans);
} | a.cc: In function 'int main()':
a.cc:29:47: error: expected primary-expression before ']' token
29 | for(int j=1;j<10;j++) ans = max(ans, dp[n/][j]);
| ^
|
s497560229 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(long long i = a;i < b;i++)
#define rf(i,a,b) for(long long i=a;i>=b;i--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define w(t) while(t--)
#define c(n); cin>>n;
#define p(n) cout<<n;
#define pl(n) cout<<n<<endl;
#define ps(n); cout<<n<<" ";
#define F first
#define S second
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
#define ull unsigned long long
#define vll vector<ll>
#define vii vector<ii>
#define mkp make_pair
#define ld long double
#define arrin(a,n) f(i,0,n){cin>>a[i];}
#define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";}
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define PI (2*acos(0))
const long long N = 1e6+5;
vll visit,dist,taken;
vector<vll> adj;
vector<vii> adj2;
priority_queue<ii,vector<ii>, greater<ii> > pq;
ll bit[N]={0};
ll siz;
ll res = 0;
ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll power(ll a,ll b){if(b == 0)return 1;if(b == 1)return a;ll ans = power(a,b/2) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;}
ll inverse(ll x){x%=MOD;return power(x,MOD-2);}
void BITup(ll k, ll x){while(k <= siz){bit[k]+=x;k += k & -k;}}
ll BITq(ll k){ll s=0;while(k>=1){s+=bit[k];k -= k &-k;}return s;}
struct node{ll lazy,val;}seg[4000000];
struct point{ll x,y;};
void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
ll mst(ll s){taken.assign(N, 0);prim(s);ll cost = 0;while(!pq.empty()){ii front = pq.top();pq.pop();ll w = front.first;ll u = front.second;if(taken[u]==0)cost += w;prim(u);}return cost;}
void YESNO(ll a){if(a){pl("YES");}else{pl("NO");}}
void filesin(void){freopen("tracing.in","r",stdin);}
void filesout(void){freopen("tracing.out","w",stdout);}
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Training
int main(void){
fastio;
ll n;
c(n);
ll arr[n];
arrin(arr,n);
ll sum = 0;
f(i,0,n){
sum += arr[i];
}
ll dp[n+1][sum+1];
ll ans = 0;
f(i,0,n+1){
f(j,0,sum+1){
if(i == 0 || j == 0){
dp[i][j] = 0;
}
else if(j >= arr[i-1]){
dp[i][j] = max(dp[i-1][j],dp[i-1][j-arr[i-1]] + arr[i-1]);
}
else{
dp[i][j] = dp[i-1][j];
}
if(dp[i][j] % 10){
ans = max(ans,dp[i][j]);
}
}
}
pl(ans);
}
| a.cc: In function 'void dfs(ll)':
a.cc:45:16: error: reference to 'visit' is ambiguous
45 | void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:30:5: note: 'std::vector<long long int> visit'
30 | vll visit,dist,taken;
| ^~~~~
a.cc:45:52: error: reference to 'visit' is ambiguous
45 | void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:30:5: note: 'std::vector<long long int> visit'
30 | vll visit,dist,taken;
| ^~~~~
a.cc: In function 'void bfs(ll)':
a.cc:46:16: error: reference to 'visit' is ambiguous
46 | void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:30:5: note: 'std::vector<long long int> visit'
30 | vll visit,dist,taken;
| ^~~~~
a.cc:46:122: error: reference to 'visit' is ambiguous
46 | void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:30:5: note: 'std::vector<long long int> visit'
30 | vll visit,dist,taken;
| ^~~~~
a.cc:46:132: error: reference to 'visit' is ambiguous
46 | void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:30:5: note: 'std::vector<long long int> visit'
30 | vll visit,dist,taken;
| ^~~~~
|
s632892901 | p03701 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t,n,i,j,k,x,sum=0;
cin>>n;
vector<ll> vi;
for( i = 0 ;i< n;i++){
cin>>x;
vi.push_back(x);
sum+=x;
}
sort(vi.begin(),vi.end());
ll flag =0;
if(sum%10 == 0){
for(i = 0 ;i< n ;i++)
{
ll x= vi;
if(x%10 !=0)
{
sum-=x;
flag = 1;
break;
}
}
if(flag == 1)
cout<<sum<<endl;
else
cout<<0<<endl;
}
else
cout<<sum<<endl;
}
| a.cc: In function 'int main()':
a.cc:19:15: error: cannot convert 'std::vector<long long int>' to 'long long int' in initialization
19 | ll x= vi;
| ^~
| |
| std::vector<long long int>
|
s817104619 | p03701 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll t,n,i,j,k,x,sum=0;
cin>>n;
vector<ll> vi;
for( i = 0 ;i< n;i++){
cin>>x;
vi.push_back(x);
sum+=x;
}
sort(vi.begin(),vi.end());
ll flag =0;
for(i = 0 ;i< n ;i++)
{
ll x= vi;
if(x%10 !=0)
{
sum-=x;
flag = 1;
break;
}
}
if(flag == 1)
cout<<sum<<endl;
else
cout<<0<<endl;
}
| a.cc: In function 'int main()':
a.cc:18:15: error: cannot convert 'std::vector<long long int>' to 'long long int' in initialization
18 | ll x= vi;
| ^~
| |
| std::vector<long long int>
|
s611597328 | p03701 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << endl
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
int dx8[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy8[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ fill((T*)array, (T*)(array+N), val); }
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
int main(void){
int N;
cin >> N;
bool dp[110][10010];
int s[N];
rep(i,N){
cin >> s[i];
}
Fill(dp,false);
dp[0][0]= true;
rep(i,N){
for(int j =0; j<=10010;j++){
if((j+s[i])%10 != 0){
dp[i+1][j+s[i]] |= dp[i][j];
}else{
dp[i+1][j+s[i]]=false;
}
}
}
int ans=0;
rep(j,10010){
if(d[N][j]){
chmax(ans,j);
}
}
fin(ans);
} | a.cc: In function 'int main()':
a.cc:89:10: error: 'd' was not declared in this scope
89 | if(d[N][j]){
| ^
|
s066877317 | p03701 | C++ | #include <bits/stdc++.h>
/*
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
*/
#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define up_b upper_bound
#define low_b lower_bound
#define lcm(a,b) (a * b) / __gcd(a, b)
#define REVERSE(a, n) reverse(a + 1, a + n + 1);
#define SORT(a, n) sort(a + 1, a + n + 1);
#define rsz resize
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
typedef vector <ll> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <ll, ll> pll;
typedef map <ll, ll> mll;
typedef set <ll> sl;
typedef set <char> sc;
typedef map <string, ll> msl;
typedef map <string, bool> msb;
typedef map <char, ll> mcl;
typedef map <string, string> mss;
typedef vector <vl> vvl;
const ll mxn = 2e5 + 1;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ld eps = 1e-9;
const ld PI = acos(-1);
#define int int64_t
#define FLN "LOL"
//int dx[]= {1,0,-1,0}; int dy[]= {0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction
inline void joji(bool ok = 0) {naj;if(ok){freopen(FLN".in","r",stdin);freopen(FLN".out","w",stdout);}}
signed main () {
joji();
int n, s = 10000;
cin >> n;
vvl dp(n + 1, vl(s + 1, -inf));
vl a(n + 1);
for(int i = 1; i <= n; i++) cin >> a[i];
dp[0][0] = 0;
for(int i = 1; i <= n; i++) {
for(int j = 0; j <= s; j++) {
dp[i][j] = max(dp[i][j], dp[i - 1][j]);
if(j >= a[i]) dp[i][j] = max(dp[i][j] * 1ll, dp[i - 1][j - a[i]] + a[i] * 1ll);
}
}
int ans = -1;
for(int i = 1; i <= n; i++) {
for(int j = 0; j <= s; j++) {
if(dp[i][j] >= 0) {
if(dp[i][j] % 10 == 0) ans = max(ans, 0ll);
else ans = max(ans, dp[i][j] * 1ll);
}
}
}
cout << ans;
return 0;
} | a.cc: In function 'int main()':
a.cc:95:65: error: no matching function for call to 'max(int64_t&, long long int)'
95 | if(dp[i][j] % 10 == 0) ans = max(ans, 0ll);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:95:65: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
95 | if(dp[i][j] % 10 == 0) ans = max(ans, 0ll);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:95:65: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
95 | if(dp[i][j] % 10 == 0) ans = max(ans, 0ll);
| ~~~^~~~~~~~~~
a.cc:96:47: error: no matching function for call to 'max(int64_t&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)'
96 | else ans = max(ans, dp[i][j] * 1ll);
| ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:96:47: note: deduced conflicting types for parameter 'const _Tp' ('long int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
96 | else ans = max(ans, dp[i][j] * 1ll);
| ~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:96:47: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
96 | else ans = max(ans, dp[i][j] * 1ll);
| ~~~^~~~~~~~~~~~~~~~~~~~~
|
s381989593 | p03701 | C++ | asdwefwefw | a.cc:1:1: error: 'asdwefwefw' does not name a type
1 | asdwefwefw
| ^~~~~~~~~~
|
s557321667 | p03701 | Java | import java.util.*;
public class ABC075_D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
int Bombc = scan.nextInt();
int Bombs = scan.nextInt();
int exdmg = Bombc - Bombs;
int mnstrhp[] = new int[num];
int cpy[] = new int[num];
int count = 0;
for (int i = 0; i < num; i++) {
mnstrhp[i] = scan.nextInt();
}
for(int i = 0;i<num;i++) {
cpy[i] = mnstrhp[i];
}
int l = 0;
int r = 1000000001;
int dmgcount = 0;
boolean extnct = true;
while (l < r - 1) {
for(int i = 0;i<num;i++){
mnstrhp[i] = cpy[i];
}
int m = (l+r)/2;
int o = m;
extnct = true;
for(int i = 0;i<num;i++){
mnstrhp[i] -= (Bombs*m);
}
for(int i = 0;i<num;i++){
if(mnstrhp[i]>0&&o>0){
dmgcount = (mnstrhp[i] % exdmg==0) ? mnstrhp[i]/exdmg : (mnstrhp[i]/exdmg) + 1;
if(o >= dmgcount) {
mnstrhp[i] -= dmgcount*exdmg;
o -= dmgcount;
}
}
}
for(int i = 0;i<num;i++){
if(mnstrhp[i]>0){
extnct = false;
}
}
if (extnct) {
r = m;
} else {
l = m;
}
}
System.out.println(r);
}
}
| Main.java:2: error: class ABC075_D is public, should be declared in a file named ABC075_D.java
public class ABC075_D {
^
1 error
|
s216886031 | p03701 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
int[] total =new int[n];
int total = 0;
for(int j=1;j<n;j++){
total += a1[j];
}
Arrays.sort(a1);
if(total % 10 != 0){
ans = total;
}
for (int k = n-1; k < 0; k--) {
if (a1[k] % 10 != 0) {
ans = total - a1[k];
break;
}
}
System.out.println(ans);
}
}
| Main.java:14: error: variable total is already defined in method main(String[])
int total = 0;
^
1 error
|
s962339149 | p03701 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
int[] total =new int[n];
for(int j=0;j<n;j++){
if(j = 0 \){
total[j] = a1[j];
}else{
total[j] = total[j-1] + a1[j];
}
}
Arrays.sort(total);
for (int k = n-1; k < 0; k--) {
if (total[k] % 10 != 0) {
ans = total[k];
break;
}
}
System.out.println(ans);
}
}
| Main.java:15: error: illegal character: '\'
if(j = 0 \){
^
Main.java:17: error: 'else' without 'if'
}else{
^
2 errors
|
s723905645 | p03701 | Java | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
int[] total =new int[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total);
for (int k = n-1; k =0; k--) {
if (total[k] % 10 != 0) {
ans = total[k];
}
}
System.out.println(ans);
}
}
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
int[] total =new int[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total);
for (int k = n-1; k < 0; k--) {
if (total[k] % 10 != 0) {
ans = total[k];
}
}
System.out.println(ans);
}
}
| Main.java:28: error: class, interface, enum, or record expected
import java.io.*;
^
Main.java:29: error: class, interface, enum, or record expected
import java.util.*;
^
2 errors
|
s328692449 | p03701 | Java | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
int[] total =new int[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total);
for (int k = n-1; k =0; k--) {
if (total[k] % 10 != 0) {
ans = total[k];
}
}
System.out.println(ans);
}
} | Main.java:20: error: incompatible types: int cannot be converted to boolean
for (int k = n-1; k =0; k--) {
^
1 error
|
s408050505 | p03701 | Java | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
long[] total =new long[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total, Collections.reverseOrder());
for (int k = 0; k < n; k++) {
if (total[k] % 10 != 0) {
ans = total[k];
}
}
System.out.println(ans);
}
} | Main.java:18: error: no suitable method found for sort(long[],Comparator<Object>)
Arrays.sort(total, Collections.reverseOrder());
^
method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
(inference variable T#1 has incompatible bounds
equality constraints: long
upper bounds: Object)
method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
Main.java:22: error: incompatible types: possible lossy conversion from long to int
ans = total[k];
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
|
s467912175 | p03701 | Java | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
long[] total =new long[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total, Collections.reverseOrder());
for (int k = 0; k < n; k++) {
if (total[k] % 10 != 0) {
ans = points[i];
}
}
System.out.println(ans);
}
} | Main.java:18: error: no suitable method found for sort(long[],Comparator<Object>)
Arrays.sort(total, Collections.reverseOrder());
^
method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable
(inference variable T#1 has incompatible bounds
equality constraints: long
upper bounds: Object)
method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>)
T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>)
Main.java:22: error: cannot find symbol
ans = points[i];
^
symbol: variable points
location: class Main
Main.java:22: error: cannot find symbol
ans = points[i];
^
symbol: variable i
location: class Main
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors
|
s049001089 | p03701 | Java | import java.io.*;
import java.until.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
long[] total =new long[n];
for(int j=0;j<n;j++){
total[j] = a1[j];
}
Arrays.sort(total, Collections.reverseOrder());
for (int k = 0; k < n; k++) {
if (total[k] % 10 != 0) {
ans = points[i];
}
}
System.out.println(ans);
}
} | Main.java:2: error: package java.until does not exist
import java.until.*;
^
Main.java:6: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:18: error: cannot find symbol
Arrays.sort(total, Collections.reverseOrder());
^
symbol: variable Arrays
location: class Main
Main.java:18: error: cannot find symbol
Arrays.sort(total, Collections.reverseOrder());
^
symbol: variable Collections
location: class Main
Main.java:22: error: cannot find symbol
ans = points[i];
^
symbol: variable points
location: class Main
Main.java:22: error: cannot find symbol
ans = points[i];
^
symbol: variable i
location: class Main
7 errors
|
s237797255 | p03701 | Java | import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] a1=new int[n];
int ans = 0;
for(int i=0;i<n;i++){
a1[i]=sc.nextInt();
}
long[] total =new long[n];
for(int j=0;j<n;j++){
total += a1[j];
}
Arrays.sort(total, Collections.reverseOrder());
for (int k = 0; k < n; k++) {
if (total[k] % 10 != 0) {
ans = points[i];
}
}
System.out.println(ans);
}
}
| Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:14: error: bad operand types for binary operator '+'
total += a1[j];
^
first type: long[]
second type: int
Main.java:16: error: cannot find symbol
Arrays.sort(total, Collections.reverseOrder());
^
symbol: variable Arrays
location: class Main
Main.java:16: error: cannot find symbol
Arrays.sort(total, Collections.reverseOrder());
^
symbol: variable Collections
location: class Main
Main.java:20: error: cannot find symbol
ans = points[i];
^
symbol: variable points
location: class Main
Main.java:20: error: cannot find symbol
ans = points[i];
^
symbol: variable i
location: class Main
7 errors
|
s185946493 | p03701 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,s[1005],sum=0,flag=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i];
sum+=s[i];
}
sort(s,s+n);
if(ans%10!=0){
cout<<sum<<'\n';
flag=1;
}
else{
for(int i=0;i<n;i++){
if(sum-s[i]%10!=0){
cout<<sum-s[i]<<'\n';
flag=1;
}
}
}
if(flag==0)
cout<<0<<'\n';
return(0);
}
| a.cc: In function 'int main()':
a.cc:11:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | if(ans%10!=0){
| ^~~
| abs
|
s540431583 | p03701 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,s[1005],sum=0,flag=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>s[i];
sum+=s[i];
}
sort(s,s+n);
if(ans%10!=0){
cout<<sum<<'\n';
flag=1;
}
else{
for(int i=0;i<n;i++){
if(ans-s[i]%10!=0){
cout<<ans-s[i]<<'\n';
flag=1;
}
}
}
if(flag==0)
cout<<0<<'\n';
return(0);
} | a.cc: In function 'int main()':
a.cc:11:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | if(ans%10!=0){
| ^~~
| abs
|
s290557730 | p03701 | C++ | #include<bits/stdc++.h>
#include<iomanip>
#include<numeric>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(auto &a : v) cin>>a;
vector<int> s;
s.push_back(0);
for(int i=0;i<n;++i){
int m = (int)s.size();
for(int j=0;j<m;++j){
s.push_back(s[j]+v[i]);
}
}
sort(s.rbegin(),s.rend());
int ret = 0;
for(auto a : s){
if(a%10){ret = a;break;}
}
cout << ret << endl;
return 0;
}
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>
using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int mod = mo;
constexpr int inf = 1<<30;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(auto &a : v) cin>>a;
vector<int> s;
s.push_back(0);
for(int i=0;i<n;++i){
int m = (int)s.size();
for(int j=0;j<m;++j){
s.push_back(s[j]+v[i]);
}
}
sort(s.rbegin(),s.rend());
int ret = 0;
for(auto a : s){
if(a%10){ret = a;break;}
}
cout << ret << endl;
return 0;
}
| a.cc:37:5: error: redefinition of 'int main()'
37 | int main(){
| ^~~~
a.cc:6:5: note: 'int main()' previously defined here
6 | int main(){
| ^~~~
|
s806419640 | p03701 | C++ | #include<bits/stdc++.h>
#include<iomanip>
#include<numeric>
using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int mod = mo;
constexpr int inf = 1<<30;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(auto &a : v) cin>>a;
vector<int> s;
s.push_back(0);
for(int i=0;i<n;++i){
int m = (int)s.size();
for(int j=0;j<m;++j){
s.push_back(s[j]+v[i]);
}
}
sort(s.rbegin(),s.rend());
int ret = 0;
for(auto a : s){
if(a%10){ret = a;break;}
}
cout << ret << endl;
return 0;
}
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>
using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int mod = mo;
constexpr int inf = 1<<30;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(auto &a : v) cin>>a;
vector<int> s;
s.push_back(0);
for(int i=0;i<n;++i){
int m = (int)s.size();
for(int j=0;j<m;++j){
s.push_back(s[j]+v[i]);
}
}
sort(s.rbegin(),s.rend());
int ret = 0;
for(auto a : s){
if(a%10){ret = a;break;}
}
cout << ret << endl;
return 0;
}
| a.cc:38:15: error: redefinition of 'constexpr const int mo'
38 | constexpr int mo = 1e9+7;
| ^~
a.cc:7:15: note: 'constexpr const int mo' previously defined here
7 | constexpr int mo = 1e9+7;
| ^~
a.cc:39:16: error: redefinition of 'constexpr const int mod'
39 | constexpr int mod = mo;
| ^~~
a.cc:8:16: note: 'constexpr const int mod' previously defined here
8 | constexpr int mod = mo;
| ^~~
a.cc:40:15: error: redefinition of 'constexpr const int inf'
40 | constexpr int inf = 1<<30;
| ^~~
a.cc:9:15: note: 'constexpr const int inf' previously defined here
9 | constexpr int inf = 1<<30;
| ^~~
a.cc:41:5: error: redefinition of 'int main()'
41 | int main(){
| ^~~~
a.cc:10:5: note: 'int main()' previously defined here
10 | int main(){
| ^~~~
|
s528565547 | p03701 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
// 与えられた大きさ n の int 型配列 array[]を comp で与えられたオプションでソートする
// qsort(array, size, sizeof(int),comp);
// 昇順オプション
int ASC(const int *a,const int *b){
return (*a - *b);
}
// 降順オプション
int DESC(const int *a,const int *b){
return (*b - *a);
}
int main(int argc, char const *argv[])
{
int i,n,answer=0;
int sum=0;
int a[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
qsort(a,n,sizeof(int),ASC);
for(i=0;i<n;i++){
sum+=a[i];
if(sum%10==0)
answer=sum;
}
prinf("%d",answer);
return 0;
}
| main.c: In function 'main':
main.c:28:25: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
28 | qsort(a,n,sizeof(int),ASC);
| ^~~
| |
| int (*)(const int *, const int *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const int *, const int *)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
main.c:36:3: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
36 | prinf("%d",answer);
| ^~~~~
| printf
|
s836865009 | p03701 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
// 与えられた大きさ n の int 型配列 array[]を comp で与えられたオプションでソートする
// qsort(array, size, sizeof(int),comp);
// 昇順オプション
int ASC(const int *a,const int *b){
return (*a - *b);
}
// 降順オプション
int DESC(const int *a,const int *b){
return (*b - *a);
}
int main(int argc, char const *argv[])
{
int n,answer=0;
int sum=0;
int a[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
qsort(a,n,sizeof(int),ASC);
for(i=0;i<n;i++){
sum+=a[i];
if(sum%10==0)
answer=sum;
}
prinf("%d",answer);
return 0;
| main.c: In function 'main':
main.c:25:7: error: 'i' undeclared (first use in this function)
25 | for(i=0;i<n;i++){
| ^
main.c:25:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:28:25: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
28 | qsort(a,n,sizeof(int),ASC);
| ^~~
| |
| int (*)(const int *, const int *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const int *, const int *)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
main.c:36:3: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
36 | prinf("%d",answer);
| ^~~~~
| printf
main.c:37:3: error: expected declaration or statement at end of input
37 | return 0;
| ^~~~~~
|
s007807993 | p03701 | C++ | #include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;
//分数不为10的倍数的最大情况
using namespace std;
int main()
{
int n, sum = 0, a;
int MinAns = 256;
cin>>n;
REP(i, 0, n)
{
cin >> a;
sum += a;
if(a%10){
MinAns = min(MinAns , a);
}
}
/*
if(sum%10)
printf("%d\n", sum);
else
printf("%d\n", MinAns == 256 ? 0 :(sum-MinAns));
return 0;
}
| a.cc:25:5: error: unterminated comment
25 | /*
| ^
a.cc: In function 'int main()':
a.cc:24:6: error: expected '}' at end of input
24 | }
| ^
a.cc:13:1: note: to match this '{'
13 | {
| ^
|
s395490292 | p03701 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ins(a,b,c) a.insert(a.begin()+b,c)
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
int wari(int a,int b) {
if(a%b==0)
return a/b;
else
return a/b+1;
}
int keta(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int souwa(int a){
return a*(a+1)/2;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
bool prime(int a){
if(a<2)
return false;
else if(a==2)
return true;
else if(a%2==0)
return false;
double b=sqrt(a);
for(int i=3;i<=b;i+=2){
if(a%i==0){
return false;
}
}
return true;
}
signed main(){
int a,c=1,d=0;
cin>>a;
vector<int> b(a);
fo(i,a)
cin>>b[i].first;
fo(i,a){
if(b[i]%10!=0)
c=0;
}
if(c)
cout<<0<<endl;
else{
fo(i,a)
d+=b[i];
Sort(b);
fo(i,a){
if(b[i]%10!=0){
d-=b[i];
break;
}
}
cout<<d<<endl;
}
} | a.cc: In function 'int main()':
a.cc:79:15: error: request for member 'first' in 'b.std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
79 | cin>>b[i].first;
| ^~~~~
|
s352725154 | p03701 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int n;
cin >> n;
ll sum = 0;
vector<int> v(n);
for(int i = 0 ; i <n ; i++){
cin >> v[i];
sum += v[i];
}
sort(v.begin(),v.end());
int i = 0;
while(sum % 10 == 0){
sum -= v[i]
i++;
}
} | a.cc: In function 'int main()':
a.cc:19:16: error: expected ';' before 'i'
19 | sum -= v[i]
| ^
| ;
20 | i++;
| ~
|
s740742267 | p03701 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007
int ASC(const int *a,const int *b){
return (*a - *b);
}
int main(int argc, char const *argv[])
{
int n,s[100];
int max = 0,min = 0x7F,pat,sum = 0;
scanf("%d",&N);
for (int i = 0; i < n; ++i){
scanf(" %d",&s[i]);
sum += s[i];
}
if(sum % 10 != 0){
printf("%d\n",sum);
return 0;
}
else{
qsort(s,n,sizeof(int),ASC);
for (int i = 0; i < n; ++i)
{
if(s[i] % 10 != 0){
sum -= s[i];
break;
}
}
sum = (sum % 10 == 0) ? 0 : sum;
printf("%d\n", sum);
}
}
| main.c: In function 'main':
main.c:19:21: error: 'N' undeclared (first use in this function)
19 | scanf("%d",&N);
| ^
main.c:19:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:29:39: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
29 | qsort(s,n,sizeof(int),ASC);
| ^~~
| |
| int (*)(const int *, const int *)
In file included from main.c:2:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(const int *, const int *)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s520963720 | p03701 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n;
cin>>n;
int s[n];
vector<int> tens,nots;
int a=0;
int ns=0;
REP(i,n){
cin>>s[i];
a += s[i];
if(s[i]%10==0){
tens.push_back(s[i]);
}else{
ns += s[i];
nots.push_back(s[i]);
}
}
if(nots.size()==0){
cout<<0<<endl;
}else if(nots.size()==1){
cout<<a<<endl;
}else{
if(a%10!==0){
cout<<a<<endl;
}else{
sort(nots.begin(),nots.end());
cout<<a-nots[0]<<endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:112:14: error: expected primary-expression before '=' token
112 | if(a%10!==0){
| ^
|
s181061946 | p03701 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n;
cin>>n;
int s[n];
vector<int> tens,nots;
int a=0;
int n=0;
REP(i,n){
cin>>s[i];
a += s[i];
if(s[i]%10==0){
tens.push_back(s[i]);
}else{
n += s[i];
nots.push_back(s[i]);
}
}
if(nots.size()==0){
cout<<0<<endl;
}else if(nots.size()==1){
cout<<a<<endl;
}else{
if(s%10!==0){
cout<<a<<endl;
}else{
sort(nots.begin(),nots.end());
cout<<a-nots[0]<<endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:95:7: error: redeclaration of 'int n'
95 | int n=0;
| ^
a.cc:90:7: note: 'int n' previously declared here
90 | int n;
| ^
a.cc:112:9: error: invalid operands of types 'int [n]' and 'int' to binary 'operator%'
112 | if(s%10!==0){
| ~^~~
| | |
| | int
| int [n]
a.cc:112:14: error: expected primary-expression before '=' token
112 | if(s%10!==0){
| ^
|
s062945615 | p03701 | C | /*
* @Author Silviase(@silviasetitech)
* For ProCon
*/
import java.util.*;
import java.lang.*;
import java.math.*;
public class Main{
static int MOD = (int)1e9+7;
// for dfs
static int n;
static int ansi;
static int[] w;
static int[] ww;
static boolean[] isvisited;
//
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
int sum = 0;
for (int i = 0; i < n; i++) {
s[i] = sc.nextInt();
sum+=s[i];
}
Arrays.sort(s);
if (sum % 10 != 0) {
System.out.println(sum);
return;
}else{
for (int i = 0; i < n; i++) {
if (s[i] % 10 != 0) {
System.out.println(sum-s[i]);
return;
}else{
continue;
}
}
}
System.out.println(0);
sc.close();
}
/*
For Numeric Analysis
*/
public static int ManhattanDist(int x, int y, int xx, int yy) {
return(Math.abs(xx-x) + Math.abs(yy-y));
}
public static double FuncOfx(double x, int funcnum) {
switch (funcnum) {
case 1:
return x*x;
case 2:
return Math.exp(-1*x)-x*x;
default:
throw new IllegalArgumentException("Such Func doesn't Exist.");
}
}
public static void Nibutan(double target, int funcnum) {
int callcounter = 0;
double lowbound = Integer.MIN_VALUE;
double highbound = Integer.MAX_VALUE;
double pivot = (lowbound + highbound)/2;
double tmp;
double tmp4swap;
if (funcnum == 1) {
lowbound = 0;
pivot = (lowbound+highbound)/2;
}
while (true) {
callcounter++;
if (FuncOfx(highbound, funcnum) < FuncOfx(lowbound, funcnum)) {
tmp4swap = highbound;
highbound = lowbound;
lowbound = tmp4swap;
}
if (FuncOfx(pivot,funcnum) > target) {
System.out.println(String.format("%2d", callcounter) + ": "
+ String.format("%.6f", pivot) + " f(" + String.format("%.6f", pivot) +") is "
+ String.format("%.6f",FuncOfx(pivot,funcnum)) + ", so too high :(");
tmp = (lowbound + pivot)/2;
if ( Math.abs(tmp-pivot) < 0.00005 ) {
System.out.println("Found!" +String.format("%.3f", tmp)+" is the answer.");
return;
}
highbound = pivot;
pivot = tmp;
}else if(FuncOfx(pivot,funcnum) < target){
System.out.println(String.format("%2d", callcounter) + ": "
+ String.format("%.6f", pivot) + " f(" + String.format("%.6f", pivot) +") is "
+ String.format("%.6f",FuncOfx(pivot,funcnum)) + ", so too high :(");
tmp = (highbound + pivot)/2;
if ( Math.abs(tmp-pivot) < 0.00005 ) {
System.out.println("Found!" +String.format("%.3f", tmp)+" is the answer.");
return;
}
lowbound = pivot;
pivot = tmp;
}
}
}
/*
Numeric Analysis End
*/
private static long[][] CombinationLong_nCk(long n, long k) {
n++; k++;
long[][] ans = new long[(int)n][(int)k];
for (int i = 0; i < n; i++) {
ans[i][0] = 1;
}
for (int i = 0; i < n-1; i++) {
for (int j = 0; j < k-1; j++) {
if (i < j) {
ans[i][j] = 0;
}else{
ans[i+1][j+1] = ans[i][j] + ans[i][j+1];
}
}
}
return ans;
}
public static int gcd_int(int a, int b) {
if (a < b) {
int tmpp = a;
a = b;
b = tmpp;
}
if (b == 0) {
return a;
}else{
return gcd_int(b, a%b);
}
}
public static long gcd_long(long a, long b) {
if (a < b) {
long tmpp = a;
a = b;
b = tmpp;
}
if (b == 0) {
return a;
}else{
return gcd_long(b, a%b);
}
}
public static int lcm_int(int a, int b) {
int gcd = gcd_int(a,b);
return a/gcd*b;
}
public static long lcm_long(long a, long b) {
long gcd = gcd_long(a,b);
return a/gcd*b;
}
public static void dfs(int placenow) {
// if went all -> success!
// if not went all -> fail...
/*
dfs
Go All Place that there is way to and not having been yet.
if island 1 is start point, dfs(1);
if there is way to island 2 and island 3,
- island 2 changes non-visited -> visited, and dfs(2).
- island 3 changes non-visited -> visited, and dfs(3).
*/
isvisited[placenow] = true;
boolean success = true;
for (int i = 0; i < n; i++) {
if (isvisited[i] == false) { // not go all place
success = false;
break;
}
}
if (success) {
ansi++;
isvisited[placenow] = false;
return;
}
for (int i = 0; i < n; i++) {
if (w[i] == placenow && isvisited[ww[i]] == false ) {
dfs(ww[i]);
}else if(ww[i] == placenow && isvisited[w[i]] == false){
dfs(w[i]);
}else{
continue;
}
}
isvisited[placenow] = false;
return;
}
}
| main.c:6:1: error: unknown type name 'import'
6 | import java.util.*;
| ^~~~~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
6 | import java.util.*;
| ^
main.c:7:1: error: unknown type name 'import'
7 | import java.lang.*;
| ^~~~~~
main.c:7:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
7 | import java.lang.*;
| ^
main.c:8:1: error: unknown type name 'import'
8 | import java.math.*;
| ^~~~~~
main.c:8:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
8 | import java.math.*;
| ^
main.c:10:1: error: unknown type name 'public'
10 | public class Main{
| ^~~~~~
main.c:10:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
10 | public class Main{
| ^~~~
|
s914745227 | p03701 | C | #include<stdio.h>
int main(){
int N,i,j,a=0,b=0;
scanf("%d",&N);
int s[100];
for(i=0;i<N;i++){
scanf("%d",&s[i]);
a+=s[i];
}
for(i=0;i<N;i++){
for(j=i+1;j<N;j++){
if(s[i]>s[j]){
b=s[i];
s[i]=s[j];
s[j]=b;
}
}
}
if(a%10!=0){
break;
}else{
for(i=0;i<N;i++){
if((a-s[i])%10 !=0){
a-=s[i];
break;
}
}
a=0;
}
printf("%d",a);
return 0;
} | main.c: In function 'main':
main.c:20:17: error: break statement not within loop or switch
20 | break;
| ^~~~~
|
s218528315 | p03701 | Java | import java.util.*;
public class Main {
public static void main(String[] args)
Scanner scanner = new Scanner(System.in);
int count = scanner.nextInt();
int[] scores = new int[count];
int sum = 0;
for (int ix = 0; ix < scores.length; ix++) {
scores[ix] = scanner.nextInt();
sum += scores[ix];
}
Arrays.sort(scores);
for (int ix = 0; ix < scores.length; ix++) {
if (sum % 10 == 0) {
System.out.println(sum);
break;
} else {
sum -= scores[ix];
}
}
}
} | Main.java:4: error: ';' expected
public static void main(String[] args)
^
Main.java:10: error: illegal start of type
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:10: error: > or ',' expected
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:10: error: <identifier> expected
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:15: error: <identifier> expected
Arrays.sort(scores);
^
Main.java:15: error: <identifier> expected
Arrays.sort(scores);
^
Main.java:16: error: illegal start of type
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:16: error: > or ',' expected
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:16: error: <identifier> expected
for (int ix = 0; ix < scores.length; ix++) {
^
Main.java:25: error: class, interface, enum, or record expected
}
^
10 errors
|
s395445750 | p03701 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
int compar(const int *val1, const int *val2) {
if (*val1 < *val2) return -1;
else if(*val1 == * val2) return 0;
else return 1;
}
void showScoreList(int s[],int n){
printf("s = [ ");
for (int i = 0; i < n; ++i) printf("%d ", s[i]);
printf("]\n");
}
int main(int argc, char const *argv[])
{
int N,s[100];
int max = 0,min = 0x7F,pat,sum = 0;
scanf("%d",&N);
// Input
for (int i = 0; i < N; ++i){
scanf(" %d",&s[i]);
sum += s[i];
}
// Output
if(sum % 10 != 0){
printf("%d\n",sum);
return 0;
}
else{
showScoreList(s,N);
qsort(s,N, sizeof(int), (int (*)(const void *, const void *))compar);
showScoreList(s,N);
for (int i = 0; i < N; ++i)
{
if(sum % 10 != 0){
sum -= s[i];
break;
}
sum = (sum % 10 == 0) ? 0 : sum;
printf("%d\n", sum);
}
} | main.c: In function 'main':
main.c:49:1: error: expected declaration or statement at end of input
49 | }
| ^
|
s676138132 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int N,sum = 0;
cin >> N;
std::vector<int> s(N);
for (int i = 0; i < N; ++i){
cin >> s.at(i);
sum += s.at(i);
}
if(sum % 10 != 0){
cout << sum << endl;
return 0;
}
else{
sort(s.begin(), s.end());
for (int i = 0; i < N ; ++i)
{
if(s.at(i) % 10 != 0){
sum -= s.at(i);
break;
}
cout << sum << endl;
}
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:28:2: error: expected '}' at end of input
28 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s424887766 | p03701 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >>N;
int sum=0;
vector<int> s(N);
for(int i=0;i<N;i++){
cin >>s.at(i);
}
sort(s.begin(),s.end());
int x=10;
int flag=0;
for(int i=0;i<N;i++){
s += s.at(i);
if(s.at(i)%10 != 0 && flag != 1){
x=s.at(i);
flag = 1;
}
}
if(x%10 == 0) cout << 0 << endl;
else if(s%10 == 0) cout << s-x << endl;
else cout << s<< endl;
} | a.cc: In function 'int main()':
a.cc:16:7: error: no match for 'operator+=' (operand types are 'std::vector<int>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
16 | s += s.at(i);
| ~~^~~~~~~~~~
a.cc:23:12: error: no match for 'operator%' (operand types are 'std::vector<int>' and 'int')
23 | else if(s%10 == 0) cout << s-x << endl;
| ~^~~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed:
a.cc:23:13: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const valarray<_Tp>&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:23:13: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:23:13: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
/usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1200 | _DEFINE_BINARY_OPERATOR(%, __modulus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed:
a.cc:23:13: note: mismatched types 'const std::valarray<_Tp>' and 'int'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^~
a.cc:23:31: error: no match for 'operator-' (operand types are 'std::vector<int>' and 'int')
23 | else if(s%10 == 0) cout << s-x << endl;
| ~^~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:23:32: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:23:32: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)'
370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed:
a.cc:23:32: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^
/usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)'
379 | operator-(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed:
a.cc:23:32: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
a.cc:23:32: note: mismatched types 'const std::complex<_Tp>' and 'int'
23 | else if(s%10 == 0) cout << s-x << endl;
| ^
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ |
s294632420 | p03701 | C++ | #include <cstdio>
#define min(a, b) (a < b ? a : b)
int main()
{
int no_of_elements;
scanf("%d", &no_of_elements);
const int oo = 1e9 + 9;
int sum = 0, min_non_multiple_10 = oo;
while(no_of_elements--)
{
int element;
scanf("%d", &element);
sum += element;
if(element%10 != 0)
min_non_multiple_10 = min(min_non_multiple_10, element);
}
if(sum%10 == 0)
printf("%d\n", max_non_multiple_10 == oo ? 0 : sum - min_non_multiple_10);
else
printf("%d\n", sum);
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:24: error: 'max_non_multiple_10' was not declared in this scope; did you mean 'min_non_multiple_10'?
25 | printf("%d\n", max_non_multiple_10 == oo ? 0 : sum - min_non_multiple_10);
| ^~~~~~~~~~~~~~~~~~~
| min_non_multiple_10
|
s943554560 | p03701 | C++ | #include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define UP(i,a,b) for(int i=(a); i<=(b); ++i)
#define DOWN(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) UP(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //NOTE: <a> must be sorted in advance
lng power(lng b, int n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n
const int MOD = 1000000007; //10^9+7
const double PI = 3.1415926535897932384626;
/*********** variables ************/
int N;
int s[101];
int dp[10010];
/**********************************/
void dpSol() {
DOWN(i, 100, 1) {
s[i] = s[i-1];
}
dp[0][0] = 0;
UP(i, 1, 100) {
DOWN(j, 10000, 0) {
if(dp[j]) {
dp[j+s[i]] = true;
}
}
}
int ans = 0;
UP(i, 10000) {
if(dp[i]&&i%10!=0) {
ans = max(ans, i);
}
}
cout << ans << endl;
}
void mySol() {
int mini = 1<<30;
int sum = 0;
REP(i, N) {
sum += s[i];
if(s[i]%10!=0&&s[i]<mini) {
mini = s[i];
}
}
if(sum%10!=0) {
cout << sum << endl;
}
else if(mini!= 1<<30) {
cout << sum - mini << endl;
}
else {
cout << 0 << endl;
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin>>N;
REP(i, N) cin >> s[i];
//mySol();
dpSol();
}
| a.cc:38:16: error: macro "UP" requires 3 arguments, but only 2 given
38 | UP(i, 10000) {
| ^
a.cc:8:9: note: macro "UP" defined here
8 | #define UP(i,a,b) for(int i=(a); i<=(b); ++i)
| ^~
a.cc: In function 'void dpSol()':
a.cc:29:10: error: invalid types 'int[int]' for array subscript
29 | dp[0][0] = 0;
| ^
a.cc:38:5: error: 'UP' was not declared in this scope
38 | UP(i, 10000) {
| ^~
|
s624718178 | p03701 | C++ | #include<algorithm>
#include<iostream>
using namespace std;
int main()
{
int n;
int a[n];
cin>>n>>a[n];
sort(a[1],a[1]+n);
int cnt;
for(int i=1;i<=n;i++)
{
cnt=cnt+a[i];
}
if(cnt%10==0)
{
for(int j=1;j<=n;j++)
{
cnt=cnt-a[j];
if(cnt%10!=0)
{
cout<<cnt;
return 0;
}
else
{
continue;
}
}
}
else
{
cout<<cnt;
return 0;
}
cout<<0;
return 0;
} | In file included from /usr/include/c++/14/algorithm:61,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:5: required from here
9 | sort(a[1],a[1]+n);
| ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int')
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int')
1782 | *__first = _GLIBCXX_MOVE(__val);
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:5: required from here
9 | sort(a[1],a[1]+n);
| ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:5: required from here
9 | sort(a[1],a[1]+n);
| ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
344 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
346 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1596 | std::__pop_heap(__first, __middle, __i, __comp);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:5: required from here
9 | sort(a[1],a[1]+n);
| ~~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
258 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
260 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:262:28: error: invalid type argument of unary '*' (have 'int')
262 | _ValueType __value = _GLIBCXX_MOVE(*__result);
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:263:7: error: invalid type argument of unary '*' (have 'int')
263 | *__result = _GLIBCXX_MOVE(*__first);
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:263:19: error: invalid type argument of unary '*' (have 'int')
263 | *__result = _GLIBCXX_MOVE(*__first);
| |
s697436614 | p03701 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
int n,ans;
bool dp[10105];
int main(void){
scanf("%d",&n);
dp[0]=true;
while(n--){
int s;
scanf("%d",&s);
for(int i=10000;i>=0;i--)if(dp[i])dp[i+s]=true;
}
for(int i=10000;i>=0;i--){
if(i%10&&dp[i])[
ans=i;
break;
}
}
printf("%d\n",ans);
} | a.cc: In function 'int main()':
a.cc:18:18: error: expected ',' before ';' token
18 | ans=i;
| ^
| ,
a.cc:18:18: error: expected identifier before ';' token
a.cc:18:18: error: expected ']' before ';' token
18 | ans=i;
| ^
| ]
a.cc: In lambda function:
a.cc:18:18: error: expected '{' before ';' token
a.cc: At global scope:
a.cc:22:11: error: expected constructor, destructor, or type conversion before '(' token
22 | printf("%d\n",ans);
| ^
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s616685963 | p03701 | C++ |
int main(){
int n;
cin >> n;
int s[n+1];
for(int i = 0;i < n; i++){
cin >> s[i];
}
bool dp[110][110 * 100];
memset( dp, 0 ,sizeof(dp));
dp[0][0] = true;
for(int i = 0;i < n; i++){
for(int j=0; j <= 100 * n;j++){
if(j<s[i]) dp[i+1][j] = dp[i][j];
else dp[i+1][j] = dp[i][j]|| dp[i][j-s[i]];
}
}
int j;
for(j=10004;j>=1;j--){
if(dp[n][j]==true&&j%10!=0)break;
}
cout<<j<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
5 | cin >> n;
| ^~~
a.cc:13:5: error: 'memset' was not declared in this scope
13 | memset( dp, 0 ,sizeof(dp));
| ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 |
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<j<<endl;
| ^~~~
a.cc:27:14: error: 'endl' was not declared in this scope
27 | cout<<j<<endl;
| ^~~~
|
s747765875 | p03701 | C++ |
int main(){
int n;
cin >> n;
int s[n+1];
for(int i = 0;i < n; i++){
cin >> s[i];
}
bool dp[110][110 * 100];
memset( dp, 0 ,sizeof(dp));
dp[0][0] = true;
for(int i = 0;i < n; i++){
for(int j=0; j <= 100 * n;j++){
if(j<s[i]) dp[i+1][j] = dp[i][j];
else dp[i+1][j] = dp[i][j]|| dp[i][j-s[i]];
}
}
int j;
for(j = 10004;j>=1;j--){
if(dp[n][j]==true&&j%10!=0)break;
}
cout<<j<<endl;
//cout<< maxi <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
5 | cin >> n;
| ^~~
a.cc:13:5: error: 'memset' was not declared in this scope
13 | memset( dp, 0 ,sizeof(dp));
| ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 |
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<j<<endl;
| ^~~~
a.cc:27:14: error: 'endl' was not declared in this scope
27 | cout<<j<<endl;
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.