submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s119463214 | p00528 | C++ | #include<bits/stdc++.h>
using namespace std;
#define MAX 200005
typedef long long ll;
typedef pair<ll,ll> P;
struct edge{
ll to,cost;
edge(ll t,ll c){
to=t,cost=c;
}
};
struct state{
ll pos,flg,cost;
state(ll p,ll f,ll c){
pos=p,flg=f,cost=c;
}
bool operator < (const state &p)const{
return cost > p.cost;
}
};
vector<P> t[MAX][2];
ll W,H,K,X[MAX],Y[MAX];
ll d[MAX][2];
vector<edge> G[MAX][2];
ll solve(){
if(t[1][0].empty())return -1;
for(int i=0;i<MAX;i++)d[i][0]=d[i][1]=10000000000000000LL;
priority_queue< state > Q;
P p=t[1][0][0];
Q.push( state( p.second, 0, p.first-1 ) );
d[p.second][0]=p.first-1;
while(!Q.empty()){
state s=Q.top();Q.pop();
if(s.cost>d[s.pos][s.flg])continue;
for(int f=0;f<2;f++){
int nf=(s.flg+f)%2;
for(int i=0;i<(int)G[s.pos][nf].size();i++){
edge e=G[s.pos][nf][i];
ll ncost=s.cost+e.cost+f;
if(e.cost==0)ncost=s.cost;
if(ncost<d[e.to][nf]){
d[e.to][nf]=ncost;
Q.push( state(e.to,nf,ncost) );
}
}
}
}
ll res=min(d[K][0],d[K][1]);
if(res==10000000000000000LL;)return -1;
else return res;
}
int main(){
scanf("%lld %lld %lld",&W,&H,&K);
for(int i=0;i<K;i++){
scanf("%lld %lld",&X[i],&Y[i]);
t[X[i]][0].push_back(P(Y[i],i));
t[Y[i]][1].push_back(P(X[i],i));
}
t[W][0].push_back(P(H,K));
t[H][1].push_back(P(W,K));
X[K]=W;
Y[K]=H;
for(int i=1;i<=100000;i++){
for(int f=0;f<2;f++){
vector<P> &vec=t[i][f];
sort(vec.begin(),vec.end());
int size=vec.size();
for(int j=0;j<size;j++){
P p=vec[j],q;
if(0<j){
q=vec[j-1];
G[p.second][f].push_back( edge(q.second,p.first-q.first) );
}
if(j+1<size){
q=vec[j+1];
G[p.second][f].push_back( edge(q.second,q.first-p.first) );
}
}
}
}
cout<<solve()<<endl;
return 0;
} | a.cc: In function 'll solve()':
a.cc:52:31: error: expected primary-expression before ')' token
52 | if(res==10000000000000000LL;)return -1;
| ^
a.cc:54:1: warning: control reaches end of non-void function [-Wreturn-type]
54 | }
| ^
|
s456486726 | p00528 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
using namespace std;
??
struct room{
????int roomnum;
????bool visited;
??????
????bool operator>(const room compared) const
????{
????????return roomnum > compared.roomnum;
????}
????bool operator<(const room compared) const
????{
????????return roomnum < compared.roomnum;
????}
};
??
struct compar{
????long long int cost,
int loc_x, loc_y;
????bool is_ns;
??????
????bool operator>(const compar compared) const
????{
????????return cost > compared.cost;
????}
????bool operator<(const compar compared) const
????{
????????return cost < compared.cost;
????}
};
??
int m, n, k;
vector<room> ns[100001], ew[100001];
priority_queue<compar, vector<compar>, greater<compar> > sr;
??
long long int dijk()
{
????if(!ns[1].size())
????????return -1;
??????
????compar start = {(ns[1].begin())->roomnum - 1, 1, (ns[1].begin())->roomnum, true};
????sr.push(start);
??????
????while(!sr.empty()){
????????compar now = sr.top();
????????sr.pop();
??????????
????????if(now.loc_x == m && now.loc_y == n)
????????????return now.cost;
??????????
????????vector<room>::iterator p;
????????if(now.is_ns){
????????????room pp = {now.loc_y, false};
????????????p = lower_bound(ns[now.loc_x].begin(), ns[now.loc_x].end(), pp);
??????????????
????????????if(!p->visited){
????????p->visited = true;
????????if(p != ns[now.loc_x].begin()){
????????????compar next = {now.cost + now.loc_y - (p - 1)->roomnum, now.loc_x, (p - 1)->roomnum, true};
????????????sr.push(next);
????????}
????????if(p != ns[now.loc_x].end() - 1){
????????????compar next = {now.cost + (p + 1)->roomnum - now.loc_y, now.loc_x, (p + 1)->roomnum, true};
????????????sr.push(next);
????????}
????????compar next = {now.cost + 1, now.loc_x, now.loc_y, false};
????????sr.push(next);
????????????}
????????}
????????else{
????????????room pp = {now.loc_x, false};
????????????p = lower_bound(ew[now.loc_y].begin(), ew[now.loc_y].end(), pp);
??
????????????if(!p->visited){
????????p->visited = true;
????????if(p != ew[now.loc_y].begin()){
????????????compar next = {now.cost + now.loc_x - (p - 1)->roomnum, (p - 1)->roomnum, now.loc_y, false};
????????????sr.push(next);
????????}
????????if(p != ew[now.loc_y].end() - 1){
????????????compar next = {now.cost + (p + 1)->roomnum - now.loc_x, (p + 1)->roomnum, now.loc_y, false};
????????????sr.push(next);
????????}
????????compar next = {now.cost + 1, now.loc_x, now.loc_y, true};
????????sr.push(next);
????????????}
????????}
????}
??
????return -1;
}
??
int main()
{
????scanf("%d%d%d", &m, &n, &k);
????for(int i = 0; i < k; i++){
????????int x, y;
????????scanf("%d%d", &x, &y);
????????room x_in = {y, false};
????????ns[x].push_back(x_in);
????????room y_in = {x, false};
????????ew[y].push_back(y_in);
????}
????if(!ns[m].size() || (ns[m].end() - 1)->roomnum != n){
????????room x_in = {n, false};
????????ns[m].push_back(x_in);
????}
????if(!ew[n].size() || (ew[n].end() - 1)->roomnum != m){
????????room y_in = {m, false};
????????ew[n].push_back(y_in);
????}
??????
????for(int i = 1; i <= m; i++)
????????sort(ns[i].begin(), ns[i].end());
????for(int i = 1; i <= n; i++)
????????sort(ew[i].begin(), ew[i].end());
??????
????printf("%lld\n", dijk());
????return 0;
} | a.cc:8:1: error: expected unqualified-id before '?' token
8 | ??
| ^
a.cc:22:1: error: expected unqualified-id before '?' token
22 | ??
| ^
a.cc:37:1: error: expected unqualified-id before '?' token
37 | ??
| ^
a.cc:39:8: error: 'room' was not declared in this scope
39 | vector<room> ns[100001], ew[100001];
| ^~~~
a.cc:39:12: error: template argument 1 is invalid
39 | vector<room> ns[100001], ew[100001];
| ^
a.cc:39:12: error: template argument 2 is invalid
a.cc:40:16: error: 'compar' was not declared in this scope
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^~~~~~
a.cc:40:31: error: 'compar' was not declared in this scope
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^~~~~~
a.cc:40:37: error: template argument 1 is invalid
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^
a.cc:40:37: error: template argument 2 is invalid
a.cc:40:48: error: 'compar' was not declared in this scope
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^~~~~~
a.cc:40:54: error: template argument 1 is invalid
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^
a.cc:40:56: error: template argument 1 is invalid
40 | priority_queue<compar, vector<compar>, greater<compar> > sr;
| ^
a.cc:40:56: error: template argument 2 is invalid
a.cc:40:56: error: template argument 3 is invalid
a.cc:41:1: error: expected unqualified-id before '?' token
41 | ??
| ^
a.cc:98:1: error: expected unqualified-id before '?' token
98 | ??
| ^
|
s797226067 | p00528 | C++ | #include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long int LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
struct room
{
int num;
bool visited[2];
bool operator<(const room r) const
{
return num < r.num;
}
bool operator>(const room r) const
{
return num > r.num;
}
};
struct r_compare
{
LL cost;
int loc_x, loc_y;
bool sw;
bool operator<(const r_compare r) const
{
return cost < r.cost;
}
bool operator>(const r_compare r) const
{
return cost > r.cost;
}
};
int m, n, k;
vector<room> ns[100010], ew[100010];
priority_queue<r_compare, vector<r_compare>, greater<r_compare> > Q;
LL dijk()
{
if(ns[1].size() == 0)
return -1;
r_compare qin = {(ns[1].begin())->num - 1, 1, (ns[1].begin())->num, false};
Q.push(qin);
while(!Q.empty()){
r_compare c_now = Q.top();
Q.pop();
if(c_now.loc_x == m && c_now.loc_y == n)
return c_now.cost;
room sr = {(!c_now.sw ? c_now.loc_y : c_now.loc_x), {false, false}};
vector<room>::iterator r_now = !c_now.sw ? lower_bound(ns[c_now.loc_x].begin(), ns[c_now.loc_x].end(), sr) : lower_bound(ew[c_now.loc_y].begin(), ew[c_now.loc_y].end(), sr);
if(!r_now->visited[c_now.sw]){
r_now->visited[c_now.sw] = true;
if(!c_now.sw){
if(r_now != ns[c_now.loc_x].begin()){
r_compare qin = {c_now.cost + r_now->num - (r_now - 1)->num, c_now.loc_x, (r_now - 1)->num, false};
Q.push(qin);
}
if(r_now != ns[c_now.loc_x].end() - 1){
r_compare qin = {c_now.cost + (r_now + 1)->num - r_now->num, c_now.loc_x, (r_now + 1)->num, false};
Q.push(qin);
}
}
else{
if(r_now != ew[c_now.loc_y].begin()){
r_compare qin = {c_now.cost + r_now->num - (r_now - 1)->num, (r_now - 1)->num, c_now.loc_y, true};
Q.push(qin);
}/*
if(r_now != ew[c_now.loc_y].end() - 1){
r_compare qin = {c_now.cost + (r_now + 1)->num - r_now->num, (r_now + 1)->num, c_now.loc_y, true};
Q.push(qin);*/
}
}
r_compare qin = {c_now.cost + 1, c_now.loc_x, c_now.loc_y, !c_now.sw};
Q.push(qin);
}
}
return -1;
}
int main()
{
scanf("%d%d%d", &m, &n, &k);
bool last = false;
for(int i = 0; i < k; i++){
int x, y;
if(x == m && y == n)
last = true;
scanf("%d%d", &x, &y);
room xin = {y, {false, false}}, yin = {x, {false, false}};
ns[x].PB(xin);
ew[y].PB(yin);
}
if(!last){
room xin = {n, {false, false}}, yin = {m, {false, false}};
ns[m].PB(xin);
ew[n].PB(yin);
}
for(int i = 1; i <= m; i++)
sort(ns[i].begin(), ns[i].end());
for(int i = 1; i <= m; i++)
sort(ew[i].begin(), ew[i].end());
printf("%lld\n", dijk());
return 0;
} | a.cc:90:3: error: expected unqualified-id before 'return'
90 | return -1;
| ^~~~~~
a.cc:91:1: error: expected declaration before '}' token
91 | }
| ^
a.cc: In function 'LL dijk()':
a.cc:89:3: warning: control reaches end of non-void function [-Wreturn-type]
89 | }
| ^
|
s912750596 | p00528 | C++ | #include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int H, W, K, X, Y;
vector<pair<int, int> > xc[100000]; int xs[100000];
vector<pair<int, int> > yc[100000]; int ys[100000];
vector<pair<int, int> > G[200002]; long long D[200002];
int main()
{
scanf("%d", &W);
scanf("%d", &H);
scanf("%d", &K);
xc[0].push_back(make_pair(0, 0));
yc[0].push_back(make_pair(0, 0));
xc[W - 1].push_back(make_pair(H - 1, 1));
yc[H - 1].push_back(make_pair(W - 1, 1));
for (int i = 0; i < K; i++)
{
scanf("%d", &X);
scanf("%d", &Y);
xc[X - 1].push_back(make_pair(Y - 1, i + 2));
yc[Y - 1].push_back(make_pair(X - 1, i + 2));
}
for (int i = 0; i < H; i++) sort(yc[i].begin(), yc[i].end());
for (int i = 0; i < W; i++) sort(xc[i].begin(), xc[i].end());
for (int i = 0; i < H; i++) ys[i] = yc[i].size();
for (int i = 0; i < W; i++) xs[i] = xc[i].size();
for (int i = 0; i < W; i++)
{
for (int j = 0; j < xs[i] - 1; j++)
{
int node1 = xc[i][j].second;
int node2 = xc[i][j + 1].second;
int dist = xc[i][j + 1].first - xc[i][j].first + 1;
G[node1].push_back(make_pair(node2, dist));
}
for (int j = 1; j < xs[i]; j++)
{
int node1 = xc[i][j].second;
int node2 = xc[i][j - 1].second;
int dist = xc[i][j].first - xc[i][j - 1].first + 1;
G[node1].push_back(make_pair(node2, dist));
}
}
for (int i = 0; i < H; i++)
{
for (int j = 0; j < ys[i] - 1; j++)
{
int node1 = yc[i][j].second;
int node2 = yc[i][j + 1].second;
int dist = yc[i][j + 1].first - yc[i][j].first + 1;
G[node1].push_back(make_pair(node2, dist));
}
for (int j = 1; j < ys[i]; j++)
{
int node1 = yc[i][j].second;
int node2 = yc[i][j - 1].second;
int dist = yc[i][j].first - yc[i][j - 1].first + 1;
G[node1].push_back(make_pair(node2, dist));
}
}
priority_queue<pair<long long, int>, vector<pair<long long, int> >, greater<pair<long long, int> > > que;
memset(D, -1, sizeof(D)); D[0] = 0;
que.push(make_pair(0LL, 0));
while (!que.empty())
{
pair<long long, int> state = que.top(); que.pop();
int node = state.first;
long long dist = state.second;
for (int i = 0; i < G[node].size(); i++)
{
int node2 = G[node][i].first;
if (D[node2] == -1)
{
D[node2] = D[node] + G[node][i].second;
que.push(make_pair(D[node2], node2));
}
}
}
printf("%lld\n", D[1]);
return 0;
} | a.cc: In function 'int main()':
a.cc:91:9: error: 'memset' was not declared in this scope
91 | memset(D, -1, sizeof(D)); D[0] = 0;
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <functional>
+++ |+#include <cstring>
6 |
|
s786135845 | p00528 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
using namespace std;
const int MAX_M=100000,MAX_N=100000,MAX_K=200000;
struct P{
int x,y;
int index;
};
bool comp(const P &a,const P &b){
if (a.y!=b.y){
return a.y<b.y;
}
return a.x<b.x;
}
bool comp2(const P &a,const P &b){
if (a.x!=b.x){
return a.x<b.x;
}
return a.y<b.y;
}
int M,N,K;
P p[MAX_K+2];
struct edge{
int to,cost;
};
typedef pair<long long,int> PA;
const long long INF=1000000000000000;
int V;
vector<edge> G[MAX_K*2+4];
long long d[MAX_K*2+4];
long long dijkstra(){
priority_queue<PA,vector<PA>,greater<PA> > que;
fill(d,d+V,INF);
d[K+2]=0;
que.push(PA(0,K+2));
while(!que.empty()){
PA pa=que.top();
que.pop();
int v=pa.second,dis=pa.first;
if (dis>d[v]) continue;
for (int i=0;i<G[v].size();i++){
edge e=G[v][i];
if (d[v]+e.cost<d[e.to]){
d[e.to]=d[v]+e.cost;
que.push(PA(d[e.to],e.to));
}
}
}
return min(d[K+1],d[2*K+3]);
}
int main(){
scanf("%d %d %d",&M,&N,&K);
for (int i=0;i<K;i++){
int x,y;
scanf("%d %d",&x,&y);
p[i+1].x=x;
p[i+1].y=y;
p[i+1].index=i+1;
}
p[0].x=1; //スタート
p[0].y=1;
p[0].index=0;
p[K+1].x=M; //ゴール
p[K+1].y=N;
p[K+1].index=K+1;
V=K*2+4; //頂点の個数
//辺を張る
sort(p,p+K+2,comp); //横の辺を張る
for (int i=0;i<K+1;i++){
if (p[i].y==p[i+1].y){
int cost=p[i+1].x-p[i].x;
edge e{p[i+1].index,cost};
G[p[i].index].push_back(e);
e.to=p[i].index;
G[p[i+1].index].push_back(e)
}
}
sort(p,p+K+2,comp2); //縦の辺を張る
for (int i=0;i<K+1;i++){
if (p[i].x==p[i+1].x){
int cost=p[i+1].y-p[i].y;
edge e{p[i+1].index+K+2,cost};
G[p[i].index+K+2].push_back(e);
e.to=p[i].index+K+2;
G[p[i+1].index+K+2].push_back(e);
}
}
for (int i=1;i<=K;i++){
edge e{i+K+2,1};
G[i].push_back(e);
e.to=i;
G[i+K+2].push_back(e);
}
long long res=dijkstra();
if (res==INF){
res=-1;
}
printf("%lld\n",res);
return 0;
} | a.cc: In function 'int main()':
a.cc:91:53: error: expected ';' before '}' token
91 | G[p[i+1].index].push_back(e)
| ^
| ;
92 | }
| ~
|
s915314955 | p00528 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}
struct data{
int v,c,d;
data(int v,int c,int d):v(v),c(c),d(d){}
bool operator<(const data &d)const{
return c>d.c;
}
};
const int SIZE=200000;
const int INF=1001001001001001001LL;
int W,H,K;
int X[SIZE],Y[SIZE];
vpint row[SIZE],col[SIZE];
int to[SIZE][4];
int cost[SIZE][4];
int dist[SIZE][2];
signed main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>W>>H>>K;
rep(i,K){
cin>>X[i]>>Y[i];
X[i]--;Y[i]--;
row[Y[i]].pb(pint(X[i],i));
col[X[i]].pb(pint(Y[i],i));
}
rep(i,H)sort(all(row[i]));
rep(i,W)sort(all(col[i]));
memset(to,-1,sizeof(to));
rep(i,H){
rep(j,(int)row[i].size()-1){
pint &v=row[i][j],&u=row[i][j+1];
to[v.se][1]=u.se;cost[v.se][1]=u.fi-v.fi;
to[u.se][3]=v.se;cost[u.se][3]=u.fi-v.fi;
}
}
rep(i,W){
rep(j,(int)col[i].size()-1){
pint &v=col[i][j],&u=col[i][j+1];
to[v.se][2]=u.se;cost[v.se][2]=u.fi-v.fi;
to[u.se][0]=v.se;cost[u.se][0]=u.fi-v.fi;
}
}
if(col[0].size()==0){
cout<<-1<<endl;
return 0;
}
pint start=col[0][0];
fill_n(*dist,SIZE*2,INF);
dist[start.se][0]=start.fi;
priority_queue<data>que;
que.push(data(start.se,start.fi,0));
while(que.size()){
data d=que.top();que.pop();
if(dist[d.v][d.d]<d.c)continue;
if(dist[d.v][1-d.d]>d.c+1){
dist[d.v][1-d.d]=d.c+1;
que.push(data(d.v,d.c+1,1-d.d));
}
rep(i,4){
if(i%2!=d.d)continue;
int t=to[d.v][i],c=cost[d.v][i];
if(t==-1)continue;
if(dist[t][d.d]<=d.c+c)continue;
dist[t][d.d]=d.c+c;
que.push(data(t,d.c+c,d.d));
}
}
8 9 15
3 1
3 2
3 7
3 8
1 1
4 5
4 3
5 6
5 8
6 3
6 2
7 5
8 9
8 6
8 5
int mi=INF;
rep(i,K){
if(X[i]==W-1){
chmin(mi,dist[i][0]+H-1-Y[i]);
}
if(Y[i]==H-1){
chmin(mi,dist[i][1]+W-1-X[i]);
}
}
cout<<mi<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:81:24: error: template argument 1 is invalid
81 | priority_queue<data>que;
| ^
a.cc:81:24: error: template argument 2 is invalid
a.cc:81:24: error: template argument 3 is invalid
a.cc:82:9: error: request for member 'push' in 'que', which is of non-class type 'int'
82 | que.push(data(start.se,start.fi,0));
| ^~~~
a.cc:82:14: error: reference to 'data' is ambiguous
82 | que.push(data(start.se,start.fi,0));
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:20:8: note: 'struct data'
20 | struct data{
| ^~~~
a.cc:84:15: error: request for member 'size' in 'que', which is of non-class type 'int'
84 | while(que.size()){
| ^~~~
a.cc:85:9: error: reference to 'data' is ambiguous
85 | data d=que.top();que.pop();
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:20:8: note: 'struct data'
20 | struct data{
| ^~~~
a.cc:85:30: error: request for member 'pop' in 'que', which is of non-class type 'int'
85 | data d=que.top();que.pop();
| ^~~
a.cc:86:17: error: 'd' was not declared in this scope
86 | if(dist[d.v][d.d]<d.c)continue;
| ^
a.cc:87:17: error: 'd' was not declared in this scope
87 | if(dist[d.v][1-d.d]>d.c+1){
| ^
a.cc:89:17: error: request for member 'push' in 'que', which is of non-class type 'int'
89 | que.push(data(d.v,d.c+1,1-d.d));
| ^~~~
a.cc:89:22: error: reference to 'data' is ambiguous
89 | que.push(data(d.v,d.c+1,1-d.d));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:20:8: note: 'struct data'
20 | struct data{
| ^~~~
a.cc:93:21: error: 'd' was not declared in this scope
93 | if(i%2!=d.d)continue;
| ^
a.cc:94:22: error: 'd' was not declared in this scope
94 | int t=to[d.v][i],c=cost[d.v][i];
| ^
a.cc:96:34: error: 'c' was not declared in this scope
96 | if(dist[t][d.d]<=d.c+c)continue;
| ^
a.cc:97:30: error: 'c' was not declared in this scope
97 | dist[t][d.d]=d.c+c;
| ^
a.cc:98:17: error: request for member 'push' in 'que', which is of non-class type 'int'
98 | que.push(data(t,d.c+c,d.d));
| ^~~~
a.cc:98:22: error: reference to 'data' is ambiguous
98 | que.push(data(t,d.c+c,d.d));
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:20:8: note: 'struct data'
20 | struct data{
| ^~~~
a.cc:101:2: error: expected ';' before numeric constant
101 | 8 9 15
| ^~
| ;
a.cc:121:19: error: 'mi' was not declared in this scope; did you mean 'i'?
121 | chmin(mi,dist[i][0]+H-1-Y[i]);
| ^~
| i
a.cc:124:19: error: 'mi' was not declared in this scope; did you mean 'i'?
124 | chmin(mi,dist[i][1]+W-1-X[i]);
| ^~
| i
a.cc:128:11: error: 'mi' was not declared in this scope; did you mean 'mp'?
128 | cout<<mi<<endl;
| ^~
| mp
|
s058538053 | p00528 | C++ | #include<iostream>
#include<queue>
#include<stdio.h>
#include<utility>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
#define INF 1000000
typedef pair<int, int> P; //?????????????????????
bool s[MAX_N * MAX_M]; //?????????????????????????????????
int M, N, K;
int d[MAX_N * MAX_M][2]; // ???????????¢, ????????????, ????????±?\?
int main()
{
scanf("%d %d %d", &M, &N, &K);
//s[], d[][]????????????
for (int i = 0; i < M * N; i++) {
s[i] = false;
d[i][0] = INF;
d[i][1] = INF;
}
for (int i = 0; i < K; i++) {
int x, y;
scanf("%d %d", &x, &y);
s[(y - 1)* M + x - 1] = true;
}
queue<P> que;
que.push(P(0, 0));
d[0][0] = 0;
while (que.size()) {
P p = que.front(); que.pop();
int i = p.first; // ????????????
if (p.second = 0) {
if (s[i] == true && d[i][1] == INF) {
d[i][1] = d[i][0] + 1;
que.push(P(i, 1));
}
if ((i / M) > 0 && d[i - M][0] == INF) {
d[i - M][0] = d[i][0] + 1;
que.push(P(i - M, 0));
}
if ((i / M) < N - 1 && d[i + M][0] == INF) {
d[i + M][0] = d[i][0] + 1;
que.push(P(i + M, 0));
}
}
else {
if (s[i] == true && d[i][0] == INF) {
d[i][0] = d[i][1] + 1;
que.push(P(i, 0));
}
if (i % M > 0 && d[i - 1][1] == INF) {
d[i - 1][1] = d[i][1] + 1;
que.push(P(i - 1, 1));
}
if (i % M < M - 1 && d[i + 1][1] == INF) {
d[i + 1][1] = d[i][1] + 1;
que.push(P(i + 1, 1));
}
}
}
int ans = d[M * N - 1][0];
if (ans > d[M * N - 1][1]) ans = d[M * N - 1][1];
if (ans == INF) ans = -1;
printf("%d", ans);
return 0;
} | a.cc:13:14: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
13 | bool s[MAX_N * MAX_M]; //?????????????????????????????????
| ^
a.cc:13:14: error: size of array 's' exceeds maximum object size '9223372036854775807'
a.cc:15:13: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
15 | int d[MAX_N * MAX_M][2]; // ???????????¢, ????????????, ????????±?\?
| ^
a.cc:15:13: error: size of array 'd' exceeds maximum object size '9223372036854775807'
|
s488107084 | p00528 | C++ | #include<iostream>
#include<queue>
#include<stdio.h>
#include<utility>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
#define INF 1000000
typedef pair<int, int> coord; //??§?¨?
typedef pair<coord, int> P; //??§?¨??????????
bool s[MAX_M][MAX_N]; //?????????????????????????????????
int M, N, K;
int d[MAX_M][MAX_N][2]; // ???????????¢, ????????????, ????????±?\?
int main()
{
scanf("%d %d %d", &M, &N, &K);
//s[][], d[][][]????????????
for (int i = 0; i < M ; i++) {
for (int j = 0; j < N; j++) {
s[i][j] = false;
d[i][j][0] = INF;
d[i][j][1] = INF;
}
}
for (int i = 0; i < K; i++) {
int x, y;
scanf("%d %d", &x, &y);
s[x - 1][y - 1] = true;
}
queue<P> que;
que.push(P(coord(0, 0), 0));
d[0][0][0] = 0;
while (que.size()) {
P p = que.front(); que.pop();
int x = p.first.first;
int y = p.first.second;
if (p.second = 0) {
if (s[x][y] == true && d[x][y][1] == INF) {
d[x][y][1] = d[x][y][0] + 1;
que.push(P(coord(x, y), 1));
}
if (y > 0 && d[x][y - 1][0] == INF) {
d[x][y - 1][0] = d[x][y][0] + 1;
que.push(P(coord(x, y - 1), 0));
}
if (y < N - 1 && d[x][y + 1][0] == INF) {
d[x][y + 1][0] = d[x][y][0] + 1;
que.push(P(coord(x, y + 1), 0));
}
}
else {
if (s[x][y] == true && d[x][y][0] == INF) {
d[x][y][0] = d[x][y][1] + 1;
que.push(P(coord(x, y), 0));
}
if (x > 0 && d[x - 1][y][1] == INF) {
d[x - 1][y][1] = d[x - 1][y][1] + 1;
que.push(P(coord(x - 1, y), 1));
}
if (x < M - 1 && d[x + 1][y][1] == INF) {
d[x + 1][y][1] = d[x][y][1] + 1;
que.push(P(coord(x + 1, y), 1));
}
}
}
int ans = d[M - 1][N - 1][0];
if (ans > d[M - 1][N - 1][1]) ans = d[M - 1][N -1][1];
if (ans == INF) ans = -1;
printf("%d\n", ans);
return 0;
} | /tmp/cc1Q4eA1.o: in function `main':
a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x23): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x95): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0xd1): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0xe4): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `K' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x1e4): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x2b1): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1Q4eA1.o
a.cc:(.text+0x2e9): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s550159061 | p00528 | C++ | #include <queue>
#include <vector>
#include <iostream>
using namespace std;
struct p1 {
int idx, x, y;
};
bool operator<(const p1& r1, const p1& r2) {
if (r1.y != r2.y) return r1.y < r2.y;
return r1.x < r2.x;
}
struct edge {
int to; long long cost; int type;
};
bool operator<(const edge& e1, const edge& e2) {
return e1.cost < e2.cost;
}
int H, W, N;
int main() {
cin >> W >> H >> N;
vector<p1> p(N);
for (int i = 0; i < N; i++) cin >> p[i].x >> p[i].y, p[i].x--, p[i].y--, p[i].idx = i;
p.push_back(p1{ N, W - 1, H - 1 }); N++;
vector<vector<p1> > ex(W), ey(H);
for (int i = 0; i < N; i++) {
ex[p[i].x].push_back(p[i]);
ey[p[i].y].push_back(p[i]);
}
for (int i = 0; i < W; i++) sort(ex[i].begin(), ex[i].end());
for (int i = 0; i < H; i++) sort(ey[i].begin(), ey[i].end());
vector<vector<edge> > G(N);
for (int i = 0; i < W; i++) {
for (int j = 1; j < ex[i].size(); j++) {
int d = ex[i][j].y - ex[i][j - 1].y;
G[ex[i][j - 1].idx].push_back(edge{ ex[i][j].idx, d, 0 });
G[ex[i][j].idx].push_back(edge{ ex[i][j - 1].idx, d, 0 });
}
}
for (int i = 0; i < H; i++) {
for (int j = 1; j < ey[i].size(); j++) {
int d = ey[i][j].x - ey[i][j - 1].x;
G[ey[i][j - 1].idx].push_back(edge{ ey[i][j].idx, d, 1 });
G[ey[i][j].idx].push_back(edge{ ey[i][j - 1].idx, d, 1 });
}
}
priority_queue<edge> que;
vector<long long> dist(N, -1);
if (ex[0].size()) {
que.push(edge{ ex[0][0].idx, ex[0][0].y, 0 });
dist[ex[0][0].idx] = ex[0][0].y;
}
while (!que.empty()) {
edge u = que.top(); que.pop();
for (edge e : G[u.to]) {
long long d = u.cost;
if (e.type == 0) d += abs(p[u.to].y - p[e.to].y);
else d += abs(p[u.to].x - p[e.to].x);
if (u.type != e.type) d++;
if (dist[e.to] > d || dist[e.to] == -1) {
dist[e.to] = d;
que.push(edge{ e.to, d, e.type });
}
}
}
cout << dist[N - 1] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:29:37: error: 'sort' was not declared in this scope; did you mean 'short'?
29 | for (int i = 0; i < W; i++) sort(ex[i].begin(), ex[i].end());
| ^~~~
| short
a.cc:30:37: error: 'sort' was not declared in this scope; did you mean 'short'?
30 | for (int i = 0; i < H; i++) sort(ey[i].begin(), ey[i].end());
| ^~~~
| short
|
s727763209 | p00528 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
using namespace std;
#define int long long
#define MP make_pair
#define PB push_back
#define FI first
#define SE second
#define MAX_K 200000
typedef pair<int, int> PII;
static const int INF = INT_MAX;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
int M, N, K;
vector<PII> fld;
int dp[MAX_K + 5][2];
int dfs(int n, int on){
//cout << fld[n].FI << " " << fld[n].SE << endl;
if (fld[n].FI == M&&fld[n].SE == N)return 0;
int res = INF;
int p1,p2;
int p1 = on ? lower_bound(fld.begin(), fld.end(), MP(fld[n].FI, -INF)) - fld.begin() : lower_bound(fld.begin(), fld.end(), MP(-INF, fld[n].SE)) - fld.begin();
int p2 = on ? upper_bound(fld.begin(), fld.end(), MP(fld[n].FI, INF)) - fld.begin() : upper_bound(fld.begin(), fld.end(), MP(INF, fld[n].SE)) - fld.begin();
cout<<p1<<" "<<p2<<" "<<fld[n].FI<<endl;
if (on && fld[p1].FI != fld[n].FI || (!on) && fld[p1].SE != fld[n].SE)return INF;
if(on && fld[p1].FI != fld[p2].FI || (!on) && fld[p1].SE != fld[p2].SE)return INF;
for (int i = p1; i <= p2; ++i){
if (i == n)continue;
if (fld[i].FI <= fld[n].FI && fld[i].SE <= fld[n].SE)continue;
int dis = fld[i].FI - fld[n].FI + fld[i].SE - fld[n].SE;
res = min(dfs(i, !on) + (dis + 1), min(dfs(i, on) + dis, res));
}
return res;
}
signed main(){
cin >> M >> N >> K;
fld.PB(PII(1, 1));
fld.PB(PII(M, N));
for (int i = 0; i < K; ++i){
int x, y;
cin >> x >> y;
fld.PB(PII(x, y));
}
sort(fld.begin(), fld.end());
cout << dfs(0, 1) << endl;
cout << "Finish" << endl;
return 0;
} | a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:41:13: error: redeclaration of 'long long int p1'
41 | int p1 = on ? lower_bound(fld.begin(), fld.end(), MP(fld[n].FI, -INF)) - fld.begin() : lower_bound(fld.begin(), fld.end(), MP(-INF, fld[n].SE)) - fld.begin();
| ^~
a.cc:40:13: note: 'long long int p1' previously declared here
40 | int p1,p2;
| ^~
a.cc:42:13: error: redeclaration of 'long long int p2'
42 | int p2 = on ? upper_bound(fld.begin(), fld.end(), MP(fld[n].FI, INF)) - fld.begin() : upper_bound(fld.begin(), fld.end(), MP(INF, fld[n].SE)) - fld.begin();
| ^~
a.cc:40:16: note: 'long long int p2' previously declared here
40 | int p1,p2;
| ^~
|
s097010989 | p00528 | C++ | #include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
ll d[200000][2];
int x[200000],y[200000];
vector<int>X[100000],Y[100000];
struct st{
int p;bool b;ll c;
};
bool operator<(st&a,st&b)->const{
return a.c>b.c;
}
int main() {
int m,n,k;scanf("%d%d%d",&m,&n,&k);
rep(i,k){
scanf("%d%d",&x[i],&y[i]);x[i]--;y[i]--;
X[x[i]].push_back(i);Y[y[i]].push_back(i);
}
priority_queue<st>que;
memset(d,0x3f,sizeof(d));
for(int&u:X[0]){
d[u][1]=y[u];
que.push({u,1,d[u][1]});
}
while(!que.empty()){
st p=que.top();que.pop();
if(d[p.p][p.b]!=p.c)continue;
if(p.b){
for(int&u:X[x[p.p]]){
if(d[u][1]>p.c+abs(y[p.p]-y[u])){
d[u][1]=p.c+abs(y[p.p]-y[u]);
que.push({u,1,d[u][1]});
}
}
for(int&u:Y[y[p.p]]){
if(d[u][0]>p.c+abs(x[p.p]-x[u])+1){
d[u][0]=p.c+abs(x[p.p]-x[u])+1;
que.push({u,0,d[u][0]});
}
}
}
else{
for(int&u:X[x[p.p]]){
if(d[u][1]>p.c+abs(y[p.p]-y[u])+1){
d[u][1]=p.c+abs(y[p.p]-y[u])+1;
que.push({u,1,d[u][1]});
}
}
for(int&u:Y[y[p.p]]){
if(d[u][0]>p.c+abs(x[p.p]-x[u])){
d[u][0]=p.c+abs(x[p.p]-x[u]);
que.push({u,0,d[u][0]});
}
}
}
}
ll Min=INF;
for(int&u:X[m-1]){
Min=min(Min,d[u][1]+abs(y[u]-n+1));
Min=min(Min,d[u][0]+1+abs(y[u]-n+1));
}
for(int&u:Y[n-1]){
Min=min(Min,d[u][0]+abs(x[u]-m+1));
Min=min(Min,d[u][1]+1+abs(x[u]-m+1));
}
if(Min==INF)puts("-1");
else printf("%lld\n",Min);
} | a.cc:13:28: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
13 | bool operator<(st&a,st&b)->const{
| ^~~~~
a.cc:13:1: error: 'operator<' function with trailing return type not declared with 'auto' type specifier
13 | bool operator<(st&a,st&b)->const{
| ^~~~
In file included from /usr/include/c++/14/string:49,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = st]':
/usr/include/c++/14/bits/predefined_ops.h:196:23: required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<st*, std::vector<st, std::allocator<st> > >; _Value = st; _Compare = std::less<st>]'
196 | { return bool(_M_comp(*__it, __val)); }
| ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<st*, vector<st, allocator<st> > >; _Distance = long int; _Tp = st; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<st> >]'
140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:216:23: required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<st*, vector<st, allocator<st> > >; _Compare = less<st>]'
216 | std::__push_heap(__first, _DistanceType((__last - __first) - 1),
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217 | _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:747:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = st; _Sequence = std::vector<st, std::allocator<st> >; _Compare = std::less<st>; value_type = st]'
747 | std::push_heap(c.begin(), c.end(), comp);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:26:11: required from here
26 | que.push({u,1,d[u][1]});
| ~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const st' and 'const st')
405 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
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_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const st' is not derived from 'const std::pair<_T1, _T2>'
405 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const st' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const st' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const st' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const st' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
|
s045279326 | p00528 | C++ | #include<bits/stdc++.h>
#define INF 0x3f3f3f3f3f3f3f3f
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
ll d[200000][2];
int x[200000],y[200000];
vector<int>X[100000],Y[100000];
struct st{
int p;bool b;ll c;
};
bool operator<(const st&a,const st&b){
return a.c>b.c;
}
int main() {
int m,n,k;scanf("%d%d%d",&m,&n,&k);
priority_queue<st>que;
memset(d,0x3f,sizeof(d));
rep(i,m)x[i].resize(2000);
rep(i,n)y[i].resize(2000);
rep(i,k){
scanf("%d%d",&x[i],&y[i]);x[i]--;y[i]--;
X[x[i]].push_back(i);Y[y[i]].push_back(i);
if(x[i]==0){
d[i][1]=y[i];
que.push({i,1,d[i][1]});
}
}
ll Min=INF;
while(!que.empty()){
st p=que.top();que.pop();
if(d[p.p][p.b]!=p.c)continue;
if(x[p.p]==m-1){
Min=min(Min,d[p.p][1]+abs(y[p.p]-n+1));
Min=min(Min,d[p.p][0]+1+abs(y[p.p]-n+1));
}
if(y[p.p]==n-1){
Min=min(Min,d[p.p][0]+abs(x[p.p]-m+1));
Min=min(Min,d[p.p][1]+1+abs(x[p.p]-m+1));
}
if(p.b){
for(int&u:X[x[p.p]]){
if(d[u][1]>p.c+abs(y[p.p]-y[u])){
d[u][1]=p.c+abs(y[p.p]-y[u]);
que.push({u,1,d[u][1]});
}
}
for(int&u:Y[y[p.p]]){
if(d[u][0]>p.c+abs(x[p.p]-x[u])+1){
d[u][0]=p.c+abs(x[p.p]-x[u])+1;
que.push({u,0,d[u][0]});
}
}
}
else{
for(int&u:X[x[p.p]]){
if(d[u][1]>p.c+abs(y[p.p]-y[u])+1){
d[u][1]=p.c+abs(y[p.p]-y[u])+1;
que.push({u,1,d[u][1]});
}
}
for(int&u:Y[y[p.p]]){
if(d[u][0]>p.c+abs(x[p.p]-x[u])){
d[u][0]=p.c+abs(x[p.p]-x[u]);
que.push({u,0,d[u][0]});
}
}
}
}
if(Min==INF)puts("-1");
else printf("%lld\n",Min);
} | a.cc: In function 'int main()':
a.cc:20:18: error: request for member 'resize' in 'x[i]', which is of non-class type 'int'
20 | rep(i,m)x[i].resize(2000);
| ^~~~~~
a.cc:21:18: error: request for member 'resize' in 'y[i]', which is of non-class type 'int'
21 | rep(i,n)y[i].resize(2000);
| ^~~~~~
|
s984205052 | p00528 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#define P pair<int,int>
#define int long long
#define INF LLONG_MAX/3
using namespace std;
vector<P>rinsetu[250000];//cost to
int mincost[250000];
signed main() {
int a, b, c; cin >> b >> a >> c; a--; b--;
map<int, vector<P>>n, m;
for (int d = 0; d < c; d++) {
int e, f; scanf("%lld%lld", &f, &e); e--; f--;
n[e].push_back(P(f,d*2));
m[f].push_back(P(e,d*2+1));
rinsetu[d*2].push_back(P(1,d*2+1));
rinsetu[d*2+1].push_back(P(1,d*2));
}
m[0].push_back(P(0,c*2));
n[a].push_back(P(b,c*2+1));
m[b].push_back(P(a,c*2+1));
for (auto k = n.begin(); k != n.end(); k++) {
vector<P>r = k->second;
if (r.size() > 1) {
sort(r.begin(), r.end());
for (int ttt = 1; ttt < r.size(); ttt++) {
rinsetu[r[ttt].second].push_back(P(r[ttt].first-r[ttt-1].first,r[ttt-1].second));
rinsetu[r[ttt-1].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt].second));
}
}
}
for (auto k = m.begin(); k != m.end(); k++) {
vector<P>r = k->second;
if (r.size() > 1) {
sort(r.begin(), r.end());
for (int ttt = 1; ttt < r.size(); ttt++) {
rinsetu[r[ttt].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt - 1].second));
rinsetu[r[ttt - 1].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt].second));
}
}
}
fill(mincost, mincost + c * 2 + 2, INF);
priority_queue<P, vector<P>, greater<P>>Q;
mincost[c * 2] = 0;
Q.push(P(0,c*2));
while (Q.size()) {
P t = Q.top(); Q.pop();
if (t.first > mincost[t.second])continue;
for (P i : rinsetu[t.second]) {
if (mincost[i.second] > mincost[t.second] + i.first) {
mincost[i.second] = mincost[t.second] + i.first;
Q.push(P(mincost[i.second],i.second));
}
}
}
if (mincost[c * 2 + 1] == INF)puts("-1");
else cout << mincost[c * 2 + 1] << endl;
} | a.cc: In function 'int main()':
a.cc:14:13: error: 'LLONG_MAX' was not declared in this scope
14 | #define INF LLONG_MAX/3
| ^~~~~~~~~
a.cc:52:44: note: in expansion of macro 'INF'
52 | fill(mincost, mincost + c * 2 + 2, INF);
| ^~~
a.cc:12:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
11 | #include<map>
+++ |+#include <climits>
12 | #define P pair<int,int>
|
s398372726 | p00528 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<map>
#define P pair<int,int>
#define int long long
#define INF LLONG_MAX/3
using namespace std;
vector<P>rinsetu[1000000];//cost to
int mincost[1000000];
signed main() {
int a, b, c; cin >> b >> a >> c; a--; b--;
map<int, vector<P>>n, m;
for (int d = 0; d < c; d++) {
int e, f; scanf("%lld%lld", &f, &e); e--; f--;
n[e].push_back(P(f,d*2));
m[f].push_back(P(e,d*2+1));
rinsetu[d*2].push_back(P(1,d*2+1));
rinsetu[d*2+1].push_back(P(1,d*2));
}
m[0].push_back(P(0,c*2));
n[a].push_back(P(b,c*2+1));
m[b].push_back(P(a,c*2+1));
for (auto k = n.begin(); k != n.end(); k++) {
vector<P>r = k->second;
if (r.size() > 1) {
sort(r.begin(), r.end());
for (int ttt = 1; ttt < r.size(); ttt++) {
rinsetu[r[ttt].second].push_back(P(r[ttt].first-r[ttt-1].first,r[ttt-1].second));
rinsetu[r[ttt-1].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt].second));
}
}
}
for (auto k = m.begin(); k != m.end(); k++) {
vector<P>r = k->second;
if (r.size() > 1) {
sort(r.begin(), r.end());
for (int ttt = 1; ttt < r.size(); ttt++) {
rinsetu[r[ttt].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt - 1].second));
rinsetu[r[ttt - 1].second].push_back(P(r[ttt].first - r[ttt - 1].first, r[ttt].second));
}
}
}
fill(mincost, mincost + c * 2 + 2, INF);
priority_queue<P, vector<P>, greater<P>>Q;
mincost[c * 2] = 0;
Q.push(P(0,c*2));
while (Q.size()) {
P t = Q.top(); Q.pop();
if (t.first > mincost[t.second])continue;
for (P i : rinsetu[t.second]) {
if (mincost[i.second] > mincost[t.second] + i.first) {
mincost[i.second] = mincost[t.second] + i.first;
Q.push(P(mincost[i.second],i.second));
}
}
}
if (mincost[c * 2 + 1] == INF)puts("-1");
else cout << mincost[c * 2 + 1] << endl;
} | a.cc: In function 'int main()':
a.cc:14:13: error: 'LLONG_MAX' was not declared in this scope
14 | #define INF LLONG_MAX/3
| ^~~~~~~~~
a.cc:52:44: note: in expansion of macro 'INF'
52 | fill(mincost, mincost + c * 2 + 2, INF);
| ^~~
a.cc:12:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
11 | #include<map>
+++ |+#include <climits>
12 | #define P pair<int,int>
|
s735230189 | p00528 | C++ | #include <bits/stdc++.h>
#define int long long
#define INF 1145141919810LL
#define MAX_K 200005
using namespace std;
struct Edge {
int to, cost;
};
struct Node {
int dir, num, dst;
bool operator<(const Node &r) const {
return dst > r.dst;
}
};
struct Point {
int num, p, pp;
bool operator<(const Point &r) const {
if(p == r.p) {
return pp < r.pp;
} else {
return p < r.p;
}
}
};
int n, m, k;
int x[MAX_K], y[MAX_K];
int dst[2][MAX_K];
int e_cnt[2][MAX_K] = { 0 };
Edge edge[2][MAX_K][4];
int ans = -1;
int live_start = -1, live_goal = -1;
main() {
cin >> m >> n >> k;
{
vector<Point> tate;
vector<Point> yoko;
for(int i = 0; i < k; ++i) {
cin >> x[i] >> y[i];
tate.push_back((Point){ i, x[i], y[i] });
yoko.push_back((Point){ i, y[i], x[i] });
if(x[i] == 1 && y[i] == 1) live_start = i;
if(x[i] == m && y[i] == n) live_goal = i;
}
if(live_start == -1) {
live_start = k;
tate.push_back((Point){ k, 1, 1 });
x[k] = 1;
y[k] = 1;
++k;
}
if(live_goal == -1) {
live_goal = k;
tate.push_back((Point){ k, m, n });
yoko.push_back((Point){ k, n, m });
x[k] = m;
y[k] = n;
++k;
}
//cout << live_start << " " << live_goal << endl;
sort(tate.begin(), tate.end());
sort(yoko.begin(), yoko.end());
for(int i = 1; i < tate.size(); ++i) {
if(tate[i - 1].p == tate[i].p) {
edge[0][tate[i - 1].num][e_cnt[0][tate[i - 1].num]++] = (Edge){ tate[i].num, tate[i].pp - tate[i - 1].pp };
edge[0][tate[i].num][e_cnt[0][tate[i].num]++] = (Edge){ tate[i - 1].num, tate[i].pp - tate[i - 1].pp };
}
}
for(int i = 1; i < yoko.size(); ++i) {
if(yoko[i - 1].p == yoko[i].p) {
edge[1][yoko[i - 1].num][e_cnt[1][yoko[i - 1].num]++] = (Edge){ yoko[i].num, yoko[i].pp - yoko[i - 1].pp };
edge[1][yoko[i].num][e_cnt[1][yoko[i].num]++] = (Edge){ yoko[i - 1].num, yoko[i].pp - yoko[i - 1].pp };
}
}
}
/*
for(int i = 0; i < k; ++i) {
cout << x[i] << " " << y[i] << " tate" << endl;
for(int j = 0; j < edge[0][i].size(); ++j) {
int e = edge[0][i][j].to;
cout << x[e] << " " << y[e] << endl;
}
cout << x[i] << " " << y[i] << " yoko" << endl;
for(int j = 0; j < edge[1][i].size(); ++j) {
int e = edge[1][i][j].to;
cout << x[e] << " " << y[e] << endl;
}
}
*/
priority_queue<Node> q;
q.push((Node){ 0, live_start, 0 });
for(int i = 0; i < 2; ++i) {
for(int j = 0; j < k; ++j) {
dst[i][j] = INF;
}
}
dst[0][live_start] = 0;
while(!q.empty()) {
Node now = q.top(); q.pop();
// tate
for(int j = 0; j < edge[0][now.num].size(); ++j) {
int next = edge[0][now.num][j].to;
int cost = dst[now.dir][now.num] + edge[0][now.num][j].cost;
if(now.dir == 0) {
if(cost < dst[0][next]) {
dst[0][next] = cost;
q.push((Node){ 0, next, cost });
}
} else {
++cost;
if(cost < dst[0][next]) {
dst[0][next] = cost;
q.push((Node){ 0, next, cost });
}
}
}
// yoko
for(int j = 0; j < edge[1][now.num].size(); ++j) {
int next = edge[1][now.num][j].to;
int cost = dst[now.dir][now.num] + edge[1][now.num][j].cost;
if(now.dir == 0) {
++cost;
if(cost < dst[1][next]) {
dst[1][next] = cost;
q.push((Node){ 1, next, cost });
}
} else {
if(cost < dst[1][next]) {
dst[1][next] = cost;
q.push((Node){ 1, next, cost });
}
}
}
}
if(dst[0][live_goal] != INF || dst[1][live_goal] != INF) {
cout << min(dst[0][live_goal], dst[1][live_goal]) << endl;
} else {
cout << -1 << endl;
}
} | a.cc:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
42 | main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:125:45: error: request for member 'size' in 'edge[0][now.Node::num]', which is of non-class type 'Edge [4]'
125 | for(int j = 0; j < edge[0][now.num].size(); ++j) {
| ^~~~
a.cc:143:45: error: request for member 'size' in 'edge[1][now.Node::num]', which is of non-class type 'Edge [4]'
143 | for(int j = 0; j < edge[1][now.num].size(); ++j) {
| ^~~~
|
s127099635 | p00528 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pb push_back
#define Rep(i, N) for(int i = 0; i < N; i++)
#define INF 1 << 28
#define LLINF 1LL << 60
typedef pair<int,int> Pi;
typedef pair<int,Pi> Ti;
struct Edge {
int to, cost;
};
int sz[2], K;
vector<Edge> G[2][200005];
int mc[2][200005];
void Dijkstra()
{
priority_queue<Ti, vector<Ti>, greater<Ti> >pq;
mc[0][0] = 0;
pq.push(Ti(0, Pi(0, 0)));
while(!pq.empty()) {
int v = pq.top().S.F, w = pq.top().F, t = pq.top().S.S; pq.pop();
if(w > mv[t][v]) continue;
Rep(i, G[t][v].size()) {
int u = G[t][v][i].to, nw = G[t][v][i].cost + w, nnw = nw;
if(u != K + 1) nnw++;
if(nnw < mc[1 - t][u]) {
mc[1 - t][u] = nnw;
pq.push(Ti(nnw, Pi(u, 1 - t)));
}
if(nw < mc[t][u]) {
mc[t][u] = nw;
pq.push(Ti(nw, Pi(u, t)));
}
}
}
}
signed main()
{
int X, Y;
vector<Pi> len[2][100006];
cin >> sz[0] >> sz[1] >> K;
len[0][1].pb(Pi(0, 0));
for(int i = 1; i <= K; i++) {
cin >> X >> Y;
len[0][X].pb(Pi(Y, i));
len[1][Y].pb(Pi(X, i));
}
len[0][sz[0]].pb(Pi(sz[1], K + 1));
len[1][sz[1]].pb(Pi(sz[0], K + 1));
Rep(i, 2) {
Rep(j, sz[i] + 1) {
sort(len[i][j].begin(), len[i][j].end());
Rep(k,len[i][j].size()) {
Pi v = len[i][j][k];
if(k - 1 >= 0) {
Pi u = len[i][j][k - 1];
G[i][v.S].pb((Edge){ u.S, v.F - u.F });
}
if(k + 1 < len[i][j].size()) {
Pi u = len[i][j][k + 1];
G[i][v.S].pb((Edge){ u.S, u.F - v.F });
}
}
}
}
fill_n(*mc, 2 * 200005, LLINF);
Dijkstra();
int ans = min(mc[0][K + 1], mc[1][K + 1]);
if(ans == LLINF) cout << -1 << endl;
else cout << ans - 1 << endl;
return 0;
} | a.cc: In function 'void Dijkstra()':
a.cc:28:12: error: 'mv' was not declared in this scope; did you mean 'v'?
28 | if(w > mv[t][v]) continue;
| ^~
| v
|
s513445529 | p00528 | C++ | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int inf = 1e9 + 9;
typedef pair<int, int> P;
typedef pair<int, P> PP;
struct edge
{
edge() {}
edge (int t, int v, int c) { to = t; f = v; cost = c; }
int to, f, cost;
};
int h, w, k;
vector<PP> a, b;
vector<edge> G[2][202020];
int d[2][202020];
void dijkstra(int s, int po)
{
for (int i = 0; i < 202020; i++){
d[0][i] = d[1][i] = inf;
}
priority_queue<PP, vector<PP>, greater<PP> > q;
d[0][s] = 0;
q.push(PP(0, P(s, 0)));
while (!q.empty()){
PP p = q.top(); q.pop();
int v = p.se.fi;
int f = p.se.se;
for (int i = 0; i < G[f][v].size(); i++){
edge e = G[f][v][i];
if (d[e.f][e.to] > d[f][v] + e.cost){
d[e.f][e.to] = d[f][v] + e.cost;
q.push(PP(d[e.f][e.to], P(e.to, e.f)));
}
}
}
}
int main()
{
bool izryt = false, _izryt = false;
cin >> w >> h >> k;
for (int i = 1; i <= k; i++){
int x, y;
cin >> x >> y;
x--; y--;
if (x == 0 && y == 0){
a.push_back(PP(x, P(y, 0)));
b.push_back(PP(y, P(x, 0)));
G[0][0].push_back(edge(0, 1, 1));
G[1][0].push_back(edge(0, 0, 1));
izryt = true;
}
else if (x + 1 == w && y + 1 == h){
a.push_back(PP(x, P(y, k + 1)));
b.push_back(PP(y, P(x, k + 1)));
G[0][k + 1].push_back(edge(k + 1, 1, 1));
G[1][k + 1].push_back(edge(k + 1, 0, 1));
_izryt = true;
}
else {
a.push_back(PP(x, P(y, i)));
b.push_back(PP(y, P(x, i)));
G[0][i].push_back(edge(i, 1, 1));
G[1][i].push_back(edge(i, 0, 1));
}
}
if (!izryt) a.push_back(PP(0, P(0, 0)));
if (!_izryt) b.push_back(PP(h - 1, P(w - 1, k + 1)));
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for (int i = 0; i < a.size() - 1; i++){
if (a[i].fi == a[i + 1].fi && a[i].se.fi != a[i + 1].se.fi){
G[0][a[i].se.se].push_back(edge(a[i + 1].se.se, 0, abs(a[i].se.fi - a[i + 1].se.fi)));
G[0][a[i + 1].se.se].push_back(edge(a[i].se.se, 0, abs(a[i].se.fi - a[i + 1].se.fi)));
}
}
for (int i = 0; i < b.size() - 1; i++){
if (b[i].fi == b[i + 1].fi && b[i].se.fi != b[i + 1].se.fi){
G[1][b[i].se.se].push_back(edge(b[i + 1].se.se, 1, abs(b[i].se.fi - b[i + 1].se.fi)));
G[1][b[i + 1].se.se].push_back(edge(b[i].se.se, 1, abs(b[i].se.fi - b[i + 1].se.fi)));
}
} | a.cc: In function 'int main()':
a.cc:97:4: error: expected '}' at end of input
97 | }
| ^
a.cc:50:1: note: to match this '{'
50 | {
| ^
|
s645781640 | p00528 | C++ | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF_LL 1e18
#define INF 1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fst first
#define snd second
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using PLLL = pair<ll, PLL >;
ll MOD = 1e9+7;
int M, N, K;
vector<PII> X[114514], Y[114514];
vector<PII> G[114514][2];
ll d[114514][2];
int g_n = -1;
int th_s_s = 0; // 0,0??????????????????????????????????????????
int main(void){
cin >> M >> N >> K;
REP(i, 114514){
REP(j, 2){
d[i][j] = INF_LL;
}
}
REP(i, K){
int x, y;
cin >> x >> y; x--; y--;
X[x].push_back({y, i+1});
Y[y].push_back({x, i+1});
if(x == M-1 && y == N-1){
g_n = i+1;
}
if(x == 0 && y == 0)
th_s_s = 1;
}
if(g_n == -1){
X[M-1].push_back({N-1, K+1});
Y[N-1].push_back({M-1, K+1});
g_n = K+1;
}
REP(i, M){
REP(j, X[i].size()){
REP(k, X[i].size()){
if(j == k) continue;
G[X[i][j].second][0].push_back({abs(X[i][j].first-X[i][k].first), X[i][k].second});
}
}
}
REP(i, N){
REP(j, Y[i].size()){
REP(k, Y[i].size()){
if(j == k) continue;
G[Y[i][j].second][1].push_back({abs(Y[i][j].first-Y[i][k].first), Y[i][k].second});
}
}
}
//priority_queue<pair<ll, pair<int, int> >, vector<pair<ll, pair<int, int> > >, greater<pair<ll, pair<int, int> > > > pq;
d[0][0] = 0;
REP(i, X[0].size()){
d[X[0][i].second][0] = X[0][i].first;
d[X[0][i].second][1] = min(d[X[0][i].second][1], (ll)X[0][i].first+1);
pq.push({X[0][i].first+1, {X[0][i].second, 1}});
}
if(th_s_s){
REP(i, Y[0].size()){
d[Y[0][i].second][1] = Y[0][i].first+1;
d[Y[0][i].second][0] = min(d[Y[0][i].second][0], (ll)Y[0][i].first+2);
pq.push({Y[0][i].first+1, {Y[0][i].second, 0}});
}
}
while(pq.size()){
pair<ll, pair<int, int> > p = pq.top(); pq.pop();
int v = p.second.first, s = p.second.second;
if(d[v][s] < p.first) continue;
REP(i, G[v][s].size()){
if(d[G[v][s][i].second][s] > d[v][s] + G[v][s][i].first){
d[G[v][s][i].second][s] = d[v][s] + G[v][s][i].first;
d[G[v][s][i].second][(s+1)%2] = min(d[G[v][s][i].second][(s+1)%2], d[G[v][s][i].second][s]+1);
pq.push({d[G[v][s][i].second][(s+1)%2], {G[v][s][i].second, (s+1)%2}});
}
}
}
if(d[g_n][0] == INF_LL && d[g_n][1] == INF_LL){
cout << -1 << endl;
}else{
cout << min(d[g_n][0], d[g_n][1]) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:88:17: error: 'pq' was not declared in this scope
88 | pq.push({X[0][i].first+1, {X[0][i].second, 1}});
| ^~
a.cc:94:25: error: 'pq' was not declared in this scope
94 | pq.push({Y[0][i].first+1, {Y[0][i].second, 0}});
| ^~
a.cc:97:15: error: 'pq' was not declared in this scope
97 | while(pq.size()){
| ^~
|
s537019190 | p00528 | C++ | #include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#define INF 1001001001001001001
using namespace std;
typedef long long ll;
typedef pair<int,int> pa;
typedef pair<ll,pa > ppa;
vector<pa> ve[2][100010];
int swi[2][200010];
ll res[2][200010];
int main(){
int M,N,K;
cin>>M>>N>>K;
int a,b,aa;
bool fla;
for(int i=1;i<=K;i++){
cin>>a>>b;
ve[0][a].push_back(pa(i,b));
ve[1][b].push_back(pa(i,a));
swi[0][i]=a;swi[1][i]=b;
if(a==1&&b==1){
fla=true;
aa=i;
}
}
for(int i=0;i<2;i++){
fill(res[i],res[i]+1+K,INF);
}
priority_queue<ppa> que;
for(vector<pa>::iterator it=ve[0][1].begin();it!=ve[0][1].end();it++){
que.push(ppa(it->second-1,pa(1,it->first)));
}
if(fla){
res[0][aa]=0;
}
while(!que.empty()){
ll dis=que.top().first;
int yota=que.top().first.first;
int ten=que.top().first.second;
//?????? | a.cc: In function 'int main()':
a.cc:43:42: error: request for member 'first' in 'que.std::priority_queue<std::pair<long long int, std::pair<int, int> > >::top().std::pair<long long int, std::pair<int, int> >::first', which is of non-class type 'const long long int'
43 | int yota=que.top().first.first;
| ^~~~~
a.cc:44:41: error: request for member 'second' in 'que.std::priority_queue<std::pair<long long int, std::pair<int, int> > >::top().std::pair<long long int, std::pair<int, int> >::first', which is of non-class type 'const long long int'
44 | int ten=que.top().first.second;
| ^~~~~~
a.cc:44:48: error: expected '}' at end of input
44 | int ten=que.top().first.second;
| ^
a.cc:41:28: note: to match this '{'
41 | while(!que.empty()){
| ^
a.cc:44:48: error: expected '}' at end of input
44 | int ten=que.top().first.second;
| ^
a.cc:15:11: note: to match this '{'
15 | int main(){
| ^
|
s896498544 | p00529 | C++ | #include <iostream>
#include <string>
using namespace std;
int main (){
string str;
int n,jcnt=0,ocnt=0,icnt=0,joicnt=0,ioicnt=0,ans=0;
cin>>n;
cin>>str;
for(int i=0;i<n;i++){
if(str[i]=='J') jcnt++;
else if(str[i]=='I'){
if(joicnt || ioicnt && ocnt==0 ) ans++;
if(jcnt && ocnt) joicnt++,jcnt--,ocnt--,icnt++;
if(ocnt && icnt) ocnt--,ioicnt++;
else icnt++
}
else if(jcnt+icnt>ocnt) ocnt++;
}
ans+=joicnt+ioicnt-joicnt/2;
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:18: error: expected ';' before '}' token
16 | else icnt++
| ^
| ;
17 | }
| ~
|
s982688190 | p00529 | C++ | #include <iostream>
using namespace std;
//J=0,O=1,I=2
int N;
int ary[1000010];
int joichec(int numJ,int numI,int& fla){
int cntJ=0,cntJO=0,cntJOI=0;
int cntI=0,cntOI=0,cntJOI2=0;
for(int i=0;i<N;i++){
switch(ary[i]){
case 0:
cntJ++;
break;
case 1:
if(cntJ>0){
cntJ--;
cntJO++;
}
break;
case 2:
if(numJ>0){
numJ--;
cntJ++;
}
else{
if(cntJO>0){
cntJO--;
cntJOI++;
}
}
break;
}
}
for(int i=N-1;i>=0;i--){
switch(ary[i]){
case 0:
if(cntOI>0){
cntOI--;
cntJOI2++;
}
break;
case 1:
if(cntI>0){
cntI--;
cntOI++;
}
break;
case 2:
if(numI>0){
numI--;
cntI++;
}
else{
if(cntOI>0){
cntOI--;
cntJOI2++;
}
}
break;
}
}
if(cntJO>cntOI) fla=-1;
else if(cntJO<cntOI) fla=1;
else fla=0;
//cout<<cntJ<<" "<<cntJO<<" "<<cntJOI<<" "<<cntI<<" "<<cntOI<<" "<<cntJOI2<<endl;//debug
return cntJOI;
}
int main(){
int numofI=0;
char tmp;
cin>>N;
for(int i=0;i<N;i++){
cin>>tmp;
switch(tmp){
case 'J':
ary[i]=0;
break;
case 'O':
ary[i]=1;
break;
case 'I':
ary[i]=2;
numofI++;
break;
}
}
/*
int lb=0,rb=numofI,mid,hog,piy;
hog=0;
bool flaa=false;
//while(rb-lb>0&&(!flaa)){
for(int i=0;i<25;i++){
if(rb-lb==1) flaa=true;
mid=(lb+rb)/2;
hog=joichec(mid,numofI-mid,piy);
//cout<<"hog="<<hog<<" mid="<<mid<<" lb="<<lb<<" rb="<<rb<<endl;//debug
if(piy==-1)rb=(mid-1);
else if(piy==1)lb=(mid+1);
else break;
}
cout<<hog<<endl;
*/
int hog,flaa;
for(int i=0;i<=numofI,i++){
hog=max(hog,joichec(i,numofI-i,flaa);
}
cout<<hog<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:108:34: error: expected ';' before ')' token
108 | for(int i=0;i<=numofI,i++){
| ^
| ;
a.cc:109:53: error: expected ')' before ';' token
109 | hog=max(hog,joichec(i,numofI-i,flaa);
| ~ ^
| )
|
s296948806 | p00529 | C++ | int start;
string str;
bool solve(int x){
int ic = 0,oc = 0,jc = 0;
for(int i = start; i < n; i++){
if(str[i] == 'I'){
if(x > ic)ic++;
else if(oc > jc){
jc++;
if(jc >= x)return true;
}
}
if(str[i] == 'O'){
if(ic > oc)oc++;
}
if(str[i] == 'J'){
if(oc > jc)jc++;
if(jc >= x)return true;
}
}
return false;
}
int main(){
cin >> n;
cin >> str;
reverse(str.begin(),str.end());
for(int i = 0; i < n; i++){
if(str[i] == 'I'){
start = i;
break;
}
}
int left,right,mid;
left = 1,right = n/3 + 1;
while(left < right){
mid = (left + right + 1)/2;
if(solve(mid)){
left = mid;
}else{
right = mid - 1;
}
}
cout << left << endl;
} | a.cc:3:1: error: 'string' does not name a type
3 | string str;
| ^~~~~~
a.cc: In function 'bool solve(int)':
a.cc:7:26: error: 'n' was not declared in this scope
7 | for(int i = start; i < n; i++){
| ^
a.cc:8:8: error: 'str' was not declared in this scope; did you mean 'std'?
8 | if(str[i] == 'I'){
| ^~~
| std
a.cc:15:8: error: 'str' was not declared in this scope; did you mean 'std'?
15 | if(str[i] == 'O'){
| ^~~
| std
a.cc:18:8: error: 'str' was not declared in this scope; did you mean 'std'?
18 | if(str[i] == 'J'){
| ^~~
| std
a.cc: In function 'int main()':
a.cc:28:7: error: 'cin' was not declared in this scope
28 | cin >> n;
| ^~~
a.cc:28:14: error: 'n' was not declared in this scope
28 | cin >> n;
| ^
a.cc:29:14: error: 'str' was not declared in this scope; did you mean 'std'?
29 | cin >> str;
| ^~~
| std
a.cc:31:7: error: 'reverse' was not declared in this scope
31 | reverse(str.begin(),str.end());
| ^~~~~~~
a.cc:51:7: error: 'cout' was not declared in this scope
51 | cout << left << endl;
| ^~~~
a.cc:51:23: error: 'endl' was not declared in this scope
51 | cout << left << endl;
| ^~~~
|
s229253333 | p00529 | C++ | #include<iostream>
#include<string>
using namespace std;
int n;
string str;
bool check(int num) {
int a = 0, b = 0, c = 0;
for (int i = n - 1; i > -1; --i) {
if (str[i] == 'I') {
if (a < num)++a;
else if (c < b)++c;
}
else if (str[i] == 'O') {
if (b < a) {
++b;
}
else if (c < b)++c;
}
if (c >= num)return true;
else return false;
}
int main() {
cin >> n >> str;
int ni = 1, na = n / 3 + 1;
while (ni < na) {
int nd = (ni + na) / 2;
if (check(nd)) {
ni = nd + 1;
}
else {
na = nd;
}
}
cout << ni - 1 << endl;
return 0;
} | a.cc: In function 'bool check(int)':
a.cc:22:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
22 | int main() {
| ^~
a.cc:22:9: note: remove parentheses to default-initialize a variable
22 | int main() {
| ^~
| --
a.cc:22:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:22:12: error: a function-definition is not allowed here before '{' token
22 | int main() {
| ^
a.cc:36:2: error: expected '}' at end of input
36 | }
| ^
a.cc:6:21: note: to match this '{'
6 | bool check(int num) {
| ^
a.cc:36:2: warning: control reaches end of non-void function [-Wreturn-type]
36 | }
| ^
|
s122645149 | p00529 | C++ | object Main extends App {
import scala.io.StdIn.{readLine}
val n = readLine().toInt
println(makeJOIOI(readLine().toList))
def makeJOIOI(str:List[Char]):Int = {
var pile = str
var j = 0
var i = 0
var jo = 0
var io = 0
var joi = 0
var ioi = 0
var joio = 0
var ioio = 0
while (!pile.isEmpty){
pile match{
case 'J'::t ⇒
pile = t
j += 1
case 'I'::t ⇒
pile = t
if (joio > 0){
joio -= 1
ioi += 1
jo += 1
}else if (ioio > 0){
ioio -= 1
ioi += 1
io += 1
}else if (jo > 0){
jo -= 1
joi += 1
}else if (io > 0){
io -= 1
ioi += 1
}else {
i += 1
}
case 'O'::t ⇒
pile = t
if (i > 0){
i -= 1
io += 1
}else if (j > 0){
j -= 1
jo += 1
}else if (ioi > 0){
ioi -= 1
ioio += 1
}else if (joi > 0){
joi -= 1
joio += 1
}
case _ ⇒ ???
}
}
joi + ioi + joio + ioio
}
}
| a.cc:17:21: error: extended character ⇒ is not valid in an identifier
17 | case 'J'::t ⇒
| ^
a.cc:20:21: error: extended character ⇒ is not valid in an identifier
20 | case 'I'::t ⇒
| ^
a.cc:39:21: error: extended character ⇒ is not valid in an identifier
39 | case 'O'::t ⇒
| ^
a.cc:54:16: error: extended character ⇒ is not valid in an identifier
54 | case _ ⇒ ???
| ^
a.cc:1:1: error: 'object' does not name a type
1 | object Main extends App {
| ^~~~~~
|
s027300394 | p00530 | C++ | #include<stdio.h>
#include<algorithm>
using namespace std;
int b[110000];
int z[110000];
long long bit[110000];
long long sum(int a,int b){
if(a)return sum(0,b)-sum(0,a-1);
long long ret=0;
for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
return ret;
}
void add(int a,int b){
for(;a<110000;a|=a+1)bit[a]+=b;
}
int segtree[262144];
int lx[110000];
int ly[110000];
int rx[110000];
int ry[110000];
void add2(int a,int b,int c,int d,int e,int f){
if(d<a||b<c)return;
if(c<=a&&b<=d){
segtree[e]+=f;
}else{
add2(a,(a+b)/2,c,d,e*2,f);
add2((a+b)/2+1,b,c,d,e*2+1,f);
}
if(e>1&&segtree[e]!=0&&segtree[e^1]!=0){
int t=max(segtree[e],segtree[e^1]);
segtree[e/2]+=t;
segtree[e^1]-=t;
segtree[e]-=t;
}
}
int query(int a,int b,int c,int d,int e,int f){
if(d<a||b<c)return -99999999;
if(c<=a&&b<=d)return segtree[e]+f;
return max(query(a,(a+b)/2,c,d,e*2,f+segtree[e]),query((a+b)/2+1,b,c,d,e*2+1,f+segtree[e]));
}
int L[110000];
int R[110000];
pair<int,int>yp[110000];
int main(){
int a;scanf("%d",&a);
for(int i=0;i<a;i++)scanf("%d",b+i);
bool chk=true;
bool same=false;
for(int i=0;i<a-1;i++)if(b[i]<b[i-1])chk=false;
for(int i=0;i<a-1;i++)if(b[i]==b[i-1])same=true;
if(chk){
if(same)printf("0\n");
else printf("1\n");return 0;
}
for(int i=0;i<a;i++){
z[i]=b[i];
yp[i]=make_pair(b[i],i);
}
std::sort(yp,yp+a);
std::sort(z,z+a);
long long ans=0;
for(int i=0;i<a;i++){
int at=lower_bound(z,z+a,b[i])-z;
if(at<a-1)ans+=sum(at+1,a-1);
add(at,1);
}
int tmp=0;
int ls=0;
int rs=0;
for(int i=0;i<a;i++){
if(tmp<b[i]){
L[i]=1;
tmp=b[i];
lx[ls]=i;
ly[ls++]=tmp;
}
}
tmp=1000000007;
for(int i=a-1;i>=0;i--){
if(tmp>b[i]){
R[i]=1;
tmp=b[i];
}
}
for(int i=0;i<a;i++){
if(R[i]){
rx[rs]=i;
ry[rs++]=b[i];
}
}
int ret=0;
int rm=0;
int ypat=0;
for(int i=0;i<a;i++){
if(L[i]){
add2(0,131071,rm,rm,1,-query(0,131071,rm,rm,1,0));
rm++;
}
if(R[i]){
int nx=b[i];
while(ypat<a&&yp[ypat].first<=nx){
int ind=yp[ypat].second;
if(!L[ind]&&!R[ind]){
int to=upper_bound(ly,ly+ls,b[ind])-ly;
add2(0,131071,to,a-1,1,-1);
}
ypat++;
}
int at=lower_bound(lx,lx+ls,i)-lx-1;
int at2=upper_bound(ly,ly+ls,b[i])-ly;
if(at2<=at){
ret=max(ret,query(0,131071,at2,at,1,0));
}
}else if(!L[i]){
int to=upper_bound(ly,ly+ls,b[i])-ly;
int rim=lower_bound(lx,lx+ls,i)-1;
if(to<=rim)add2(0,131071,to,rim,1,1);
}
}
// printf("%lld %d\n",ans,ret);
printf("%lld\n",ans-ret*2-1);
} | a.cc: In function 'int main()':
a.cc:116:56: error: invalid conversion from 'int*' to 'int' [-fpermissive]
116 | int rim=lower_bound(lx,lx+ls,i)-1;
| ~~~~~~~~~~~~~~~~~~~~~~~^~
| |
| int*
|
s981825610 | p00530 | C++ | #include<stdio.h>
#include<algorithm>
using namespace std;
int b[110000];
int z[110000];
long long bit[110000];
long long sum(int a,int b){
if(a)return sum(0,b)-sum(0,a-1);
long long ret=0;
for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
return ret;
}
void add(int a,int b){
for(;a<110000;a|=a+1)bit[a]+=b;
}
int segtree[262144];
int lx[110000];
int ly[110000];
int rx[110000];
int ry[110000];
void add2(int a,int b,int c,int d,int e,int f){
if(d<a||b<c)return;
if(c<=a&&b<=d){
segtree[e]+=f;
}else{
add2(a,(a+b)/2,c,d,e*2,f);
add2((a+b)/2+1,b,c,d,e*2+1,f);
}
if(e>1&&segtree[e]!=0&&segtree[e^1]!=0){
int t=max(segtree[e],segtree[e^1]);
segtree[e/2]+=t;
segtree[e^1]-=t;
segtree[e]-=t;
}
}
int query(int a,int b,int c,int d,int e,int f){
if(d<a||b<c)return -99999999;
if(c<=a&&b<=d)return segtree[e]+f;
return max(query(a,(a+b)/2,c,d,e*2,f+segtree[e]),query((a+b)/2+1,b,c,d,e*2+1,f+segtree[e]));
}
int L[110000];
int R[110000];
pair<int,int>yp[110000];
int main(){
int a;scanf("%d",&a);
for(int i=0;i<a;i++)scanf("%d",b+i);
bool chk=true;
bool same=false;
for(int i=0;i<a-1;i++)if(b[i]<b[i-1])chk=false;
for(int i=0;i<a-1;i++)if(b[i]==b[i-1])same=true;
if(chk){
if(same)printf("0\n");
else printf("1\n");return 0;
}
for(int i=0;i<a;i++){
z[i]=b[i];
yp[i]=make_pair(b[i],i);
}
std::sort(yp,yp+a);
std::sort(z,z+a);
long long ans=0;
for(int i=0;i<a;i++){
int at=lower_bound(z,z+a,b[i])-z;
if(at<a-1)ans+=sum(at+1,a-1);
add(at,1);
}
int tmp=0;
int ls=0;
int rs=0;
for(int i=0;i<a;i++){
if(tmp<b[i]){
L[i]=1;
tmp=b[i];
lx[ls]=i;
ly[ls++]=tmp;
}
}
tmp=1000000007;
for(int i=a-1;i>=0;i--){
if(tmp>b[i]){
R[i]=1;
tmp=b[i];
}
}
for(int i=0;i<a;i++){
if(R[i]){
rx[rs]=i;
ry[rs++]=b[i];
}
}
int ret=0;
int rm=0;
int ypat=0;
for(int i=0;i<a;i++){
if(R[i]){
int nx=b[i];
while(ypat<a&&yp[ypat].first<=nx){
int ind=yp[ypat].second;
if(!L[ind]&&!R[ind]){
int to=upper_bound(ly,ly+ls,b[ind])-ly;
int rim=lower_bound(lx,lx+ls,j)-lx-1;
add2(0,131071,to,rim,1,-1);
}
ypat++;
}
int at=lower_bound(lx,lx+ls,i)-lx-1;
int at2=upper_bound(ly,ly+ls,b[i])-ly;
if(at2<=at){
ret=max(ret,query(0,131071,at2,at,1,0));
}
}else if(!L[i]){
int to=upper_bound(ly,ly+ls,b[i])-ly;
int rim=lower_bound(lx,lx+ls,i)-lx-1;
if(to<=rim)add2(0,131071,to,rim,1,1);
}
}
// printf("%lld %d\n",ans,ret);
printf("%lld\n",ans-ret*2-1);
} | a.cc: In function 'int main()':
a.cc:101:70: error: 'j' was not declared in this scope
101 | int rim=lower_bound(lx,lx+ls,j)-lx-1;
| ^
|
s303902905 | p00530 | C++ | #include<iostream>
#include<algorithm>
#include<complex>
using namespace std;
int a[100001],b[100001],c[100001];
bool m[100001];
int main(){
int n;
cin>>n;
bool s=true;
for(int i=0;i<n;i++){
cin>>a[i];
if(i>0)if(a[i]<a[i-1])s=false;
b[i]=a[i];
m[i]=true;
}
if(n<=2||s==true)cout<<"1"<<endl;
else{
long long ans=0,best=0;
sort(b,b+n);
for(int i=0;i<n;i++){
int left=0,right=n,mid;
while(true){
mid=(left+right)/2;
if(b[mid]==a[i])break;
if(left>=right-1)break;
if(b[mid]<a[i])left=mid;
if(b[mid]>a[i])right=mid;
}
int set;
while(true){
if(mid==i){if(b[i]==a[i]&&m[i]==true)set=mid;break;}
if(b[mid]!=a[i])break;
if(b[mid]==a[i]&&m[mid]==true)set=mid;
if(i<mid)mid--;if(i>mid)mid++;
}
m[set]=false,c[i]=set;
ans+=abs(i-set);
for(int j=0;j<i-best;j++){
if(!(min(i,j)>max(c[i],c[j])||max(i,j)<min(c[i],c[j]))){
if(!(min(i,c[i])>max(j,c[j])||max(i,c[i])<min(j,c[j]))){
int d[4]={i,j,c[i],c[j]};
sort(d,d+4);
if(best<d[2]-d[1])best=d[2]-d[1];
}
}
}
}
cout<<ans/2-best<<endl;
}
}
getchar();
getchar();
return 0;
} | a.cc:52:18: error: expected constructor, destructor, or type conversion before ';' token
52 | getchar();
| ^
a.cc:53:18: error: expected constructor, destructor, or type conversion before ';' token
53 | getchar();
| ^
a.cc:54:9: error: expected unqualified-id before 'return'
54 | return 0;
| ^~~~~~
a.cc:55:1: error: expected declaration before '}' token
55 | }
| ^
|
s409089253 | p00530 | C++ | #include<iostream>
#include<algorithm>
#include<complex>
using namespace std;
int a[100001],b[100001],c[100001];
bool m[100001];
int main(){
int n;
cin>>n;
bool s=true;
for(int i=0;i<n;i++){
cin>>a[i];
if(i>0)if(a[i]<a[i-1])s=false;
b[i]=a[i];
m[i]=true;
}
if(n<=2||s==true)cout<<"1"<<endl;
else{
long long ans=0,best=0;
sort(b,b+n);
for(int i=0;i<n;i++){
int left=0,right=n,mid;
while(true){
mid=(left+right)/2;
if(b[mid]==a[i])break;
if(left>=right-1)break;
if(b[mid]<a[i])left=mid;
if(b[mid]>a[i])right=mid;
}
int set;
while(true){
if(mid==i){if(b[i]==a[i]&&m[i]==true)set=mid;break;}
if(b[mid]!=a[i])break;
if(b[mid]==a[i]&&m[mid]==true)set=mid;
if(i<mid)mid--;if(i>mid)mid++;
}
m[set]=false,c[i]=set;
ans+=abs(i-set);
for(int j=0;j<i-best;j++){
if(!(min(i,j)>max(c[i],c[j])||max(i,j)<min(c[i],c[j]))){
if(!(min(i,c[i])>max(j,c[j])||max(i,c[i])<min(j,c[j]))){
int d[4]={i,j,c[i],c[j]};
sort(d,d+4);
if(best<d[2]-d[1])best=d[2]-d[1];
}
}
}
}
cout<<ans/2-best<<endl;
}
}
return 0;
} | a.cc:52:9: error: expected unqualified-id before 'return'
52 | return 0;
| ^~~~~~
a.cc:53:1: error: expected declaration before '}' token
53 | }
| ^
|
s257249000 | p00530 | C++ | q | a.cc:1:1: error: 'q' does not name a type
1 | q
| ^
|
s436548984 | p00530 | C++ | q | a.cc:1:1: error: 'q' does not name a type
1 | q
| ^
|
s971912782 | p00530 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
const int N = 100005;
int n, m;
int a[N];
int bit[N];
int it[4 * N];
int lz[4 * N];
vector<int> val;
vector<int> v[N];
vector<int> start;
vector<int> finish;
void upd(int x) {
for (int i = x; i > 0; i -= i & -i) bit[i]++;
}
int get(int x) {
int ans = 0;
for (int i = x; i <= n; i += i & -i) ans += bit[i];
return ans;
}
void lazy(int node, int l, int r) {
if (!lz[node]) return;
it[node] += lz[node];
if (l != r) {
lz[node << 1] += lz[node];
lz[node << 1 | 1] += lz[node];
}
lz[node] = 0;
}
void upd(int node, int l, int r, int ll, int rr, int v, bool t) {
lazy(node, l, r);
if (l > r || ll > r || l > rr || ll > rr) return;
if (ll <= l && r <= rr) {
if (!t) lz[node] = v; else lz[node] = -v;
lazy(node, l, r); return;
}
int mid = (l + r) >> 1;
upd(node << 1, l, mid, ll, rr, v, t);
upd(node << 1 | 1, mid + 1, r, ll, rr, v, t);
it[node] = max(it[node << 1], it[node << 1 | 1]);
}
void upd(int x, int y, int z, int t) {
int l = 0, r = m;
while (l < r) {
int mid = (l + r + 1) >> 1;
if (a[finish[mid]] <= x) l = mid;
else r = mid - 1;
}
if (finish[l] < y) return;
int tmp = l;
l = 0, r = tmp;
while (l < r) {
int mid = (l + r) >> 1;
if (finish[mid] >= y) r = mid;
else l = mid + 1;
}
if (a[finish[tmp]] == x) {
upd(1, 0, m, tmp, tmp, z - 1, t), tmp--;
}
upd(1, 0, m, l, tmp, z, t);
}
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i]; val.push_back(a[i]);
}
sort(val.begin(), val.end());
val.erase(unique(val.begin(), val.end()), val.end());
for (int i = 1; i <= n; ++i) {
a[i] = lower_bound(val.begin(), val.end(), a[i]) - val.begin() + 1;
v[a[i]].push_back(i);
}
long long res = 0;
for (int i = 1; i <= n; ++i) {
res += get(a[i]); upd(a[i] - 1);
}
if (!res) {
for (int i = 1; i <= n; ++i) {
if (a[i] == a[i - 1]) {
cout << "0\n" return 0;
}
}
cout << "1\n" return 0;
}
int cur = 0;
for (int i = 1; i <= n; ++i) {
if (a[i] > cur) {
cur = a[i]; start.push_back(i);
}
}
cur = 1e9;
for (int i = n; i >= 1; --i) {
if (a[i] < cur) {
cur = a[i]; finish.push_back(i);
}
}
reverse(finish.begin(), finish.end());
m = finish.size() - 1;
int mx = 0;
for (int i = 0; i < start.size(); ++i) {
int st = 1;
if (i) {
st = a[start[i - 1]];
for (int j = start[i - 1]; j < start[i]; ++j) {
if (a[j] == a[start[i - 1]]) continue;
upd(a[j], j, 2, 1);
}
}
for (int j = st; j <= a[start[i]]; ++j) {
for (auto k : v[j]) {
if (k <= start[i]) continue;
if (j == a[start[i]]) upd(j, k, 1, 0);
else upd(j, k, 2, 0);
}
}
mx = max(mx, it[1]);
for (auto j : v[a[start[i]]]) {
if (j == start[i]) continue;
upd(a[start[i]], j, 1, 1);
}
}
cout << res - mx << '\n';
} | a.cc: In function 'int main()':
a.cc:90:30: error: expected ';' before 'return'
90 | cout << "0\n" return 0;
| ^~~~~~~
| ;
a.cc:93:22: error: expected ';' before 'return'
93 | cout << "1\n" return 0;
| ^~~~~~~
| ;
|
s832143513 | p00530 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
const int N = 100005;
int n, m;
int a[N];
int bit[N];
int it[4 * N];
int lz[4 * N];
vector<int> val;
vector<int> v[N];
vector<int> start;
vector<int> finish;
void upd(int x) {
for (int i = x; i > 0; i -= i & -i) bit[i]++;
}
int get(int x) {
int ans = 0;
for (int i = x; i <= n; i += i & -i) ans += bit[i];
return ans;
}
void lazy(int node, int l, int r) {
if (!lz[node]) return;
it[node] += lz[node];
if (l != r) {
lz[node << 1] += lz[node];
lz[node << 1 | 1] += lz[node];
}
lz[node] = 0;
}
void upd(int node, int l, int r, int ll, int rr, int v, bool t) {
lazy(node, l, r);
if (l > r || ll > r || l > rr || ll > rr) return;
if (ll <= l && r <= rr) {
if (!t) lz[node] = v; else lz[node] = -v;
lazy(node, l, r); return;
}
int mid = (l + r) >> 1;
upd(node << 1, l, mid, ll, rr, v, t);
upd(node << 1 | 1, mid + 1, r, ll, rr, v, t);
it[node] = max(it[node << 1], it[node << 1 | 1]);
}
void upd(int x, int y, int z, int t) {
int l = 0, r = m;
while (l < r) {
int mid = (l + r + 1) >> 1;
if (a[finish[mid]] <= x) l = mid;
else r = mid - 1;
}
if (finish[l] < y) return;
int tmp = l;
l = 0, r = tmp;
while (l < r) {
int mid = (l + r) >> 1;
if (finish[mid] >= y) r = mid;
else l = mid + 1;
}
if (a[finish[tmp]] == x) {
upd(1, 0, m, tmp, tmp, z - 1, t), tmp--;
}
upd(1, 0, m, l, tmp, z, t);
}
int main() {
ios::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> a[i]; val.push_back(a[i]);
}
sort(val.begin(), val.end());
val.erase(unique(val.begin(), val.end()), val.end());
for (int i = 1; i <= n; ++i) {
a[i] = lower_bound(val.begin(), val.end(), a[i]) - val.begin() + 1;
v[a[i]].push_back(i);
}
long long res = 0;
for (int i = 1; i <= n; ++i) {
res += get(a[i]); upd(a[i] - 1);
}
if (!res) {
for (int i = 1; i <= n; ++i) {
if (a[i] == a[i - 1]) {
cout << "0\n" return 0;
}
}
cout << "1\n"; return 0;
}
int cur = 0;
for (int i = 1; i <= n; ++i) {
if (a[i] > cur) {
cur = a[i]; start.push_back(i);
}
}
cur = 1e9;
for (int i = n; i >= 1; --i) {
if (a[i] < cur) {
cur = a[i]; finish.push_back(i);
}
}
reverse(finish.begin(), finish.end());
m = finish.size() - 1;
int mx = 0;
for (int i = 0; i < start.size(); ++i) {
int st = 1;
if (i) {
st = a[start[i - 1]];
for (int j = start[i - 1]; j < start[i]; ++j) {
if (a[j] == a[start[i - 1]]) continue;
upd(a[j], j, 2, 1);
}
}
for (int j = st; j <= a[start[i]]; ++j) {
for (auto k : v[j]) {
if (k <= start[i]) continue;
if (j == a[start[i]]) upd(j, k, 1, 0);
else upd(j, k, 2, 0);
}
}
mx = max(mx, it[1]);
for (auto j : v[a[start[i]]]) {
if (j == start[i]) continue;
upd(a[start[i]], j, 1, 1);
}
}
cout << res - mx << '\n';
} | a.cc: In function 'int main()':
a.cc:90:30: error: expected ';' before 'return'
90 | cout << "0\n" return 0;
| ^~~~~~~
| ;
|
s777199396 | p00530 | C++ | import copy
def main():
N = int(input())
A = []
for _ in range(N):
A.append(int(input()))
A_s = sorted(A) #A_sorted
n = 0
for x in range(N):
n += (N - 1) - x
B = []
for x in range(N - 1):
for y in range(x + 1, N):
hoge = copy.deepcopy(A)
tmp = hoge[x]
hoge[x] = hoge[y]
hoge[y] = tmp
B.append(hoge)
Ans = []
for x in range(len(B)):
cnt = 0
for _ in range(N - 1):
for y in range(N - 1):
if B[x] == A_s:
break
elif B[x][y] > B[x][y + 1]:
cnt += 1
tmp = B[x][y]
B[x][y] = B[x][y + 1]
B[x][y + 1] = tmp
Ans.append(cnt)
Ans.sort()
print(Ans[0])
if __name__ == "__main__":
main() | a.cc:8:23: error: stray '#' in program
8 | A_s = sorted(A) #A_sorted
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import copy
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s831246298 | p00531 | Java | import java.io.*;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int a=Integer.parseInt(line);
int b=Integer.parseInt(br.readLine());
int c=Integer.parseInt(br.readLine());
int d=Integer.parseInt(br.readLine());
int p=Integer.parseInt(br.readLine());
int x=a*p;
int y=(p>=c)?b+(p-c)*d:b;
out.println(Math.min(x,y));
out.flush();
}
} | Main.java:21: error: reached end of file while parsing
}
^
1 error
|
s026497362 | p00531 | Java | class Main{
public static void main(String[] args){
if(p*a-(p-c)*d+b)>0;
System.out.println((p-c)*d+d);
else System.out.println(p*a)
}
} | Main.java:4: error: illegal start of expression
if(p*a-(p-c)*d+b)>0;
^
Main.java:6: error: ';' expected
else System.out.println(p*a)
^
Main.java:6: error: 'else' without 'if'
else System.out.println(p*a)
^
3 errors
|
s954652616 | p00531 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,p;
scanf("%d",a);
scanf("%d",b);
scanf("%d",c);
scanf("%d",d);
scanf("%d",p);
x=p * a;
if(p < c){
y=b;
}
else{
y=b + (p - c) * d;
}
if(x < y){
printf("%d\n",y);
}
else{
printf("%d\n",x);
| main.c: In function 'main':
main.c:10:17: error: 'x' undeclared (first use in this function)
10 | x=p * a;
| ^
main.c:10:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:17: error: 'y' undeclared (first use in this function)
12 | y=b;
| ^
main.c:21:17: error: expected declaration or statement at end of input
21 | printf("%d\n",x);
| ^~~~~~
main.c:21:17: error: expected declaration or statement at end of input
|
s235679488 | p00531 | C | #include<stdio.h>
int main() {
int a, b, c, d, p, sum1 = 0, sum2 =0;
scanf("%d %d %d %d %d", a, b, c, d, p);
sum1 = a * p;
if(p > c) {
sum2 = b + (p - c) * d);
}else{
sum2 = b;
}
if(sum1 < sum2) {
printf("%d\n", sum1);
}else{
printf("%d\n", sum2);
}
return 0;
} | main.c: In function 'main':
main.c:7:27: error: expected ';' before ')' token
7 | sum2 = b + (p - c) * d);
| ^
| ;
main.c:7:27: error: expected statement before ')' token
|
s727339456 | p00531 | C | #include<stdio.h.>
int main()
{
int A, B,C,D, P;
int X, Y;
scanf("%d%d%d%d%d", &A, &B, &C, &D, &P);
X = A * P;
if(P <= C){
Y = C;
} else {
Y = B + (P-C) * D;
}
if(X < Y)
printf("%d\n", X);
else
printf("%d\n", Y);
return 0;
} | main.c:1:9: fatal error: stdio.h.: No such file or directory
1 | #include<stdio.h.>
| ^~~~~~~~~~
compilation terminated.
|
s570831448 | p00531 | C | #include<stdio.h.>
int main()
{
int A, B,C,D, P;
int X, Y;
scanf("%d%d%d%d%d", &A, &B, &C, &D, &P);
X = A * P;
if(P <= C){
Y = B;
} else {
Y = B + (P-C) * D;
}
if(X < Y)
printf("%d\n", X);
else
printf("%d\n", Y);
return 0;
} | main.c:1:9: fatal error: stdio.h.: No such file or directory
1 | #include<stdio.h.>
| ^~~~~~~~~~
compilation terminated.
|
s585636543 | p00531 | C | #include <stdio.h>
int main(void) {
int P = 0;
int A = 0;
int B = 0;
int C = 0;
int D = 0;
scanf("%d %d %d %d %d", &A, &B, &C, &D, &P);
int X = A * P;
int Y = B;
int y = (P - C)*D + B;
if (P <= C) {
if (X >= Y) printf("%d\n",Y);
else if(X < Y) printf("%d\n", X);
}
if (P > C) {
if (X >= y)printf("%d\n", y);
else if (X < y) printf("%d\n", X);
}
return 0; | main.c: In function 'main':
main.c:26:9: error: expected declaration or statement at end of input
26 | return 0;
| ^~~~~~
|
s916208464 | p00531 | C | #include <stdio.h>
int main(void) {
int P = 0;
int A = 0;
int B = 0;
int C = 0;
int D = 0;
scanf("%d %d %d %d %d", &A, &B, &C, &D, &P);
int X = A * P;
int Y = B;
int y = (P - C)*D + B;
if (P <= C) {
if (X >= Y) printf("%d\n",Y);
else if(X < Y) printf("%d\n", X);
}
if (P > C) {
if (X >= y)printf("%d\n", y);
else if (X < y) printf("%d\n", X);
}
return 0; | main.c: In function 'main':
main.c:26:9: error: expected declaration or statement at end of input
26 | return 0;
| ^~~~~~
|
s598403401 | p00531 | C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int xa;
int yb, yc, yd;
int p;
scanf("%d %d %d %d %d", &xa, &yb, &yc, &yd, &p);
xa = p * xa;
if (yc < p){
yb += (p - yc) * yd;
}
printf("%d\n", min(xa, yb));
return (0);
} | main.c: In function 'main':
main.c:19:24: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
19 | printf("%d\n", min(xa, yb));
| ^~~
| main
|
s306044717 | p00531 | C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int A;
int B, C, D;
int P;
scanf("%d %d %d %d %d", &A, &B, &C, &D, &P);
A = P * A;
if (C < P){
B += (P - C) * D;
}
printf("%d\n", min(A, B));
return (0);
} | main.c: In function 'main':
main.c:19:24: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
19 | printf("%d\n", min(A, B));
| ^~~
| main
|
s297222268 | p00531 | C | 8
300
100
10
250 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 8
| ^
|
s848676012 | p00531 | C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int A;
int B, C, D;
int P;
int MIN;
scanf("%d %d %d %d %d", &A, &B, &C, &D, &P);
A = P * A;
if (C < P){
B += (P - C) * D;
}
MIN = min(A, B);
printf("%d\n", MIN);
return (0);
} | main.c: In function 'main':
main.c:20:15: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
20 | MIN = min(A, B);
| ^~~
| main
|
s846554612 | p00531 | C | #include<stdio.h>
int main(){
int(a,b,c,d,p,x,y)
x=a*p
if(p<=c){
y=b
}
else{
y=b+d*(p-c)
}
if(x<=y){
printf("%d\n",x)
}
else{
printf("%d\n",y)
}
return 0
} | main.c: In function 'main':
main.c:3:14: error: expected ')' before ',' token
3 | int(a,b,c,d,p,x,y)
| ^
| )
main.c:8:1: error: 'else' without a previous 'if'
8 | else{
| ^~~~
main.c:9:1: error: 'y' undeclared (first use in this function)
9 | y=b+d*(p-c)
| ^
main.c:9:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:3: error: 'b' undeclared (first use in this function)
9 | y=b+d*(p-c)
| ^
main.c:9:5: error: 'd' undeclared (first use in this function)
9 | y=b+d*(p-c)
| ^
main.c:9:8: error: 'p' undeclared (first use in this function)
9 | y=b+d*(p-c)
| ^
main.c:9:10: error: 'c' undeclared (first use in this function)
9 | y=b+d*(p-c)
| ^
main.c:9:12: error: expected ';' before '}' token
9 | y=b+d*(p-c)
| ^
| ;
10 | }
| ~
main.c:11:4: error: 'x' undeclared (first use in this function)
11 | if(x<=y){
| ^
main.c:12:17: error: expected ';' before '}' token
12 | printf("%d\n",x)
| ^
| ;
13 | }
| ~
main.c:15:17: error: expected ';' before '}' token
15 | printf("%d\n",y)
| ^
| ;
16 | }
| ~
main.c:17:9: error: expected ';' before '}' token
17 | return 0
| ^
| ;
18 | }
| ~
|
s174237983 | p00531 | C | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);} | main.c:1:1: warning: data definition has no type or storage class
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~
main.c: In function 'main':
main.c:1:3: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'e' defaults to 'int' [-Wimplicit-int]
main.c:1:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
main.c:1:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~
main.c:1:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:67: error: expected expression before ';' token
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^
main.c:1:71: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d:;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~~
main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:71: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:71: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s092737172 | p00531 | C | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);} | main.c:1:1: warning: data definition has no type or storage class
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: return type defaults to 'int' [-Wimplicit-int]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~
main.c: In function 'main':
main.c:1:3: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:1:3: error: type of 'e' defaults to 'int' [-Wimplicit-int]
main.c:1:17: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
main.c:1:17: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~
main.c:1:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:66: error: expected ':' before ';' token
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^
| :
main.c:1:70: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);b+=e>c?e*d-c*d;a=!printf("%d\n",a*e<b?a*e:b);}
| ^~~~~~
main.c:1:70: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:70: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:70: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s678965549 | p00531 | C | #inclue<stdio.h>
int main( void ) {
int A ; // 1L * A
int B ; // kihon
int C ; // seigen
int D ; // +1L * D
int P ; // L
int X, Y ;
scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
X = A * P ;
if( P > C )
{
Y = (( P - C ) * D ) + B ;
}
else
{
Y = B ;
}
if( X > Y )
{
printf( "%d\n", Y ) ;
}
if( X < Y ){
printf( "%d\n", X ) ;
}
return 0;
} | main.c:1:2: error: invalid preprocessing directive #inclue; did you mean #include?
1 | #inclue<stdio.h>
| ^~~~~~
| include
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #inclue<stdio.h>
main.c:9:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
| ^~~~~
main.c:9:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:21:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
21 | printf( "%d\n", Y ) ;
| ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
24 | printf( "%d\n", X ) ;
| ^~~~~~
main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s665837034 | p00531 | C | #inclue<stdio.h>
int main( void ) {
int A ; // 1L * A
int B ; // kihon
int C ; // seigen
int D ; // +1L * D
int P ; // L
int X, Y ;
scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
X = A * P ;
if( P > C )
{
Y = (( P - C ) * D ) + B ;
}
else
{
Y = B ;
}
if( X > Y )
{
printf( "%d\n", Y ) ;
}
if( X < Y ){
printf( "%d\n", X ) ;
}
return 0;
} | main.c:1:2: error: invalid preprocessing directive #inclue; did you mean #include?
1 | #inclue<stdio.h>
| ^~~~~~
| include
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #inclue<stdio.h>
main.c:9:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf( "%d %d %d %d %d", &A, &B, &C, &D, &P ) ;
| ^~~~~
main.c:9:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:21:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
21 | printf( "%d\n", Y ) ;
| ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
24 | printf( "%d\n", X ) ;
| ^~~~~~
main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s189275858 | p00531 | C++ | #include <bits/stdc++.h>
typedef long long LL;
using namespace std;
int main(){
int A, B, C, D, E;
cin >> A >> B >> C >> D >> E;
int X = A * P;
int Y = B + D * max(0, C - B);
cout << min(X, Y) << endl;
}
| a.cc: In function 'int main()':
a.cc:8:15: error: 'P' was not declared in this scope
8 | int X = A * P;
| ^
|
s093632017 | p00531 | C++ | #include <bits/stdc++.h>
typedef long long LL;
using namespace std;
int main(){
int A, B, C, D, E;
cin >> A >> B >> C >> D >> P;
int X = A * P;
int Y = B + D * max(0, C - B);
cout << min(X, Y) << endl;
}
| a.cc: In function 'int main()':
a.cc:7:30: error: 'P' was not declared in this scope
7 | cin >> A >> B >> C >> D >> P;
| ^
|
s198123428 | p00531 | C++ | #include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
int a,b,c,d,e;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
printf("%d\n",min(a,b+max(0,p-c)*d));
} | a.cc: In function 'int main()':
a.cc:6:41: error: 'p' was not declared in this scope
6 | scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
| ^
|
s148544314 | p00531 | C++ | #include <iostream>
using namespace std;
int main() {
int x,y,a,b,c,d;
cin >> a;
cin >> b;
cin>>c;
cin>>d;
cin>>p;
x=a*p;
if(p<=c){y=b;}
else{y=b+y*d-c*d;}
if(x<=y){cout<<x<<endl;}
else{cout<<y<<endl;}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:6: error: 'p' was not declared in this scope
10 | cin>>p;
| ^
|
s065716909 | p00531 | C++ | #include <stdio.h>
int main(){
int a,b,c,d,p,x,y;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&p);
x=a*p;
if(p<=c){
y=b;
}
else {
y=(p-c)*d+b
}
for(i=0;i<5;i++){
scanf("%d
printf("%d\n",ave);
return 0;
} | a.cc:18:15: warning: missing terminating " character
18 | scanf("%d
| ^
a.cc:18:15: error: missing terminating " character
18 | scanf("%d
| ^~~
a.cc: In function 'int main()':
a.cc:15:20: error: expected ';' before '}' token
15 | y=(p-c)*d+b
| ^
| ;
16 | }
| ~
a.cc:17:9: error: 'i' was not declared in this scope
17 | for(i=0;i<5;i++){
| ^
a.cc:19:19: error: 'ave' was not declared in this scope
19 | printf("%d\n",ave);
| ^~~
a.cc:21:2: error: expected '}' at end of input
21 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s222544485 | p00531 | C++ | #include<iostream>
int main(){
int a,b,c,d,p;
int x=0;
int y=0;
std::cin>>a>>b>>c>>d>>p;
x+=a*p;
y+=b;
if(c<p)y+=(p-c)*d;
if(x>y)
std::cout<<x<<std::endl;
else std::cout<<y<<st::endl;
} | a.cc: In function 'int main()':
a.cc:12:20: error: 'st' has not been declared
12 | else std::cout<<y<<st::endl;
| ^~
|
s088249166 | p00531 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int xa;
int yb, yc, yd;
int p;
scanf("%d %d %d %d %d", &xa, &yb, &yc, &yd, &p);
xa = p * xa;
if (yc < p){
yb += (p - yc) * yd;
}
printf("%d\n", min(xa, yb));
return (0);
} | a.cc: In function 'int main()':
a.cc:19:24: error: 'min' was not declared in this scope; did you mean 'main'?
19 | printf("%d\n", min(xa, yb));
| ^~~
| main
|
s651506221 | p00531 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,c,d,p,x,y;
cin>>a>>b>>c>>d>>p;
x=p*a;
if(p<=c){
y=b;
}else{
y=b+((p-c)*d);
}
if(x<=y)cout<<x<<endl;else cout<<y<<endl;
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
13 | cout<<ans<<endl;
| ^~~
| abs
|
s614233648 | p00531 | C++ | a;main(b,c,d,e){scanf("%d%d%d%d%d", &a,&b,&c,&d,&e);a=!printf("%d\n",a*e<b+(e>c?e:c)*d?a*e:b+(e>c?e:c)*d);} | a.cc:1:1: error: 'a' does not name a type
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d", &a,&b,&c,&d,&e);a=!printf("%d\n",a*e<b+(e>c?e:c)*d?a*e:b+(e>c?e:c)*d);}
| ^
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d", &a,&b,&c,&d,&e);a=!printf("%d\n",a*e<b+(e>c?e:c)*d?a*e:b+(e>c?e:c)*d);}
| ^
|
s496232337 | p00531 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a,b,c,d,e;
cin<<a<<b<<c<<d<<e;
cout<<min(e*a,b+(c<e?(e-c)*d:0))<<endl;
} | a.cc: In function 'int main()':
a.cc:7:5: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
7 | cin<<a<<b<<c<<d<<e;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:7:5: note: candidate: 'operator<<(int, int)' (built-in)
7 | cin<<a<<b<<c<<d<<e;
| ~~~^~~
a.cc:7:5: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:7:2: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
7 | cin<<a<<b<<c<<d<<e;
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:7:7: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:7:7: required from here
7 | cin<<a<<b<<c<<d<<e;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
|
s010592000 | p00531 | C++ | #include <iostream>
using namespace std;
int main() {
int A,B,C,D,P,S=0,T=0;
cin >> A >> B >> C >> D>> P;
if (C>P){
S=A*P;
}
else{
T=B+(P-C)*D;
}
if (S=<T){
cout<< S << endl;
}
else {
cout<< T << endl;
}
// your code goes here
return 0;
} | a.cc: In function 'int main()':
a.cc:14:15: error: expected primary-expression before '<' token
14 | if (S=<T){
| ^
|
s327860092 | p00531 | C++ | #include <iostream>
using namespace std;
int main() {
int A,B,C,D,P,S=0,T=0;
cin >> A >> B >> C >> D>> P;
S=A*P;
T=B+(P-C)*D;
if (S=<T){
cout<< S << endl;
}
else {
cout<< T << endl;
}
// your code goes here
return 0;
} | a.cc: In function 'int main()':
a.cc:8:15: error: expected primary-expression before '<' token
8 | if (S=<T){
| ^
|
s451603184 | p00531 | C++ | #include <iostream>
using namespace std;
int main() {
int A,B,C,D,P,S=0,T=0;
cin >> A >> B >> C >> D>> P;
if (P<=C:S<=T){
S=A*P;
cout<< S << endl;
}
else {
T=B+(P-C)*D;
cout<< T << endl;
}
// your code goes here
return 0;
} | a.cc: In function 'int main()':
a.cc:6:17: error: found ':' in nested-name-specifier, expected '::'
6 | if (P<=C:S<=T){
| ^
| ::
a.cc:6:16: error: 'C' is not a class, namespace, or enumeration
6 | if (P<=C:S<=T){
| ^
|
s058276897 | p00531 | C++ | #include <cmath>
using namespace std;
int main() {
int A,B,C,D,P;
int X=0,Y=0;
cin >> A >> B >> C >> D>> P;
X=A*P;
Y=B+(P-C)*D;
int S=P-C;
if(S<=0){
Y=B;
}
if(X>Y){
cout<< Y <<endl;
}
else {
cout<< X << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin >> A >> B >> C >> D>> P;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <cmath>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:14:17: error: 'cout' was not declared in this scope
14 | cout<< Y <<endl;
| ^~~~
a.cc:14:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:28: error: 'endl' was not declared in this scope
14 | cout<< Y <<endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <cmath>
+++ |+#include <ostream>
2 | using namespace std;
a.cc:17:17: error: 'cout' was not declared in this scope
17 | cout<< X << endl;
| ^~~~
a.cc:17:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:29: error: 'endl' was not declared in this scope
17 | cout<< X << endl;
| ^~~~
a.cc:17:29: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s150908933 | p00531 | C++ | #include<stdio.h>
int main(void)
{
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
printf("%d\n",(g*a)>(c+(e*d)));
else {
printf("%d\n",(c+(e*d))>g*a);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'g' was not declared in this scope
10 | printf("%d\n",(g*a)>(c+(e*d)));
| ^
a.cc:11:9: error: 'else' without a previous 'if'
11 | else {
| ^~~~
|
s818250370 | p00531 | C++ | #include<stdio.h>
int main(void)
{
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
printf("%d\n",(g*a)>(c+(e*d)));
else {
printf("%d\n",(c+(e*d))>g*a);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:24: error: 'g' was not declared in this scope
10 | printf("%d\n",(g*a)>(c+(e*d)));
| ^
a.cc:11:9: error: 'else' without a previous 'if'
11 | else {
| ^~~~
|
s866609214 | p00531 | C++ | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,z,x;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
z=e*a;
x=b+d*(e-c);
if(z>x)
printf("%d\n",z);
else if(x>z){
printf("%d\n",x)
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:29: error: expected ';' before '}' token
15 | printf("%d\n",x)
| ^
| ;
16 | }
| ~
|
s477466695 | p00531 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int a, b, c, d, p, X, Y;
cin >> a >> b >> c >> d >> p;
X = a*p;
if (p <= c){
Y = b;
}
else{
p - c;
Y = c*d + b;
}
if (Y < X){
cout << Y << endl;
}
else{
cout << X << endl;
} | a.cc: In function 'int main()':
a.cc:24:18: error: expected '}' at end of input
24 | }
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s185784222 | p00531 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int a, b, c, d, p, X, Y;
cin >> a >> b >> c >> d >> p;
X = a*p;
if (p <= c){
Y = b;
}
else{
p - c;
Y = c*d + b;
}
if (Y < X){
cout << Y << endl;
}
else{
cout << X << endl;
} | a.cc: In function 'int main()':
a.cc:24:18: error: expected '}' at end of input
24 | }
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s143385486 | p00531 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int a, b, c, d, p, X, Y, ;
cin >> a >> b >> c >> d >> p;
X = a*p;
if (c <= p){
Y = b;
}
else{
p - c;
Y = d*(p-c);
}
if (Y < X){
cout << Y << endl;
}
else{
cout << X << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:34: error: expected unqualified-id before ';' token
8 | int a, b, c, d, p, X, Y, ;
| ^
|
s740539257 | p00531 | C++ | #include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e;
int main() {
cin >> a >> b >> c >> d >> e;
cout << min(a * e, max(b, b + (p - c) * d)) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:40: error: 'p' was not declared in this scope
6 | cout << min(a * e, max(b, b + (p - c) * d)) << endl;
| ^
|
s465791211 | p00531 | C++ | #include <bits/cstdc++.h>
using namespace std;
int a, b, c, d, p;
int x, y;
int main()
{
cin >> a >> b >> c >> d >> p;
x = p * a;
y = b;
if (p - c > 0) {
y += (p - c) * d;
}
if (x > y){
x = y;
}
cout << x << endl;
return 0;
} | a.cc:1:10: fatal error: bits/cstdc++.h: No such file or directory
1 | #include <bits/cstdc++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s417954335 | p00531 | C++ | #include<iostream>
nameapce using std;
int main(){
int a,b,c,d,p;
cin>>a>>b>>c>>d>>p;
if(a*c>b+d*(p-c)){
printf("%d",b+d*(p-c));
}
else{
printf("%d",a*c);
}
return 0;
} | a.cc:2:1: error: 'nameapce' does not name a type
2 | nameapce using std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>a>>b>>c>>d>>p;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s978569839 | p00531 | C++ | #include<iostream>
namespeace using std;
int main(){
int a,b,c,d,p;
cin>>a>>b>>c>>d>>p;
if(a*c>b+d*(p-c)){
printf("%d",b+d*(p-c));
}
else{
printf("%d",a*c);
}
return 0;
} | a.cc:2:1: error: 'namespeace' does not name a type; did you mean 'timespec'?
2 | namespeace using std;
| ^~~~~~~~~~
| timespec
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>a>>b>>c>>d>>p;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s576923137 | p00531 | C++ | #include<iostream>
nameapce using std;
int main(){
int a,b,c,d,p;
cin>>a>>b>>c>>d>>p;
if(a*c>b+d*(p-c)){
printf("%d",b+d*(p-c));
}
else{
printf("%d",a*c);
}
return 0;
} | a.cc:2:1: error: 'nameapce' does not name a type
2 | nameapce using std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>a>>b>>c>>d>>p;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s714279615 | p00531 | C++ | #include<iostream>
#include<stdio.h>
#include<math.h>
int main(){
int a=0,b=0,c=0,d=0,p=0;
int e=0;
cin>>a>>b>>c>>d>>p;
if(p<=c){
e=b;
}
else{
e=b+(p-c)*d;
}
cout<<e<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin>>a>>b>>c>>d>>p;
| ^~~
| std::cin
In file included 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:15:2: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
15 | cout<<e<<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:15:11: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
15 | cout<<e<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s174000228 | p00531 | C++ | #include <bits/stdc++.h>
using namespace std;
#define llong long long
#define inf 999999999
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<PP, int> PPP;
typedef struct data{
int now;
int cost;
}data;
int nh[4] = {1, 0, -1, 0};
int nw[4] = {0, 1, 0, -1};
int main(){
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
cout<<min(a*p,c+max(0,e-c)*d)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:21: error: 'p' was not declared in this scope
26 | cout<<min(a*p,c+max(0,e-c)*d)<<endl;
| ^
|
s277645422 | p00531 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,p;
cin>>a>>b>>c>>d>>p;
int mizu1,mizu2,tuika;
tuika =0;
mizu1 = a*p;
if(p <= c){
mizu2 = b;
} else {
for(int x=0;x < p-c;x++){
tuika += d;
}
mizu2 = b + tuika;
}
if(mizu1 < mizu2){
printf("%d \n", mizu1)
} else {
printf("%d \n", mizu2)
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:29: error: expected ';' before '}' token
19 | printf("%d \n", mizu1)
| ^
| ;
20 | } else {
| ~
a.cc:21:29: error: expected ';' before '}' token
21 | printf("%d \n", mizu2)
| ^
| ;
22 | }
| ~
|
s029741714 | p00531 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,p;
cin>>a>>b>>c>>d>>p;
int mizu1,mizu2,tuika;
tuika =0;
mizu1 = a*p;
if(p <= c){
mizu2 = b;
} else {
for(int x=0;x < p-c;x++){
tuika += d;
}
mizu2 = b + tuika;
}
if(mizu1 < mizu2){
printf("%d \n", mizu1):
} else {
printf("%d \n", mizu2):
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:29: error: expected ';' before ':' token
19 | printf("%d \n", mizu1):
| ^
| ;
a.cc:21:29: error: expected ';' before ':' token
21 | printf("%d \n", mizu2):
| ^
| ;
|
s205388760 | p00532 | Java | import java.io.*;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReadrer(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!ine.isEmpty()){
int n=Integer.parseInt(line);
int m=Integer.parseInt(br.readLine());
int[] t=new int[m];
int[] p=new int[n];
int[][] sel=new int[m][n];
StringTokenizer st1=new StringTokenizer(br.readLine());
for(int i=0;i<m;i++) t[i]=Integer.parseInt(st1.nextToken());
for(int i=0;i<m;i++){
StringTokenizer st2=new StringTokenizer(br.readLine());
for(int j=0;j<n;j++){
sel[i][j]=Integer.parseInt(st2.nextToken());
}
}
for(int i=0;i<m;i++){
int cnt=n;
for(int j=0;j<n;j++){
if(sel[i][j]==t[i]){
p[j]++;
cnt--;
}
}
p[t[i]]+=cnt;
}
for(int i=0;i<n;i++) out.println(p[i]);
out.flush();
}
}
} | Main.java:9: error: cannot find symbol
BufferedReader br=new BufferedReadrer(new InputStreamReader(System.in));
^
symbol: class BufferedReadrer
location: class Main
Main.java:11: error: cannot find symbol
while((line=br.readLine())!=null&&!ine.isEmpty()){
^
symbol: variable ine
location: class Main
2 errors
|
s001837722 | p00532 | Java | import java.util.Scanner;
public class JOI2014n2015yo2 {
private static Scanner s;
public static void main(String[] args) {
s = new Scanner(System.in);
int N = s.nextInt();
int M = s.nextInt();
int[] A = new int[M];
int num =0;
int targetpoint = 0;
int[] point = new int[N];
for(int i = 0;i < N;i++){
point[i] = 0;
}
for(int i = 0;i < M;i++){
A[i] = s.nextInt();
}
for(int i = 0;i < M;i++){
targetpoint = 0;
for(int j = 0;j < N;j++){
num = s.nextInt();
if(A[i] == num){
point[j] ++;
}else{
targetpoint++;
}
}
int h = A[i]-1;
point[h] += targetpoint;
}
for(int j = 0;j < N;j++){
System.out.printf("%d",point[j]);
if(j < N-1){
System.out.printf("\n");
}
}
}
} | Main.java:2: error: class JOI2014n2015yo2 is public, should be declared in a file named JOI2014n2015yo2.java
public class JOI2014n2015yo2 {
^
1 error
|
s696457725 | p00532 | C | #include<stdio.h>
int main(){
int n,m,i,j,target;
scanf("%d \n %d \n %d target",&n,&m,&target);
int data[100][100],score[100];
for(i = 1;i <= m;i++){
for(j = 1;j <= n;j++){
scanf("%d",data[i][m]);
}
}
printf("%d\n",score[]);
return 0;
} | main.c: In function 'main':
main.c:13:29: error: expected expression before ']' token
13 | printf("%d\n",score[]);
| ^
|
s711638526 | p00532 | C | #include <stdio.h>
int main()
{
int N, M;
int A[100];
int B[100][100];
int ans[100];
int i, j;
scanf("%d", &N);
scanf("%d", &M);
for(i=0; i<M; i++)
scanf("%d", &A[i]);
for(i=0; i<M; i++){
for(j=0; j<N; j++){
scanf("%d", &B[i][j]);
}
}
for(i=0; i<M; i++){
for(j=0; j<N; j++){
if(B[i][j] == A[i])
ans[j]++;
else
ans[A[i]-1]++;
}
}
for(i=0; i<N; i++)
printf("%d\n", ans[i]);
print("\n");
return 0;
} | main.c: In function 'main':
main.c:35:3: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
35 | print("\n");
| ^~~~~
| printf
|
s465558368 | p00532 | C | /*??????????????????????????£???(Christmas Party)*/
#include <stdio.h>
int main(){
int i, j, x, y, z, N, M;
int A[100] = {0};
int B[100][100] = {0};
int data[100] = {0};
scanf("%d %d", &N, &M);
for (i = 1; i - 1 < M; i++) {
scanf("%d", &A[i - 1]);
}
for (i = 1; i - 1 < M; i++) {
for (j = 1; j - 1 < N; j++) {
scanf("%d", &B[i - 1][j - 1]);
}
}
for (i = 1; i - 1 < M; i++) {
x = 0
for (j = 1; j - 1 < N; j++) {
if (A[i - 1] = B[i - 1][j - 1]) {
data[j - 1]++;
x++;
}
data[A[i - 1]] += N - x
}
}
for (i = 1; i - 1 < M; i++) {
printf("%d\n", A[i - 1]);
}
return 0;
} | main.c: In function 'main':
main.c:18:10: error: expected ';' before 'for'
18 | x = 0
| ^
| ;
19 | for (j = 1; j - 1 < N; j++) {
| ~~~
|
s347930894 | p00532 | C | /*??????????????????????????£???(Christmas Party)*/
#include <stdio.h>
int main(){
int i, j, x, N, M;
int A[100] = {0};
int B[100][100] = {0};
int data[100] = {0};
scanf("%d %d", &N, &M);
for (i = 1; i - 1 < M; i++) {
scanf("%d", &A[i - 1]);
}
for (i = 1; i - 1 < M; i++) {
for (j = 1; j - 1 < N; j++) {
scanf("%d", &B[i - 1][j - 1]);
}
}
for (i = 1; i - 1 < M; i++) {
x = 0
for (j = 1; j - 1 < N; j++) {
if (A[i - 1] = B[i - 1][j - 1]) {
data[j - 1]++;
x++;
}
data[A[i - 1]] += N - x
}
}
for (i = 1; i - 1 < M; i++) {
printf("%d\n", data[i - 1]);
}
return 0;
} | main.c: In function 'main':
main.c:18:10: error: expected ';' before 'for'
18 | x = 0
| ^
| ;
19 | for (j = 1; j - 1 < N; j++) {
| ~~~
|
s161327546 | p00532 | C | #include <stdio.h>
#include <string.h>
int main()
{
int n, m,
long int f[100][100];
int target[100];
int cnt[100] = { 0 };
int i, j;
scanf("%d%d", &n, &m);
for (i = 0;i < m;i++)
scanf("%d", &target[i]);
for (i = 0;i < m;i++)
for (j = 0;j < n;j++)
scanf("%d", &f[i][j]);
for (i = 0;i < m;i++) {
for (j = 0;i < n;j++) {
cnt[target[i]] += 1;
if (f[i][j] == target[i])cnt[j] += 1;
else cnt[target[i]] += 1;
}
}
for (i = 0;i < n;i++)
printf("%d\n", cnt[i]);
return 0;
} | main.c: In function 'main':
main.c:7:9: error: expected identifier or '(' before 'long'
7 | long int f[100][100];
| ^~~~
main.c:16:38: error: 'f' undeclared (first use in this function)
16 | scanf("%d", &f[i][j]);
| ^
main.c:16:38: note: each undeclared identifier is reported only once for each function it appears in
|
s040647031 | p00532 | C |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
int main(void){
int n, m, target[100], i, j, num, friend[100] = {0}, x = 0;
scanf("%d %d", &n, &m);
for (i = 0; i < m; i++){
scanf("%d", &target[i]);
}
for (i = 0; i < m; i++){
for (j = 0; j < n; j++){
scanf("%d", &num);
if (num == target[i])
friend[j] += 1;
else friend[target[i]-1]++;
}
}
for (i = 0; i < n; i++)
printf("%d\n", friend[i]);
return 0;
} | main.c:2:1: error: expected identifier or '(' before numeric constant
2 | 1
| ^
In file included from /usr/include/stdio.h:47,
from main.c:22:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:28:43: error: unknown type name 'size_t'
28 | size_t __nbytes);
| ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
+++ |+#include <stddef.h>
1 | /* Copyright (C) 1991-2025 Free Software Foundation, Inc.
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: error: unknown type name 'size_t'
37 | size_t __nbytes);
| ^~~~~~
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:37:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:57:3: error: unknown type name 'cookie_read_function_t'; did you mean 'cookie_seek_function_t'?
57 | cookie_read_function_t *read; /* Read bytes. */
| ^~~~~~~~~~~~~~~~~~~~~~
| cookie_seek_function_t
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:58:3: error: unknown type name 'cookie_write_function_t'; did you mean 'cookie_close_function_t'?
58 | cookie_write_function_t *write; /* Write bytes. */
| ^~~~~~~~~~~~~~~~~~~~~~~
| cookie_close_function_t
/usr/include/stdio.h:314:35: error: unknown type name 'size_t'
314 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
| ^~~~~~
/usr/include/stdio.h:130:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
129 | #include <bits/stdio_lim.h>
+++ |+#include <stddef.h>
130 |
/usr/include/stdio.h:320:47: error: unknown type name 'size_t'
320 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW
| ^~~~~~
/usr/include/stdio.h:320:47: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:340:34: error: unknown type name 'size_t'
340 | int __modes, size_t __n) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/stdio.h:340:34: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:346:24: error: unknown type name 'size_t'
346 | size_t __size) __THROW __nonnull ((1));
| ^~~~~~
/usr/include/stdio.h:346:24: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:385:44: error: unknown type name 'size_t'
385 | extern int snprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~
/usr/include/stdio.h:385:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:389:45: error: unknown type name 'size_t'
389 | extern int vsnprintf (char *__restrict __s, size_t __maxlen,
| ^~~~~~
/usr/include/stdio.h:389:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:690:30: error: unknown type name 'size_t'
690 | size_t *__restrict __n, int __delimiter,
| ^~~~~~
/usr/include/stdio.h:690:30: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:693:28: error: unknown type name 'size_t'
693 | size_t *__restrict __n, int __delimiter,
| ^~~~~~
/usr/include/stdio.h:693:28: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:698:27: error: unknown type name 'size_t'
698 | size_t *__restrict __n,
| ^~~~~~
/usr/include/stdio.h:698:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:8: error: unknown type name 'size_t'
728 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:728:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:728:46: error: unknown type name 'size_t'
728 | extern size_t fread (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:728:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:729:22: error: unknown type name 'size_t'
729 | size_t __n, FILE *__restrict __stream) __wur
| ^~~~~~
/usr/include/stdio.h:729:22: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:8: error: unknown type name 'size_t'
735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:735:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:735:53: error: unknown type name 'size_t'
735 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:735:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:736:23: error: unknown type name 'size_t'
736 | size_t __n, FILE *__restrict __s) __nonnull((4));
| ^~~~~~
/usr/include/stdio.h:736:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:8: error: unknown type name 'size_t'
756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:756:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:756:55: error: unknown type name 'size_t'
756 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:756:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:757:31: error: unknown type name 'size_t'
757 | size_t __n, FILE *__restrict __stream) __wur
| ^~~~~~
/usr/include/stdio.h:757:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:8: error: unknown type name 'size_t'
759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:759:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:759:62: error: unknown type name 'size_t'
759 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
| ^~~~~~
/usr/include/stdio.h:759:62: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
/usr/include/stdio.h:760:32: error: unknown type name 'size_t'
760 | size_t __n, FILE *__restrict __stream)
| ^~~~~~
/usr/include/stdio.h:760:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
|
s570091334 | p00532 | C++ | //2015
#include<iostream>
using namespace std;
int main(void){
int n,m,i,j,a;
cin>>n;
cin>>m;
int a[m+1],b[n+1];
for(i=1;i<=n;i++){
cin>>a[i];
}
for(i=1;i<=m:;i++){
for(j=0;j<=n;j++){
cin>>a;
if(a==a[i]){
b[j]++;
}
else{
b[a[i]]++;
}
}
}
for(j=0;j<=n;j++){
cout<<b[j]<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:13: error: conflicting declaration 'int a [(m + 1)]'
8 | int a[m+1],b[n+1];
| ^
a.cc:5:21: note: previous declaration as 'int a'
5 | int n,m,i,j,a;
| ^
a.cc:10:23: error: invalid types 'int[int]' for array subscript
10 | cin>>a[i];
| ^
a.cc:12:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
12 | for(i=1;i<=m:;i++){
| ^
a.cc:12:21: error: expected ';' before ':' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:12:26: error: expected ';' before ')' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:15:32: error: invalid types 'int[int]' for array subscript
15 | if(a==a[i]){
| ^
a.cc:19:36: error: invalid types 'int[int]' for array subscript
19 | b[a[i]]++;
| ^
|
s006140783 | p00532 | C++ | //2015
#include<iostream>
using namespace std;
int main(void){
int n,m,i,j,a;
cin>>n;
cin>>m;
int a[m+1],b[n+1];
for(i=1;i<=m;i++){
cin>>a[i];
}
for(i=1;i<=m:;i++){
for(j=0;j<=n;j++){
cin>>a;
if(a==a[i]){
b[j]++;
}
else{
b[a[i]]++;
}
}
}
for(j=0;j<=n;j++){
cout<<b[j]<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:13: error: conflicting declaration 'int a [(m + 1)]'
8 | int a[m+1],b[n+1];
| ^
a.cc:5:21: note: previous declaration as 'int a'
5 | int n,m,i,j,a;
| ^
a.cc:10:23: error: invalid types 'int[int]' for array subscript
10 | cin>>a[i];
| ^
a.cc:12:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
12 | for(i=1;i<=m:;i++){
| ^
a.cc:12:21: error: expected ';' before ':' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:12:26: error: expected ';' before ')' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:15:32: error: invalid types 'int[int]' for array subscript
15 | if(a==a[i]){
| ^
a.cc:19:36: error: invalid types 'int[int]' for array subscript
19 | b[a[i]]++;
| ^
|
s169808589 | p00532 | C++ | //2015
#include<iostream>
using namespace std;
int main(void){
int n,m,i,j,c;
cin>>n;
cin>>m;
int a[m+1],b[n+1];
for(i=1;i<=m;i++){
cin>>a[i];
}
for(i=1;i<=m:;i++){
for(j=1;j<=n;j++){
cin>>c;
if(c==a[i]){
b[j]++;
}
else{
b[a[i]]++;
}
}
}
for(j=0;j<=n;j++){
cout<<b[j]<<endl;
}
return 0;
}//2015
#include<iostream>
using namespace std;
int main(void){
int n,m,i,j,c;
cin>>n;
cin>>m;
int a[m+1],b[n+1];
for(i=1;i<=m;i++){
cin>>a[i];
}
for(i=1;i<=m:;i++){
for(j=1;j<=n;j++){
cin>>c;
if(c==a[i]){
b[j]++;
}
else{
b[a[i]]++;
}
}
}
for(j=0;j<=n;j++){
cout<<b[j]<<endl;
}
return 0;
}//2015
#include<iostream>
using namespace std;
int main(void){
int n,m,i,j,c;
cin>>n;
cin>>m;
int a[m+1],b[n+1];
for(i=1;i<=m;i++){
cin>>a[i];
}
for(i=1;i<=m:;i++){
for(j=1;j<=n;j++){
cin>>c;
if(c==a[i]){
b[j]++;
}
else{
b[a[i]]++;
}
}
}
for(j=0;j<=n;j++){
cout<<b[j]<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
12 | for(i=1;i<=m:;i++){
| ^
a.cc:12:21: error: expected ';' before ':' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:12:26: error: expected ';' before ')' token
12 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc: At global scope:
a.cc:30:5: error: redefinition of 'int main()'
30 | int main(void){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(void){
| ^~~~
a.cc: In function 'int main()':
a.cc:38:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
38 | for(i=1;i<=m:;i++){
| ^
a.cc:38:21: error: expected ';' before ':' token
38 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:38:26: error: expected ';' before ')' token
38 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc: At global scope:
a.cc:56:5: error: redefinition of 'int main()'
56 | int main(void){
| ^~~~
a.cc:4:5: note: 'int main()' previously defined here
4 | int main(void){
| ^~~~
a.cc: In function 'int main()':
a.cc:64:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
64 | for(i=1;i<=m:;i++){
| ^
a.cc:64:21: error: expected ';' before ':' token
64 | for(i=1;i<=m:;i++){
| ^
| ;
a.cc:64:26: error: expected ';' before ')' token
64 | for(i=1;i<=m:;i++){
| ^
| ;
|
s730955030 | p00532 | C++ | #include <iostream>
using namespace std;
int main(){
int n,m;
int a[101],b[101],p[101];
cin >> n >> m;
for(int i=1;i<=m;i++){
cin >> a[i];
}
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
cin >> b[i][j];
}
}
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(a[i] == b[i][j]){
p[j]+=1;
}
else{ p[a[j]]+=1;}
}}
for(int j=1;j<=n;j++){
cout << p[j] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:12: error: invalid types 'int[int]' for array subscript
12 | cin >> b[i][j];
| ^
a.cc:17:16: error: invalid types 'int[int]' for array subscript
17 | if(a[i] == b[i][j]){
| ^
|
s933953087 | p00532 | C++ | N = int(input())
M = int(input())
A = list(map(int, input().split()))
p = [0] * N
for i in range(M):
for bi, b in enumerate(map(int, input().split())):
if b == A[i]:
p[bi] += 1
else:
p[A[i] - 1] += 1
print('\n'.join(map(str, p))) | a.cc:1:1: error: 'N' does not name a type
1 | N = int(input())
| ^
|
s887128053 | p00532 | C++ | #include <cstdio>
using namespace std;
int main()
{
int n, m;
int tgt[100];
int pt[100] = {0};
int nomi[100][100];
scanf("%d", &n);
scanf("%d", &m);
for (int i = 0; i < m; i++){
scanf("%d", &tgt[i]);
}
for (int i = 0; i < m; i++){
int tmp = 0;
for (int j = 0; j < n; j++){
scanf("%d", &nomi[i][j]);
if (tgt[i] == nomi[i][j]){
//printf("tgt[%d] = %d, nomi[%d][%d] = %d\n",
i, tgt[i], i, j, nomi[i][j]);
pt[j]++;
tmp++;
}
}
pt[tgt[i] - 1] += n - tmp;
}
for (int i = 0; i < n; i++){
printf("%d\n", pt[i]);
}
return (0);
} | a.cc: In function 'int main()':
a.cc:25:29: error: expected ';' before ')' token
25 | i, tgt[i], i, j, nomi[i][j]);
| ^
| ;
|
s419774087 | p00532 | C++ | #include<iostream>
using namespace std;int n[100],x,k[100],m,c,i,j,l,o[100];
main(){cin>>m>>c;for(i=0;i<c;i++){cin>>k[i];}
for(i=0;i<m;i++){x=0;for(j=0;j<m;j++){o[j]=0;cin>>l;if(l!=m[i]){x++;}else{o[j]=1;x++;}}
for(j=0;j<m;j++){if(o[j]==1){n[j]+=x+1;}}}
for(i=0;i<m;i++){cout<<n[i]<<endl;}} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){cin>>m>>c;for(i=0;i<c;i++){cin>>k[i];}
| ^~~~
a.cc: In function 'int main()':
a.cc:4:60: error: invalid types 'int[int]' for array subscript
4 | for(i=0;i<m;i++){x=0;for(j=0;j<m;j++){o[j]=0;cin>>l;if(l!=m[i]){x++;}else{o[j]=1;x++;}}
| ^
|
s041074672 | p00532 | C++ | #include<iostream>
using namespace std;int n[100],x,k[100],m,c,i,j,l,o[100];
main(){cin>>m>>c;for(i=0;i<c;i++){cin>>k[i];}
for(i=0;i<m;i++){x=0;for(j=0;j<m;j++){o[j]=0;cin>>l;if(l!=m[i]){x++;}
else{o[j]=1;x++;}}
for(j=0;j<m;j++){if(o[j]==1){n[j]+=x+1;}}}
for(i=0;i<m;i++){cout<<n[i]<<endl;}} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){cin>>m>>c;for(i=0;i<c;i++){cin>>k[i];}
| ^~~~
a.cc: In function 'int main()':
a.cc:4:60: error: invalid types 'int[int]' for array subscript
4 | for(i=0;i<m;i++){x=0;for(j=0;j<m;j++){o[j]=0;cin>>l;if(l!=m[i]){x++;}
| ^
|
s704821776 | p00532 | C++ | #include<iostream>
using namespace std;int n[100],x,k[100],m,c,i,j,l,;
int main(){cin>>m>>c;for(i=0;i<c;i++){cin>>k[i];}
for(i=0;i<m;i++){
x=0;
for(j=0;j<m;j++){
cin>>l;
if(l!=k[i]){x++;}
else{n[j]++;}
}
n[k[i]]+=x;cout<<x<<endl;
}
for(i=0;i<m;i++){cout<<n[i]<<endl;}} | a.cc:2:51: error: expected unqualified-id before ';' token
2 | using namespace std;int n[100],x,k[100],m,c,i,j,l,;
| ^
|
s723194537 | p00532 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int player,round,i,j,k,forecast;
cin>>player>>round;
int target[round],forecast[player],sum[player];
for(i=0;i<round;i++) cin>>target[i]:
for(i=0;i<round;i++){
for(k=0;k<player;k++) cin>>forecaset[k];
for(j=0;j<player;j++){
if(forecast[j]==target[i])sum[j]++;
}
}
for(i=0;i<player;i++)cout<<sum[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:19: error: conflicting declaration 'int forecast [player]'
7 | int target[round],forecast[player],sum[player];
| ^~~~~~~~
a.cc:5:24: note: previous declaration as 'int forecast'
5 | int player,round,i,j,k,forecast;
| ^~~~~~~~
a.cc:8:36: error: expected ';' before ':' token
8 | for(i=0;i<round;i++) cin>>target[i]:
| ^
| ;
a.cc:9:20: error: expected ';' before ')' token
9 | for(i=0;i<round;i++){
| ^
| ;
|
s187659026 | p00532 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int player,round,i,j,k,forecast;
cin>>player>>round;
int target[round],forecast[player],sum[player];
for(i=0;i<round;i++) cin>>target[i];
for(i=0;i<round;i++){
for(k=0;k<player;k++) cin>>forecaset[k];
for(j=0;j<player;j++){
if(forecast[j]==target[i])sum[j]++;
}
}
for(i=0;i<player;i++)cout<<sum[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:19: error: conflicting declaration 'int forecast [player]'
7 | int target[round],forecast[player],sum[player];
| ^~~~~~~~
a.cc:5:24: note: previous declaration as 'int forecast'
5 | int player,round,i,j,k,forecast;
| ^~~~~~~~
a.cc:11:28: error: 'forecaset' was not declared in this scope; did you mean 'forecast'?
11 | for(k=0;k<player;k++) cin>>forecaset[k];
| ^~~~~~~~~
| forecast
a.cc:14:12: error: invalid types 'int[int]' for array subscript
14 | if(forecast[j]==target[i])sum[j]++;
| ^
|
s278159104 | p00532 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int player,round,i,j,k,forecast;
cin>>player>>round;
int target[round],forecast[player],sum[player];
for(i=0;i<round;i++) cin>>target[i];
for(i=0;i<round;i++){
for(k=0;k<player;k++) cin>>forecaset[k];
for(j=0;j<player;j++){
if(forecast[j]==target[i])sum[j]++;
}
}
for(i=0;i<player;i++)cout<<sum[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:7:19: error: conflicting declaration 'int forecast [player]'
7 | int target[round],forecast[player],sum[player];
| ^~~~~~~~
a.cc:5:24: note: previous declaration as 'int forecast'
5 | int player,round,i,j,k,forecast;
| ^~~~~~~~
a.cc:11:28: error: 'forecaset' was not declared in this scope; did you mean 'forecast'?
11 | for(k=0;k<player;k++) cin>>forecaset[k];
| ^~~~~~~~~
| forecast
a.cc:14:12: error: invalid types 'int[int]' for array subscript
14 | if(forecast[j]==target[i])sum[j]++;
| ^
|
s658131173 | p00532 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int player,round,i,j,k;
cin>>player>>round;
int target[round],forecast[player],sum[player];
for(i=0;i<round;i++) cin>>target[i];
for(i=0;i<round;i++){
for(k=0;k<player;k++) cin>>forecaset[k];
for(j=0;j<player;j++){
if(forecast[j]==target[i])sum[j]++;
}
}
for(i=0;i<player;i++)cout<<sum[i]<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:11:28: error: 'forecaset' was not declared in this scope; did you mean 'forecast'?
11 | for(k=0;k<player;k++) cin>>forecaset[k];
| ^~~~~~~~~
| forecast
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.