submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s299256757 | p00485 | C++ | #include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
vector<int>x[4000];
long long n,m,a,b,c,k,G;
long long s[4000],d[4000];
long long X[4000];
double maxn;int res;
int main(){
memset(X,63,sizeof(X));
cin>>n>>m>>k;
for(int i=1;i<=m;i++){
cin>>a>>b>>c;
x[a].push_back(b*1000000+c);
x[b].push_back(a*1000000+c);
}
for(int i=0;i<k;i++){
cin>>a;
s[a]=1;
}
for(int i=1;i<=n;i++){
if(s[i]==1){
memset(d,63,sizeof(d));
d[i]=0;
if(n<500){G=n;}
else{G=max(20,(n+k)/k+10);}
for(int h=1;h<=G;h++){
for(int j=1;j<=n;j++){
if(d[j]<1000000000){
for(int k=0;k<x[j].size();k++){
d[x[j][k]/1000000]=min(d[x[j][k]/1000000],d[j]+x[j][k]%1000000);
}
}
}
}
for(int j=1;j<=n;j++){
X[j]=min(X[j],d[j]);
}
}
}
for(int i=1;i<=n;i++){
maxn=max((long long)maxn,X[i]);
}
for(int i=1;i<=n;i++){
for(int j=0;j<x[i].size();j++){
if(abs(X[i]-X[x[i][j]/1000000])<x[i][j]%1000000){
a=x[i][j]%1000000-abs(X[i]-X[x[i][j]/1000000]);
maxn=max(maxn,(double)(max(X[i],X[(int)(x[i][j]/1000000)])+1.0*a/2.0));
}
}
}
res=(1.0*maxn+0.99999999);
cout<<res<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:31:35: error: no matching function for call to 'max(int, long long int)'
31 | else{G=max(20,(n+k)/k+10);}
| ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:31:35: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
31 | else{G=max(20,(n+k)/k+10);}
| ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:31:35: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
31 | else{G=max(20,(n+k)/k+10);}
| ~~~^~~~~~~~~~~~~~~
|
s441354104 | p00485 | C++ |
#include <stdio.h>
#include <queue>
#include <vector>
#include <functional>
using namespace std;
using P = pair<int, int>;
struct edge { int to, cost; };
const int MAX_N = 3000;
int dist[MAX_N + 1];
vector<edge>graph[MAX_N + 1];
int n, m, k;
void dijkstra()
{
for (int i = 0; i <= n; ++i)dist[i] = 123456789;
dist[0] = 0;
priority_queue<P, vector<P>, greater<P>>que;
que.push(make_pair(0, 0));
while (!que.empty())
{
P u = que.top(); que.pop();
if (dist[u.second] < u.first)continue;
for (edge e : graph[u.second])
{
int alt = u.first + e.cost;
if (dist[e.to] > alt)
{
dist[e.to] = alt;
que.push(make_pair(alt, e.to));
}
}
}
}
int main()
{
scanf("%d %d %d", &n, &m, &k);
for (int i = 0; i < m; ++i)
{
int a, b, l;
scanf("%d %d %d", &a, &b, &l);
graph[a].push_back({ b,l });
graph[b].push_back({ a,l });
}
for (int i = 0; i < k; ++i)
{
int s;
scanf("%d", &s);
graph[0].push_back({ s,0 });
}
dijkstra();
int ans = 0;
for (int v = 1; v <= n; ++v)
{
for (edge e : graph[v])
{
int u = e.to;
int cost = e.cost;
int a = min(dist[u], dist[v]);
int b = max(dist[u], dist[v]);
ans = max(ans, (int)round((b - a + cost) / 2.0) + a);
}
}
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:67:45: error: 'round' was not declared in this scope
67 | ans = max(ans, (int)round((b - a + cost) / 2.0) + a);
| ^~~~~
|
s519714003 | p00485 | C++ | #include<iostream>
#include<cstdio>
#include<queue>
#include<functional>
#include<vector>
#include<algorithm>
#define int long long
#define P pair<int,int>//cost to
using namespace std;
int kiriage(int a) {
if (a&1)return a / 2 + 1;
return a / 2;
}
vector<P>rinsetu[3000];
int mincost[3000];
signed main() {
int a, b, c; cin >> a >> b >> c;
fill(mincost, mincost + a, LLONG_MAX/3);
for (int d = 0; d < b; d++) {
int e, f, g; scanf("%d%d%d", &e, &f, &g); e--; f--;
rinsetu[e].push_back(P(g, f));
rinsetu[f].push_back(P(g, e));
}
priority_queue<P, vector<P>, greater<P>>Q;
for (int h = 0; h < c; h++) {
int i; scanf("%d", &i); i--;
mincost[i] = 0;
Q.push(P(0,i));
}
while (Q.size()) {
P o = Q.top(); Q.pop();
if (mincost[o.second] < o.first)continue;
for (P t : rinsetu[o.second]) {
if (o.first + t.first < mincost[t.second]) {
mincost[t.second] = o.first + t.first;
Q.push(P(mincost[t.second],t.second));
}
}
}
int MAX = 0;
for (int x = 0; x < a; x++) {
for (P y : rinsetu[x]) {
y.first -= abs(mincost[x] - mincost[y.second]);
MAX = max(MAX, max(mincost[x], mincost[y.second]) + kiriage(y.first));
}
}
cout << MAX << endl;
} | a.cc: In function 'int main()':
a.cc:19:36: error: 'LLONG_MAX' was not declared in this scope
19 | fill(mincost, mincost + a, LLONG_MAX/3);
| ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
6 | #include<algorithm>
+++ |+#include <climits>
7 | #define int long long
|
s881071289 | p00485 | C++ | #include<bits/stdc++,h>
#define int long long
#define P pair<int,int>//cost to
using namespace std;
int kiriage(int a) {
if (a&1)return a / 2 + 1;
return a / 2;
}
vector<P>rinsetu[3000];
int mincost[3000];
signed main() {
int a, b, c; cin >> a >> b >> c;
fill(mincost, mincost + a, LLONG_MAX/3);
for (int d = 0; d < b; d++) {
int e, f, g; scanf("%d%d%d", &e, &f, &g); e--; f--;
rinsetu[e].push_back(P(g, f));
rinsetu[f].push_back(P(g, e));
}
priority_queue<P, vector<P>, greater<P>>Q;
for (int h = 0; h < c; h++) {
int i; scanf("%d", &i); i--;
mincost[i] = 0;
Q.push(P(0,i));
}
while (Q.size()) {
P o = Q.top(); Q.pop();
if (mincost[o.second] < o.first)continue;
for (P t : rinsetu[o.second]) {
if (o.first + t.first < mincost[t.second]) {
mincost[t.second] = o.first + t.first;
Q.push(P(mincost[t.second],t.second));
}
}
}
int MAX = 0;
for (int x = 0; x < a; x++) {
for (P y : rinsetu[x]) {
y.first -= abs(mincost[x] - mincost[y.second]);
MAX = max(MAX, max(mincost[x], mincost[y.second]) + kiriage(y.first));
}
}
cout << MAX << endl;
} | a.cc:1:9: fatal error: bits/stdc++,h: No such file or directory
1 | #include<bits/stdc++,h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s194621193 | p00485 | C++ | 10 30 3
2 5 831
1 7 478
10 9 435
4 7 841
10 4 399
6 8 85
9 8 433
3 7 109
9 4 325
2 4 323
5 10 410
8 2 979
3 6 818
1 10 566
9 2 781
5 4 634
8 1 248
2 1 234
4 8 497
10 3 324
8 7 137
6 7 565
1 6 357
3 1 870
2 6 36
2 3 821
3 9 884
8 10 345
3 5 901
3 4 427
2
1
5 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 30 3
| ^~
|
s846701629 | p00485 | C++ | #include <vector>
#include <queue>
#include <algorithm>
template <size_t N, typename COST_T, COST_T INF>
class Dijkstra
{
public:
struct Path
{
int connectingIndex;
COST_T cost;
};
struct Agent
{
int index;
COST_T cost;
bool operator<(const Agent& rhs) const
{
return cost > rhs.cost;
}
};
Dijkstra()
{
init_paths();
}
void init_paths()
{
edges.assign(N, std::vector<Path>());
}
void add_path(int from, int to, COST_T cost)
{
edges[from].push_back(Path{ to, cost });
}
void add_path_undirected(int node1, int node2, COST_T cost)
{
edges[node1].push_back(Path{ node2, cost });
edges[node2].push_back(Path{ node1, cost });
}
void find_shortest_path(std::vector<int> start_indices)
{
// initialize
que = std::priority_queue<Agent>();
fill(begin(minimum_cost), end(minimum_cost), INF);
for (int start_index : start_indices)
{
que.push(Agent{ start_index, /*cost*/0 });
}
while (!que.empty())
{
Agent agent = que.top(); que.pop();
if (minimum_cost[agent.index] <= agent.cost)
{
continue;
}
minimum_cost[agent.index] = agent.cost;
for (auto path : edges[agent.index])
{
int next_index = path.connectingIndex;
COST_T next_cost = agent.cost + path.cost;
if (minimum_cost[next_index] > next_cost)
{
que.push(Agent{ next_index,
next_cost });
}
}
}
}
COST_T get_cost(int index) const
{
return minimum_cost[index];
}
std::vector<std::vector<Path>> edges;
std::priority_queue<Agent> que;
int start;
int goal;
COST_T minimum_cost[N];
int prev_node[N];
};
#include <iostream>
#include <tuple>
using namespace std;
int N, M, K;
const int INF = 1e9;
Dijkstra<3001, int, INF> dijkstra;
vector<tuple<int, int, int>> edges;
int main()
{
cin >> N >> M >> K;
for (int i = 0; i < N; ++i)
{
int a, b, l;
cin >> a >> b >> l;
dijkstra.add_path_undirected(a, b, l);
edges.emplace_back(a, b, l);
}
vector<int> start_indices;
for (int i = 0; i < K; ++i)
{
int s;
cin >> s;
start_indices.push_back(s);
}
dijkstra.find_shortest_path(start_indices);
int max_distance = 0;
for (auto edge : edges)
{
int a = std::get<0>(edge);
int b = std::get<1>(edge);
int l = std::get<2>(edge);
int a_distance = dijkstra.get_cost(a);
int b_distance = dijkstra.get_cost(a);
int distance = a_distance
+ (b_distance - a_distance + l) / 2
+ (b_distance - a_distance + l) % 2;
max_distance = max(max_distance, distance);
}
cout << max_distance << endl;
} | a.cc: In instantiation of 'void Dijkstra<N, COST_T, INF>::find_shortest_path(std::vector<int>) [with long unsigned int N = 3001; COST_T = int; COST_T INF = 1000000000]':
a.cc:120:29: required from here
120 | dijkstra.find_shortest_path(start_indices);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:50:27: error: 'begin' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
50 | fill(begin(minimum_cost), end(minimum_cost), INF);
| ~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:69,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' declared here, later in the translation unit
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:50:46: error: 'end' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
50 | fill(begin(minimum_cost), end(minimum_cost), INF);
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/range_access.h:116:37: note: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' declared here, later in the translation unit
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:50:21: error: 'fill' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
50 | fill(begin(minimum_cost), end(minimum_cost), INF);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)' declared here, later in the translation unit
191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
|
s631770061 | p00485 | C++ | #include<bits/stdc++.h>
using namespace std;
#define M 100000007
typedef pair<int,int> P;
/*int main(){
cout<<8979879<<endl;
}*/
int ri[3001][3001];
int main(void){
int n,m,k,
i,j,
mx,t,
a[100001],b[100001],l[100001],s[3000],
d[3001];
priority_queue<P,vector<P>,greater<P> > que;
cin>>n>>m>>k;
for(i=0;i<m;i++) cin>>a[i]>>b[i]>>l[i];
for(i=0;i<k;i++) cin>>s[i];
// for(i=0;i<k;i++) cout<<s[i]<<endl;
for(i=1;i<=n;i++) for(j=1;j<=n;j++) ri[i][j]=M;
for(i=0;i<m;i++) ri[a[i]][b[i]]=l[i],ri[b[i]][a[i]]=l[i];
/* for(i=1;i<=n;i++){
for(j=1;j<=n;j++)cout<<ri[i][j]<<' ';
cout<<endl;
}*/
mx=0;
int leng[3001];
for(i=1;i<=n;i++) leng[i]=M;
for(i=0;i<k;i++){
leng[s[i]]=0;
que.push(P(0,s[i]));
}
while(!que.empty()){
P p=que.top();
que.pop();
int v=p.second;
if(leng[v]<p.first) continue;
for(j=1;j<=n;j++){
t=leng[v]+ri[v][j];
// cout<<j<<' '<<leng[j]<<' '<<t<<endl;
if(leng[j]>t){
leng[j]=t;
// cout<<leng[j]<<' '<<j<<endl;
que.push(P(leng[j],j));
}
}
}
/* for(i=1;i<=n;i++) cout<<leng[i]<<' ';
cout<<endl;*/
for(i=1;i<=n;i++){
double cnt=0,sum=0;
for(j=1;j<=n;j++){
if(ri[i][j]!=M) cnt++,sum+=ri[i][j]+leng[j];
}
if(sum%cnt>=cnt/2) mx=max(mx,sum%cnt+1);
else mx=max(mx,sum%cnt);
}
cout<<mx<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:59:23: error: invalid operands of types 'double' and 'double' to binary 'operator%'
59 | if(sum%cnt>=cnt/2) mx=max(mx,sum%cnt+1);
| ~~~^~~~
| | |
| | double
| double
a.cc:59:49: error: invalid operands of types 'double' and 'double' to binary 'operator%'
59 | if(sum%cnt>=cnt/2) mx=max(mx,sum%cnt+1);
| ~~~^~~~
| | |
| | double
| double
a.cc:60:35: error: invalid operands of types 'double' and 'double' to binary 'operator%'
60 | else mx=max(mx,sum%cnt);
| ~~~^~~~
| | |
| | double
| double
|
s811091002 | p00485 | C++ | #include<bits/stdc++.h>
using namespace std;
#define M 100000007
typedef pair<int,int> P;
/*int main(){
cout<<8979879<<endl;
}*/
int ri[3001][3001];
int main(void){
int n,m,k,
i,j,
mx,t,ans,
a[100001],b[100001],l[100001],s[3000],
d[3001];
priority_queue<P,vector<P>,greater<P> > que;
cin>>n>>m>>k;
for(i=0;i<m;i++) cin>>a[i]>>b[i]>>l[i];
for(i=0;i<k;i++) cin>>s[i];
// for(i=0;i<k;i++) cout<<s[i]<<endl;
for(i=1;i<=n;i++) for(j=1;j<=n;j++) ri[i][j]=M;
for(i=0;i<m;i++) ri[a[i]][b[i]]=l[i],ri[b[i]][a[i]]=l[i];
/* for(i=1;i<=n;i++){
for(j=1;j<=n;j++)cout<<ri[i][j]<<' ';
cout<<endl;
}*/
int leng[3001];
for(i=1;i<=n;i++) leng[i]=M;
for(i=0;i<k;i++){
leng[s[i]]=0;
que.push(P(0,s[i]));
}
while(!que.empty()){
P p=que.top();
que.pop();
int v=p.second;
if(leng[v]<p.first) continue;
for(j=1;j<=n;j++){
t=leng[v]+ri[v][j];
// cout<<j<<' '<<leng[j]<<' '<<t<<endl;
if(leng[j]>t){
leng[j]=t;
// cout<<leng[j]<<' '<<j<<endl;
que.push(P(leng[j],j));
}
}
}
/* for(i=1;i<=n;i++) cout<<leng[i]<<' ';
cout<<endl;*/
ans=0;
for(i=1;i<=n;i++){
int mx=0,y;
double x;
for(j=1;j<=n;j++){
if(ri[i][j]!=M){
mx=max(mx,ri[i][j]+leng[j]);
}
else{
mx=max(mx,ri[i][j]);
}
}
}
x=(double)mx/2;
// cout<<x<<' '<<mx<<' '<<mi<<endl;
y=round(x);
ans=max(ans,y);
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:66:17: error: 'x' was not declared in this scope
66 | x=(double)mx/2;
| ^
a.cc:68:17: error: 'y' was not declared in this scope
68 | y=round(x);
| ^
a.cc: At global scope:
a.cc:72:9: error: 'cout' does not name a type
72 | cout<<ans<<endl;
| ^~~~
a.cc:74:9: error: expected unqualified-id before 'return'
74 | return 0;
| ^~~~~~
a.cc:75:1: error: expected declaration before '}' token
75 | }
| ^
|
s867871091 | p00485 | C++ | #include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int i,j;
int n,m,l;;
scanf("%d%d%d",&n,&m,&l);
vector<pair<int,int> > a[3000];
for(i=0;i<m;++i){
int p,q,r;
scanf("%d%d%d",&p,&q,&r);
--p;
--q;
a[p].push_back(make_pair(q,r));
a[q].push_back(make_pair(p,r));
}
int b[3000];
memset(b,0x7f,sizeof(b));
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > c;
for(i=0;i<l;++i){
int p;
scanf("%d",&p);
--p;
b[p]=0;
c.push(make_pair(0,p));
}
while(!c.empty()){
int p,q;
p=c.top().first;
q=c.top().second;
c.pop();
for(i=0;i<(int)a[q].size();++i){
if(b[a[q][i].first]<=p+a[q][i].second)
continue;
b[a[q][i].first]=p+a[q][i].second;
c.push(make_pair(p+a[q][i].second,a[q][i].first));
}
}
int mx=0;
for(i=0;i<n;++i)
for(j=0;j<(int)a[i].size();++j)
mx=max(mx,max(b[i],b[a[i][j].first])+(a[i][j].second-abs(b[i]-b[a[i][j].first])+1)/2);
printf("%d\n",mx);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:9: error: 'memset' was not declared in this scope
21 | memset(b,0x7f,sizeof(b));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include<cstdio>
+++ |+#include <cstring>
6 | using namespace std;
|
s272455284 | p00485 | C++ | #include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main()
{
const int inf = (int)1e9;
int n, m, k;
int ans = inf;
vector<int> dist;
vector<vector<pair<int, int> > > graph;
vector<pair<pair<int, int>, int> > edge;
scanf("%d%d%d", &n, &m, &k);
dist.resize(n, inf);
for(int i = 0; i < m; ++i) {
int a, b, l;
scanf("%d%d%d", &a, &b, &l);
a -= 1, b -= 1;
edge.push_back(make_pair(make_pair(a, b), l));
graph[a].push_back(make_pair(b, l));
graph[b].push_back(make_pair(a, l));
}
for(int i = 0; i < k; ++i) {
int s;
scanf("%d", &s);
s -= 1;
priority_queue<pair<int, int> > q;
q.push_back(make_pair(0, s));
while(!q.empty()) {
int v = q.top().second;
int c = -q.top().first;
q.pop();
if(dist[v] < c)
continue;
dist[v] = c;
for(int i = 0; i < graph[v].size(); ++i) {
int w = graph[v][i].second;
int d = graph[v][i].second + c;
q.push(make_pair(-d, w));
}
}
}
for(int i = 0; i < m; ++i) {
int a = edge[i].first.first;
int b = edge[i].first.second;
int l = edge[i].second;
if(dist[a] > dist[b])
swap(a, b);
int cost;
if(dist[a] + l <= dist[b])
cost = dist[b];
else
cost = (l - (dist[b] - dist[a]) + 1) / 2;
ans = max(ans, cost);
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:30:3: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'push_back'
30 | q.push_back(make_pair(0, s));
| ^~~~~~~~~
|
s620810049 | p00485 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define s size()
#define INF 100000000
int cost[3005][3005];
int d[3005];
int maxi[100005]={};
bool used[3005]={};
pair<pair<int,int> > ii[100005];
int V;
void dijkstra(int s){
fill(d,d+V,INF);
d[s]=0;
while(1){
int v=-1;
for(int u=0;u<V;u++){
if(!used[u] && (v==-1 || d[u]<d[v]){
v=u;
}
}
if(v==-1){
break;
}
used[v]=true;
for(int i=0;i<V;i++){
d[i]=min(d[i],d[v]+cost[v][i]);
}
}
}
int n,m,k;
int main(){
scanf("%d %d %d",&n,&m,&k);
for(int i=0;i<3005;i++){
for(int j=0;j<3005;j++){
cost[i][j]=INF;
}
}
for(int i=0;i<m;i++){
int w,ww,eu;
scanf("%d %d %d",&w,&ww,&eu);
ii[i]=mp(eu,mp(w,ww));
cost[w-1][ww-1]=eu;
cost[ww-1][w-1]=eu;
}
int res=0;
for(int i=0;i<k;i++){
int t;
scanf("%d",&t);
dijkstra(t-1);
memset(used,0,sizeof(used));
for(int j=0;j<m;j++){
maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
}
}
for(int j=0;j<m;j++){
res=max(res,maxi[j]);
}
printf("%d\n",res);
return 0;
} | a.cc:24:20: error: wrong number of template arguments (1, should be 2)
24 | pair<pair<int,int> > ii[100005];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:4:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
89 | struct pair;
| ^~~~
a.cc: In function 'void dijkstra(int (*)())':
a.cc:32:60: error: expected ')' before '{' token
32 | if(!used[u] && (v==-1 || d[u]<d[v]){
| ~ ^
| )
a.cc:35:17: error: expected primary-expression before '}' token
35 | }
| ^
a.cc: In function 'int main()':
a.cc:56:29: error: 'mp' was not declared in this scope; did you mean 'm'?
56 | ii[i]=mp(eu,mp(w,ww));
| ^~
| m
a.cc:56:23: error: 'mp' was not declared in this scope; did you mean 'm'?
56 | ii[i]=mp(eu,mp(w,ww));
| ^~
| m
a.cc:64:27: error: invalid conversion from 'int' to 'int (*)()' [-fpermissive]
64 | dijkstra(t-1);
| ~^~
| |
| int
a.cc:18:11: note: initializing argument 1 of 'void dijkstra(int (*)())'
18 | #define s size()
| ^
a.cc:26:19: note: in expansion of macro 's'
26 | void dijkstra(int s){
| ^
a.cc:67:52: error: request for member 'first' in 'ii[j]', which is of non-class type 'int'
67 | maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
| ^~~~~
a.cc:67:66: error: request for member 'second' in 'ii[j]', which is of non-class type 'int'
67 | maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
| ^~~~~~
a.cc:67:90: error: request for member 'second' in 'ii[j]', which is of non-class type 'int'
67 | maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
| ^~~~~~
|
s876713530 | p00485 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define s size()
#define INF 100000000
int cost[3005][3005];
int d[3005];
int maxi[100005]={};
bool used[3005]={};
P1 ii[100005];
int V;
void dijkstra(int s){
fill(d,d+V,INF);
d[s]=0;
while(1){
int v=-1;
for(int u=0;u<V;u++){
if(!used[u] && (v==-1 || d[u]<d[v])){
v=u;
}
}
if(v==-1){
break;
}
used[v]=true;
for(int i=0;i<V;i++){
d[i]=min(d[i],d[v]+cost[v][i]);
}
}
}
int n,m,k;
int main(){
scanf("%d %d %d",&n,&m,&k);
for(int i=0;i<3005;i++){
for(int j=0;j<3005;j++){
cost[i][j]=INF;
}
}
for(int i=0;i<m;i++){
int w,ww,eu;
scanf("%d %d %d",&w,&ww,&eu);
ii[i]=mp(eu,mp(w,ww));
cost[w-1][ww-1]=eu;
cost[ww-1][w-1]=eu;
}
int res=0;
for(int i=0;i<k;i++){
int t;
scanf("%d",&t);
dijkstra(t-1);
memset(used,0,sizeof(used));
for(int j=0;j<m;j++){
maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
}
}
for(int j=0;j<m;j++){
res=max(res,maxi[j]);
}
printf("%d\n",res);
return 0;
} | a.cc: In function 'int main()':
a.cc:65:27: error: invalid conversion from 'int' to 'int (*)()' [-fpermissive]
65 | dijkstra(t-1);
| ~^~
| |
| int
a.cc:19:11: note: initializing argument 1 of 'void dijkstra(int (*)())'
19 | #define s size()
| ^
a.cc:27:19: note: in expansion of macro 's'
27 | void dijkstra(int s){
| ^
|
s918600127 | p00485 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define s size()
#define INF 100000000
int cost[3005][3005];
int d[3005];
int maxi[100005]={};
bool used[3005]={};
P1 ii[100005];
int V;
void dijkstra(int os){
fill(d,d+V,INF);
d[s]=0;
while(1){
int v=-1;
for(int u=0;u<V;u++){
if(!used[u] && (v==-1 || d[u]<d[v])){
v=u;
}
}
if(v==-1){
break;
}
used[v]=true;
for(int i=0;i<V;i++){
d[i]=min(d[i],d[v]+cost[v][i]);
}
}
}
int n,m,k;
int main(){
scanf("%d %d %d",&n,&m,&k);
for(int i=0;i<3005;i++){
for(int j=0;j<3005;j++){
cost[i][j]=INF;
}
}
for(int i=0;i<m;i++){
int w,ww,eu;
scanf("%d %d %d",&w,&ww,&eu);
ii[i]=mp(eu,mp(w,ww));
cost[w-1][ww-1]=eu;
cost[ww-1][w-1]=eu;
}
int res=0;
for(int i=0;i<k;i++){
int t;
scanf("%d",&t);
dijkstra(t-1);
memset(used,0,sizeof(used));
for(int j=0;j<m;j++){
maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
}
}
for(int j=0;j<m;j++){
res=max(res,maxi[j]);
}
printf("%d\n",res);
return 0;
} | a.cc: In function 'void dijkstra(int)':
a.cc:19:15: error: no matching function for call to 'size()'
19 | #define s size()
| ~~~~^~
a.cc:29:11: note: in expansion of macro 's'
29 | d[s]=0;
| ^
In file included from /usr/include/c++/14/string:53,
from a.cc:5:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
|
s479004118 | p00485 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define s size()
#define INF 100000000
int cost[3005][3005];
int d[3005];
int maxi[100005]={};
bool used[3005]={};
P1 ii[100005];
int V;
void dijkstra(int os){
fill(d,d+V,INF);
d[s]=0;
while(1){
int v=-1;
for(int u=0;u<V;u++){
if(!used[u] && (v==-1 || d[u]<d[v])){
v=u;
}
}
if(v==-1){
break;
}
used[v]=true;
for(int i=0;i<V;i++){
d[i]=min(d[i],d[v]+cost[v][i]);
}
}
}
int n,m,k;
int main(){
scanf("%d %d %d",&n,&m,&k);
for(int i=0;i<3005;i++){
for(int j=0;j<3005;j++){
cost[i][j]=INF;
}
}
for(int i=0;i<m;i++){
int w,ww,eu;
scanf("%d %d %d",&w,&ww,&eu);
ii[i]=mp(eu,mp(w,ww));
cost[w-1][ww-1]=eu;
cost[ww-1][w-1]=eu;
}
int res=0;
for(int i=0;i<k;i++){
int t;
scanf("%d",&t);
dijkstra(t-1);
memset(used,0,sizeof(used));
for(int j=0;j<m;j++){
maxi[j]=max(maxi[j],(ii[j].first+d[ii[j].second.first-1]+d[ii[j].second.second-1]+1)/2);
}
}
for(int j=0;j<m;j++){
res=max(res,maxi[j]);
}
printf("%d\n",res);
return 0;
} | a.cc: In function 'void dijkstra(int)':
a.cc:19:15: error: no matching function for call to 'size()'
19 | #define s size()
| ~~~~^~
a.cc:29:11: note: in expansion of macro 's'
29 | d[s]=0;
| ^
In file included from /usr/include/c++/14/string:53,
from a.cc:5:
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
|
s331771768 | p00485 | C++ | #include "stdio.h"
#include "stdlib.h"
#include <iostream>
#include <algorithm>
using namespace std;
int mati[3000];
int matis[3000];
int miti[100000][2];
int miti2[3000][3000];
int matiw[3000];
int main()
{
int n,m,k;
{
scanf("%d %d %d",&n,&m,&k);
}
{
for(int i = 0; i < 3000; i++)
{
for(int ii = 0; ii < 3000; ii++)
{
miti2[i][ii] = -1;
}
}
}
{
for(int i = 0; i < m; i++)
{
int w1,w2,w3;
scanf("%d %d %d",&w1,&w2,&w3);
miti[i][0] = w1 - 1;
miti[i][1] = w2 - 1;
miti2[w1 - 1][w2 - 1] = w3;
miti2[w2 - 1][w1 - 1] = w3;
}
}
{
for(int i = 0; i < n; i++)
{
mati[i] = INT_MAX;
matis[i] = 0;
}
}
{
int w;
for(int i = 0; i < k; i++)
{
scanf("%d",&w);
mati[w - 1] = 0;
}
}
{
for(int i = 0; i < n; i++)
{
for(int ii = 0; ii < n; ii++)
{
if(matis[ii] == 0)
{
matiw[ii] = mati[ii];
}
else
{
matiw[ii] = INT_MAX;
}
}
sort(matiw,matiw + n);
for(int ii = 0; ii < n; ii++)
{
if(mati[ii] == matiw[0] && matis[ii] == 0)
{
for(int iii = 0; iii < n; iii++)
{
if(miti2[ii][iii] != -1)
{
if(mati[iii] > mati[ii] + miti2[ii][iii])
{
mati[iii] = mati[ii] + miti2[ii][iii];
}
}
}
matis[ii] = 1;
break;
}
}
}
}
int l = 0;
{
int w,w1,w2;
for(int i = 0; i < m; i++)
{
w1 = miti[i][0];
w2 = miti[i][1];
if(mati[w1] == mati[w2] + miti2[w1][w2])
{
w = mati[w1];
}
else if(mati[w2] == mati[w1] + miti2[w1][w2])
{
w = mati[w2];
}
else
{
w = (mati[w1] + mati[w2] + miti2[w1][w2] - 1) / 2 + 1;
}
if(l < w)
{
l = w;
}
}
}
printf("%d\n",l);
return 0;
} | a.cc: In function 'int main()':
a.cc:46:35: error: 'INT_MAX' was not declared in this scope
46 | mati[i] = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <algorithm>
+++ |+#include <climits>
5 | using namespace std;
a.cc:71:53: error: 'INT_MAX' was not declared in this scope
71 | matiw[ii] = INT_MAX;
| ^~~~~~~
a.cc:71:53: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s951161391 | p00485 | C++ | #include <iostream>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main() {
int N,M,K;
vector<pair<int,int> >nGo[3001];
deque<int> dis;
int dist[3001];
int road[3000][3];
for(int i=1;i<=3000;i++)
dist[i]=(1 << 30 );
cin >> N >> M >> K;
int a,b,c;
for(int i=0;i<M;i++){
cin >> a >> b >> c;
nGo[a].push_back(pair<int,int>(b,c));
nGo[b].push_back(pair<int,int>(a,c));
road[i][0]=a;
road[i][1]=b;
road[i][2]=c;
}
for(int i=0;i<K;i++){
cin >> a;
// dis.insert(multimap<int,int>::value_type(0,a));
dis.push_back(a);
dist[a]=0;
}
while(!dis.empty()){
sort(dis.begin(),dis.end());
int now=dis[0];
for(int i=0;i<nGo[now].size();i++){
if(dist[nGo[now][i].first]>dist[now]+nGo[now][i].second){
dis.push_back(nGo[now][i].first);
dist[nGo[now][i].first]=dist[now]+nGo[now][i].second;
}
}
dis.pop_front();
}
int maxer=0;
for(int i=0;i<M;i++)
maxer=max(maxer,(int)(dist[road[i][0]]+dist[road[i][1]]+road[i][2]+0.5)/2);
for(int i=1;i<=N;i++)
maxer=max(maxer,dist[i]);
cout << maxer << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
9 | vector<pair<int,int> >nGo[3001];
| ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
4 | #include <deque>
+++ |+#include <vector>
5 | using namespace std;
a.cc:9:30: error: expected primary-expression before '>' token
9 | vector<pair<int,int> >nGo[3001];
| ^
a.cc:9:31: error: 'nGo' was not declared in this scope
9 | vector<pair<int,int> >nGo[3001];
| ^~~
|
s695092446 | p00485 | C++ | #include <iostream>
#include <map>
#include <algorithm>
#include <deque>
#include <vector>
using namespace std;
int main() {
int N,M,K;#include <iostream>
#include <map>
#include <algorithm>
#include <deque>
#include <vector>
using namespace std;
int main() {
int N,M,K;
vector<pair<int,int> >nGo[3001];
deque<int> dis;
int dist[3001];
int road[3000][3];
for(int i=1;i<=3000;i++)
dist[i]=(1 << 30 );
cin >> N >> M >> K;
int a,b,c;
for(int i=0;i<M;i++){
cin >> a >> b >> c;
nGo[a].push_back(pair<int,int>(b,c));
nGo[b].push_back(pair<int,int>(a,c));
road[i][0]=a;
road[i][1]=b;
road[i][2]=c;
}
for(int i=0;i<K;i++){
cin >> a;
// dis.insert(multimap<int,int>::value_type(0,a));
dis.push_back(a);
dist[a]=0;
}
while(!dis.empty()){
sort(dis.begin(),dis.end());
int now=dis[0];
for(int i=0;i<nGo[now].size();i++){
if(dist[nGo[now][i].first]>dist[now]+nGo[now][i].second){
dis.push_back(nGo[now][i].first);
dist[nGo[now][i].first]=dist[now]+nGo[now][i].second;
}
}
dis.pop_front();
}
int maxer=0;
for(int i=0;i<M;i++)
maxer=max(maxer,(int)(dist[road[i][0]]+dist[road[i][1]]+road[i][2]+1)/2);
for(int i=1;i<=N;i++)
maxer=max(maxer,dist[i]);
cout << maxer << endl;
return 0;
}
vector<pair<int,int> >nGo[3001];
deque<int> dis;
int dist[3001];
int road[3000][3];
for(int i=1;i<=3000;i++)
dist[i]=(1 << 30 );
cin >> N >> M >> K;
int a,b,c;
for(int i=0;i<M;i++){
cin >> a >> b >> c;
nGo[a].push_back(pair<int,int>(b,c));
nGo[b].push_back(pair<int,int>(a,c));
road[i][0]=a;
road[i][1]=b;
road[i][2]=c;
}
for(int i=0;i<K;i++){
cin >> a;
// dis.insert(multimap<int,int>::value_type(0,a));
dis.push_back(a);
dist[a]=0;
}
while(!dis.empty()){
sort(dis.begin(),dis.end());
int now=dis[0];
for(int i=0;i<nGo[now].size();i++){
if(dist[nGo[now][i].first]>dist[now]+nGo[now][i].second){
dis.push_back(nGo[now][i].first);
dist[nGo[now][i].first]=dist[now]+nGo[now][i].second;
}
}
dis.pop_front();
}
int maxer=0;
for(int i=0;i<M;i++)
maxer=max(maxer,(int)(dist[road[i][0]]+dist[road[i][1]]+road[i][2]+0.5)/2);
for(int i=1;i<=N;i++)
maxer=max(maxer,dist[i]);
cout << maxer << endl;
return 0;
} | a.cc:9:19: error: stray '#' in program
9 | int N,M,K;#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:9:20: error: 'include' was not declared in this scope
9 | int N,M,K;#include <iostream>
| ^~~~~~~
a.cc:9:37: error: expected primary-expression before '>' token
9 | int N,M,K;#include <iostream>
| ^
a.cc:14:1: error: expected primary-expression before 'using'
14 | using namespace std;
| ^~~~~
a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
16 | int main() {
| ^~
a.cc:16:9: note: remove parentheses to default-initialize a variable
16 | int main() {
| ^~
| --
a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:16:12: error: a function-definition is not allowed here before '{' token
16 | int main() {
| ^
|
s333334637 | p00486 | C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
typedef __int64 ll;
int max;
ll dist(int x1, int y1, int x2, int y2)
{
if (abs(x2 - x1) + abs(y2 - y1) > max){
max = abs(x2 - x1) + abs(y2 - y1);
}
return (2 * (abs(x2 - x1) + abs(y2 - y1)));
}
int comp(const void *a, const void * b)
{
int x, y;
x = *(int *)a;
y = *(int *)b;
return (x - y);
}
int main(void)
{
static int hx[100000], hy[100000];
static int mx[100000], my[100000];
int i;
int w, h, n;
int pivx, pivy;
ll res;
scanf("%d%d", &w, &h);
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d%d", &hx[i], &hy[i]);
}
memcpy(my, hy, sizeof(hy));
memcpy(mx, hx, sizeof(hx));
qsort(hx, n, sizeof(int), comp);
qsort(hy, n, sizeof(int), comp);
pivx = hx[(n - 1) / 2];
pivy = hy[(n - 1) / 2];
res = 0;
for (i = 0; i < n; i++){
res += dist(pivx, pivy, mx[i], my[i]);
}
res -= max;
printf("%I64d\n%d %d\n", res, pivx, pivy);
return (0);
} | main.c:6:9: error: unknown type name '__int64'; did you mean '__int64_t'?
6 | typedef __int64 ll;
| ^~~~~~~
| __int64_t
|
s036285163 | p00486 | C++ | #include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
long long h, w, n, x[1000000], y[1000000], ex[1000000], ey[1000000], sum, d[1000000], bx, by;
long long sx[1000000], sy[1000000], sumx, sumy, mn, dx = 1145141145141919810LL, dy = 1145141145141919810LL, cx, cy, minx = 1145141145141919810LL;
vector<int>mx, my;
long long hx, hy, fx, fy;
int main() {
cin >> h >> w >> n;
x[0] = 0; y[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
sumx += x[i];
sumy += y[i];
ex[i] = x[i];
ey[i] = y[i];
}
sort(x + 1, x + n + 1);
sort(y + 1, y + n + 1);
for (int i = 1; i <= n; i++) {
sumx += (-n - 2 + i * 2)*(x[i] - x[i - 1]);
sx[i] = sumx;
}
for (int i = 1; i <= n; i++) {
sumy += (-n - 2 + i * 2)*(y[i] - y[i - 1]);
sy[i] = sumy;
}
for (int i = 1; i <= n; i++) {
if (dx > sx[i]) { dx = sx[i]; mx.clear(); mx.push_back(x[i]); }
if (dx == sx[i]) { mx.push_back(x[i]); }
}
for (int i = 1; i <= n; i++) {
if (dy > sy[i]) { dy = sy[i]; my.clear(); my.push_back(y[i]); }
if (dy == sy[i]) { my.push_back(y[i]); }
}
for (int i = 0; i < mx.size(); i++) {
if (i == 0) { fx++; }
if (i >= 1) { if (mx[i] == mx[i - 1]) { fx++; } }
if (fx > hx) { hx = fx; cx = mx[i]; }
}
for (int i = 0; i < my.size; i++) {
if (i == 0) { fy++; }
if (i >= 1) { if (my[i] == my[i - 1]) { fy++; } }
if (fy > hy) { hy = fy; cy = my[i]; }
}
for (int i = 1; i <= n; i++) {
d[i] = abs(ex[i] - cx) + abs(ey[i] - cy);
sum += d[i] * 2;
}
sort(d, d + n);
sum -= d[n - 1];
cout << sum << endl << cx << ' ' << cy << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:46:32: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
46 | for (int i = 0; i < my.size; i++) {
| ~~~^~~~
| ()
|
s712964195 | p00486 | C++ | #include <vector>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int H, W, N, A, B;
long long LX, LY, RX, RY; // rotate
vector<int> X;
vector<int> Y;
vector<int> EX; // sorted X
vector<int> EY; // sorted Y
vector<int> UX; // unique X
vector<int> UY; // unique Y
vector<long long> DX; // distance sum from UX
vector<long long> DY; // distance sum from UY
int main()
{
// ------ Input ------ //
scanf("%d", &W);
scanf("%d", &H);
scanf("%d", &N);
X = vector<long long>(N);
Y = vector<long long>(N);
for (int i = 0; i < N; i++)
{
scanf("%d", &X[i]);
scanf("%d", &Y[i]);
}
// ------ Sort & Unique ------ //
EX = X;
EY = Y;
sort(EX.begin(), EX.end()); UX.push_back(EX[0]);
sort(EY.begin(), EY.end()); UY.push_back(EY[0]);
for (int i = 1; i < N; i++)
{
if (EX[i] != EX[i - 1])
{
UX.push_back(EX[i]);
}
if (EY[i] != EY[i - 1])
{
UY.push_back(EY[i]);
}
}
A = UX.size();
B = UY.size();
// ------ Rotate ------ //
LX = 999999999999999999LL;
LY = 999999999999999999LL;
RX = -999999999999999999LL;
RY = -999999999999999999LL;
for (int i = 0; i < N; i++)
{
long long tx = X[i] + Y[i];
long long ty = X[i] - Y[i];
LX = min(LX, tx);
LY = min(LY, ty);
RX = max(RX, tx);
RY = max(RY, ty);
}
// ------ Distance Calculation ------ //
for (int i = 0; i < A; i++)
{
long long sum = 0;
for (int j = 0; j < N; j++)
{
sum += abs(UX[i] - X[j]);
}
DX.push_back(sum);
}
for (int i = 0; i < B; i++)
{
long long sum = 0;
for (int j = 0; j < N; j++)
{
sum += abs(UY[i] - Y[j]);
}
DY.push_back(sum);
}
// ------ Calculate ------ //
long long ret = 999999999999999999LL;
int x = -1, y = -1, pl = 0, pr = B, l, r;
for (int i = 0; i < A; i++)
{
long long res = 999999999999999999LL;
for (int j = pl; j < pr; j++)
{
long long rx = UX[i] + UY[j];
long long ry = UX[i] - UY[j];
long long maxs = max(max(rx - LX, RX - rx), max(ry - LY, RY - ry));
long long sum = 2LL * (DX[i] + DY[j]) - maxs;
if (sum < res)
{
res = sum;
l = j;
r = j + 1;
if (sum < ret)
{
x = UX[i];
y = UY[j];
}
}
else if (sum == res)
{
r++;
}
}
pl = max(l - 1, 0);
pr = min(r + 1, B);
ret = min(ret, res);
}
// ------ Output ------ //
printf("%lld\n", ret);
printf("%d %d\n", x, y);
return 0;
} | a.cc: In function 'int main()':
a.cc:31:32: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>')
31 | X = vector<long long>(N);
| ^
In file included from /usr/include/c++/14/vector:72,
from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:32:32: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>')
32 | Y = vector<long long>(N);
| ^
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
|
s008655453 | p00486 | C++ | #include<bits/stdc++.h>
#define int long long
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
using namespace std;
static const int INF = 1ll<<60;
typedef pair<int,int> pii;
struct P{
int x;
int y;
p(){};
P(int p1,int p2){
x=p1;
y=p2;
}
};
int W,H;
int N;
int dis[100010];
vector<int> posx;
vector<int> posy;
vector<P> pos;
int dist(int x,int y){
int res=0;
for(int i=0;i<N;++i){
int disx=abs(x-pos[i].x);
int disy=abs(y-pos[i].y);
dis[i]=disx+disy;
}
sort(dis,dis+N);
for(int i=0;i<N-1;++i)res+=dis[i]*2;
res+=dis[N-1];
return res;
}
signed main(){
cin>>W>>H;
cin>>N;
for(int i=0;i<N;++i){
int x,y;
cin>>x>>y;
posx.PB(x);
posy.PB(y);
pos.PB(P(x,y));
}
if(N%2!=0){
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int x=posx[N/2];
int y=posy[N/2];
int ans=dist(x,y);
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
else{
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int ans=INF;
int x,y;
int d1=dist(posx[N/2-1],posy[N/2-1]);
int d2=dist(posx[N/2-1],posy[N/2]);
int d3=dist(posx[N/2],posy[N/2-1]);
int d4=dist(posx[N/2],posy[N/2]);
if(ans>d1){
ans=d1;
x=posx[N/2-1];
y=posy[N/2-1];
}
if(ans>d2){
ans=d2;
x=posx[N/2-1];
y=posy[N/2];
}
if(ans>d3){
ans=d3;
x=posx[N/2];
y=posy[N/2-1];
}
if(ans>d4){
ans=d4;
x=posx[N/2];
y=posy[N/2];
}
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
} | a.cc:14:5: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
14 | p(){};
| ^
a.cc: In member function 'int P::p()':
a.cc:14:9: warning: no return statement in function returning non-void [-Wreturn-type]
14 | p(){};
| ^
|
s848169609 | p00486 | C++ | #include<bits/stdc++.h>
#define int long long
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
using namespace std;
static const int INF = 1ll<<60;
typedef pair<int,int> pii;
struct P{
int x;
int y;
p(){};
P(int p1,int p2){
x=p1;
y=p2;
}
};
int W,H;
int N;
int dis[100010];
vector<int> posx;
vector<int> posy;
vector<P> pos;
int dist(int x,int y){
int res=0;
for(int i=0;i<N;++i){
int disx=abs(x-pos[i].x);
int disy=abs(y-pos[i].y);
dis[i]=disx+disy;
}
sort(dis,dis+N);
for(int i=0;i<N-1;++i)res+=dis[i]*2;
res+=dis[N-1];
return res;
}
signed main(){
cin>>W>>H;
cin>>N;
for(int i=0;i<N;++i){
int x,y;
cin>>x>>y;
posx.PB(x);
posy.PB(y);
pos.PB(P(x,y));
}
if(N%2!=0){
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int x=posx[N/2];
int y=posy[N/2];
int ans=dist(x,y);
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
else{
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int ans=INF;
int x,y;
int d1=dist(posx[N/2-1],posy[N/2-1]);
int d2=dist(posx[N/2-1],posy[N/2]);
int d3=dist(posx[N/2],posy[N/2-1]);
int d4=dist(posx[N/2],posy[N/2]);
if(ans>d1){
ans=d1;
x=posx[N/2-1];
y=posy[N/2-1];
}
if(ans>d2){
ans=d2;
x=posx[N/2-1];
y=posy[N/2];
}
if(ans>d3){
ans=d3;
x=posx[N/2];
y=posy[N/2-1];
}
if(ans>d4){
ans=d4;
x=posx[N/2];
y=posy[N/2];
}
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
} | a.cc:14:5: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
14 | p(){};
| ^
a.cc: In member function 'int P::p()':
a.cc:14:9: warning: no return statement in function returning non-void [-Wreturn-type]
14 | p(){};
| ^
|
s971680365 | p00486 | C++ | #include<bits/stdc++.h>
#define int long long
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
using namespace std;
static const int INF = 1ll<<60;
typedef pair<int,int> pii;
struct P{
int x;
int y;
p(){}
P(int p1,int p2){
x=p1;
y=p2;
}
};
int W,H;
int N;
int dis[100010];
vector<int> posx;
vector<int> posy;
vector<P> pos;
int dist(int x,int y){
int res=0;
for(int i=0;i<N;++i){
int disx=abs(x-pos[i].x);
int disy=abs(y-pos[i].y);
dis[i]=disx+disy;
}
sort(dis,dis+N);
for(int i=0;i<N-1;++i)res+=dis[i]*2;
res+=dis[N-1];
return res;
}
signed main(){
cin>>W>>H;
cin>>N;
for(int i=0;i<N;++i){
int x,y;
cin>>x>>y;
posx.PB(x);
posy.PB(y);
pos.PB(P(x,y));
}
if(N%2!=0){
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int x=posx[N/2];
int y=posy[N/2];
int ans=dist(x,y);
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
else{
sort(posx.begin(),posx.end());
sort(posy.begin(),posy.end());
int ans=INF;
int x,y;
int d1=dist(posx[N/2-1],posy[N/2-1]);
int d2=dist(posx[N/2-1],posy[N/2]);
int d3=dist(posx[N/2],posy[N/2-1]);
int d4=dist(posx[N/2],posy[N/2]);
if(ans>d1){
ans=d1;
x=posx[N/2-1];
y=posy[N/2-1];
}
if(ans>d2){
ans=d2;
x=posx[N/2-1];
y=posy[N/2];
}
if(ans>d3){
ans=d3;
x=posx[N/2];
y=posy[N/2-1];
}
if(ans>d4){
ans=d4;
x=posx[N/2];
y=posy[N/2];
}
cout<<ans<<endl;
cout<<x<<" "<<y<<endl;
}
} | a.cc:14:5: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
14 | p(){}
| ^
a.cc: In member function 'int P::p()':
a.cc:14:9: warning: no return statement in function returning non-void [-Wreturn-type]
14 | p(){}
| ^
|
s541861986 | p00486 | C++ |
using namespace std;
#define int long long
#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}
const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;
int X[100010];
int Y[100010];
pii pos[100010];
int v[100010];
signed main()
{ // #define int long long ?????????????????§scanf???????????¨???????????????????????\?????????????????????
int W, H; cin >> W >> H;
int N; cin >> N;
rep(i, N) {
cin >> X[i];
cin >> Y[i];
pos[i] = pii(X[i], Y[i]);
}
sort(X, X + N);
sort(Y, Y + N);
int x, y;
if (N % 2 == 0) {
int ans = inf;
int ansx = -1, ansy = -1;
rep(i, 2) {
rep(j, 2) {
int x = X[N / 2 - i], y = Y[N / 2 - j];
int sum = 0;
int ma = 0;
rep(k, N) {
int a = abs(x - pos[k].fst) + abs(y - pos[k].scd);
sum += a * 2;
chmax(ma, a);
}
sum -= ma;
if (ans >= sum) {
ans = sum;
ansx = x;
ansy = y;
}
}
}
cout << ans << endl;
cout << ansx << ' ' << ansy << endl;
} else {
x = y = N / 2;
int ma = 0;
int v = 0;
rep(i, N) {
int a = abs(x - pos[i].fst) + abs(y - pos[i].scd);
v += a * 2;
ma = max(ma, a);
}
v -= ma;
cout << v << endl;
cout << x << ' ' << y << endl;
}
} | a.cc:18:9: error: 'vector' does not name a type
18 | typedef vector<int> vi;
| ^~~~~~
a.cc:19:9: error: 'vector' does not name a type
19 | typedef vector<vi> vvi;
| ^~~~~~
a.cc:20:9: error: 'pair' does not name a type
20 | typedef pair<int, int> pii;
| ^~~~
a.cc:21:9: error: 'vector' does not name a type
21 | typedef vector<pii> vpii;
| ^~~~~~
a.cc: In function 'T get()':
a.cc:27:33: error: 'cin' was not declared in this scope
27 | template<typename T>T get(){T a;cin>>a;return a;}
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 |
a.cc: At global scope:
a.cc:29:21: error: 'vector' does not name a type
29 | template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}
| ^~~~~~
a.cc:37:1: error: 'pii' does not name a type
37 | pii pos[100010];
| ^~~
a.cc: In function 'int main()':
a.cc:42:15: error: 'cin' was not declared in this scope
42 | int W, H; cin >> W >> H;
| ^~~
a.cc:42:15: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:49:9: error: 'pos' was not declared in this scope
49 | pos[i] = pii(X[i], Y[i]);
| ^~~
a.cc:49:18: error: 'pii' was not declared in this scope
49 | pos[i] = pii(X[i], Y[i]);
| ^~~
a.cc:52:5: error: 'sort' was not declared in this scope; did you mean 'short'?
52 | sort(X, X + N);
| ^~~~
| short
a.cc:68:37: error: 'pos' was not declared in this scope
68 | int a = abs(x - pos[k].fst) + abs(y - pos[k].scd);
| ^~~
a.cc:68:29: error: 'abs' was not declared in this scope; did you mean 'ans'?
68 | int a = abs(x - pos[k].fst) + abs(y - pos[k].scd);
| ^~~
| ans
a.cc:82:9: error: 'cout' was not declared in this scope
82 | cout << ans << endl;
| ^~~~
a.cc:82:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:82:24: error: 'endl' was not declared in this scope
82 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 |
a.cc:91:29: error: 'pos' was not declared in this scope
91 | int a = abs(x - pos[i].fst) + abs(y - pos[i].scd);
| ^~~
a.cc:91:21: error: 'abs' was not declared in this scope
91 | int a = abs(x - pos[i].fst) + abs(y - pos[i].scd);
| ^~~
a.cc:97:9: error: 'cout' was not declared in this scope
97 | cout << v << endl;
| ^~~~
a.cc:97:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:97:22: error: 'endl' was not declared in this scope
97 | cout << v << endl;
| ^~~~
a.cc:97:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
|
s250180929 | p00486 | C++ | #include<cstdio>
#include<cstdlib>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000;
int main(){
int w,h,n;
scanf("%d%d%d",&w,&h,&n);
int x[n],y[n],sx[n],sy[n];
for(int i=0;i<n;i++){
scanf("%d%d",x+i,y+i);
sx[i] = x[i], sy[i] = y[i];
}
sort(sx,sx+n);
sort(sy,sy+n);
int xx[] = {sx[(n-1)/2],sx[(n-1)/2+1]};
int yy[] = {sy[(n-1)/2],sy[(n-1)/2+1]};
ll ans = INF;
int x,y;
for(int jugontyan=0;jugontyan<2;jugontyan++){
int dekai = 0;
ll t = 0;
int px = xx[jugontyan], py = yy[jugontyan];
for(int i=0;i<n;i++){
if(dekai<abs(x[i]-px)+abs(y[i]-py)) dekai = abs(x[i]-px) + abs(y[i]-py);
t += abs(x[i]-px) + abs(y[i]-py);
}
t = t * 2 - dekai;
if(ans<t){
ans = t;
x = px, y = py;
}
}
printf("%lld\n%d %d\n",ans,x,y);
return 0;
} | a.cc: In function 'int main()':
a.cc:24:7: error: conflicting declaration 'int x'
24 | int x,y;
| ^
a.cc:14:7: note: previous declaration as 'int x [n]'
14 | int x[n],y[n],sx[n],sy[n];
| ^
a.cc:24:9: error: conflicting declaration 'int y'
24 | int x,y;
| ^
a.cc:14:12: note: previous declaration as 'int y [n]'
14 | int x[n],y[n],sx[n],sy[n];
| ^
a.cc:36:9: error: incompatible types in assignment of 'int' to 'int [n]'
36 | x = px, y = py;
| ~~^~~~
a.cc:36:17: error: incompatible types in assignment of 'int' to 'int [n]'
36 | x = px, y = py;
| ~~^~~~
|
s045653583 | p00486 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<string.h>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<deque>
#include<string>
#include<stack>
#define int long long
#define P pair<int,int>
using namespace std;
P a[100000];
int b[100000], c[100000];
int dis = LLONG_MAX;
P ans = { LLONG_MAX,LLONG_MAX };
P w;//x??§?¨???????
P x;//x??§?¨?????????¢
P y;//y??§?¨???????
P z;//y??§?¨?????????¢
signed main() {
int n; cin >> n >> n >> n;
for (int i = 0; i < n; i++) {
cin >> a[i].first >> a[i].second;
b[i] = a[i].first, c[i] = a[i].second;
}
sort(b, b + n); sort(c, c + n);
if (n & 1) {
w.first = b[n / 2];
int k = 0;
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2]) * 2;
}
x.first = k;
k = 0;
y.first = c[n / 2];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2]) * 2;
}
z.first = k;
}
else {
w.first = b[n / 2];
int k = 0;
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2]) * 2;
}
x.first = k;
k = 0;
w.second = b[n / 2 - 1];
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2 - 1]) * 2;
}
x.second = k;
k = 0;
y.first = c[n / 2];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2]) * 2;
}
z.first = k;
k = 0;
y.second = c[n / 2 - 1];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2 - 1]) * 2;
}
z.second = k;
}
for (int i = 0; i < n; i++) {
b[i] = a[i].first, c[i] = a[i].second;
}
for (int i = 0; i < n; i++) {//i???????????????
int l = x.first - abs(w.first - b[i]);
if (n % 2 == 0)l = min(l, x.second - abs(w.second - b[i]));
int r = z.first - abs(y.first - c[i]);
if (n % 2 == 0)r = min(r, z.second - abs(y.second - c[i]));
dis = min(dis, l + r);
}
for (int i = 0; i < n; i++) {//i???????????????
int l = x.first - abs(w.first - b[i]);
if (n % 2 == 0)l = min(l, x.second - abs(w.second - b[i]));
int r = z.first - abs(y.first - c[i]);
if (n % 2 == 0)r = min(r, z.second - abs(y.second - c[i]));
if (dis == l + r) {
if (n % 2 == 0 && x.first - abs(w.first - b[i])!=l) {
ans.first = min(ans.first, w.second);
}
else {
ans.first = min(ans.first, w.first);
}
if (n % 2 == 0 && z.first - abs(y.first - c[i]) != r) {
ans.second = min(ans.second, y.second);
}
else {
ans.second = min(ans.second, y.first);
}
}
}
cout << dis << endl;
cout << ans.first << " " << ans.second << endl;
} | a.cc:22:11: error: 'LLONG_MAX' was not declared in this scope
22 | int dis = LLONG_MAX;
| ^~~~~~~~~
a.cc:16:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include<stack>
+++ |+#include <climits>
16 | #define int long long
a.cc:23:11: error: 'LLONG_MAX' was not declared in this scope
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^~~~~~~~~
a.cc:23:11: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:23:21: error: 'LLONG_MAX' was not declared in this scope
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^~~~~~~~~
a.cc:23:21: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:23:31: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<long long int, long long int>'
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^
| |
| <brace-enclosed initializer list>
|
s590544861 | p00486 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<string.h>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<deque>
#include<string>
#include<stack>
#define int long long
#define P pair<int,int>
using namespace std;
P a[100000];
int b[100000], c[100000];
int dis = LLONG_MAX;
P ans = { LLONG_MAX,LLONG_MAX };
P w;//x??§?¨???????
P x;//x??§?¨?????????¢
P y;//y??§?¨???????
P z;//y??§?¨?????????¢
signed main() {
int n; cin >> n >> n >> n;
for (int i = 0; i < n; i++) {
cin >> a[i].first >> a[i].second;
b[i] = a[i].first, c[i] = a[i].second;
}
sort(b, b + n); sort(c, c + n);
if (n & 1) {
w.first = b[n / 2];
int k = 0;
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2]) * 2;
}
x.first = k;
k = 0;
y.first = c[n / 2];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2]) * 2;
}
z.first = k;
}
else {
w.first = b[n / 2];
int k = 0;
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2]) * 2;
}
x.first = k;
k = 0;
w.second = b[n / 2 - 1];
for (int i = 0; i < n; i++) {
k += abs(b[i] - b[n / 2 - 1]) * 2;
}
x.second = k;
k = 0;
y.first = c[n / 2];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2]) * 2;
}
z.first = k;
k = 0;
y.second = c[n / 2 - 1];
for (int i = 0; i < n; i++) {
k += abs(c[i] - c[n / 2 - 1]) * 2;
}
z.second = k;
}
for (int i = 0; i < n; i++) {
b[i] = a[i].first, c[i] = a[i].second;
}
for (int i = 0; i < n; i++) {//i???????????????
int l = x.first - abs(w.first - b[i]);
if (n % 2 == 0)l = min(l, x.second - abs(w.second - b[i]));
int r = z.first - abs(y.first - c[i]);
if (n % 2 == 0)r = min(r, z.second - abs(y.second - c[i]));
dis = min(dis, l + r);
}
for (int i = 0; i < n; i++) {//i???????????????
int l = x.first - abs(w.first - b[i]);
if (n % 2 == 0)l = min(l, x.second - abs(w.second - b[i]));
int r = z.first - abs(y.first - c[i]);
if (n % 2 == 0)r = min(r, z.second - abs(y.second - c[i]));
if (dis == l + r) {
if (n % 2 == 0 && x.first - abs(w.first - b[i])!=l) {
ans.first = min(ans.first, w.second);
}
else {
ans.first = min(ans.first, w.first);
}
if (n % 2 == 0 && z.first - abs(y.first - c[i]) != r) {
ans.second = min(ans.second, y.second);
}
else {
ans.second = min(ans.second, y.first);
}
}
}
cout << dis << endl;
cout << ans.first << " " << ans.second << endl;
} | a.cc:22:11: error: 'LLONG_MAX' was not declared in this scope
22 | int dis = LLONG_MAX;
| ^~~~~~~~~
a.cc:16:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include<stack>
+++ |+#include <climits>
16 | #define int long long
a.cc:23:11: error: 'LLONG_MAX' was not declared in this scope
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^~~~~~~~~
a.cc:23:11: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:23:21: error: 'LLONG_MAX' was not declared in this scope
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^~~~~~~~~
a.cc:23:21: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:23:31: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<long long int, long long int>'
23 | P ans = { LLONG_MAX,LLONG_MAX };
| ^
| |
| <brace-enclosed initializer list>
|
s570633314 | p00486 | C++ | #include <cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#define MAX_H 1000000000 //10^9
#define MAX_W 1000000000 //10^9
#define MAX_N 100000 //10^5
#define mp make_pair
#define INF 1001001001
#define LLINF 1001001001001001001
#define llint long long int
#define ppp pair<int, pair<int,int> >
using namespace std;
#define rep(i,n) for(int i=0; i<n ; i++)
using namespace std;
llint homesx[MAX_N];
llint homesy[MAX_N];
llint homesxs[MAX_N];
llint homesys[MAX_N];
int main(void){
// Your code here!
llint W,H,N;
scanf("%lld %lld %lld",&W,&H,&N);
rep(i,N){
llint X,Y;
scanf("%lld %lld",&X,&Y);X--;Y--;
homesx[i]=X;homesy[i]=Y;
homesxs[i]=X;homesys[i]=Y;
}
//X座標について求める
if(N==1){printf("%lld\n%lld %lld",0,homesx[0],homesy[0]);return 0;}
llint ans=LLINF;
llint zans[2]={-1,-1};
sort(&homesxs[0], &homesxs[N]);
sort(&homesys[0], &homesys[N]);
llint Center1=(llint)(N/2)-1;
llint Center2=(llint)(N/2);
llint sum=0;llint maxl=0;
rep(i,N){
llint leng=abs(homesx[i]-homesxs[Center1]) + abs(homesy[i]-homesys[Center1]);
sum+=2*leng;
maxl=max(leng,maxl);
}
if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center1];zans[1]=homesys[Center1];}
sum=0;maxl=0;
rep(i,N){
llint leng=abs(homesx[i]-homesxs[Center1]) + abs(homesy[i]-homesys[Center2]);
sum+=2*leng;
maxl=max(leng,maxl);
}
if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center1];zans[1]=homesys[Center2];}
sum=0;maxl=0;
rep(i,N){
llint leng=abs(homesx[i]-homesxs[Center2]) + abs(homesy[i]-homesys[Center1]);
sum+=2*leng;
maxl=max(leng,maxl);
}
if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center2];zans[1]=homesys[Center1];}
sum=0;maxl=0;
rep(i,N){
llint leng=abs(homesx[i]-homesxs[Center2]) + abs(homesy[i]-homesys[Center2]);
sum+=2*leng;
maxl=max(leng,maxl);
}
if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center2];zans[1]=homesys[Center2];}
printf("%lld\n%lld %lld\n",ans,zans[0]+1,zans[1]+1);
}
| a.cc:38:5: error: extended character is not valid in an identifier
38 | llint Center1=(llint)(N/2)-1;
| ^
a.cc:39:5: error: extended character is not valid in an identifier
39 | llint Center2=(llint)(N/2);
| ^
a.cc: In function 'int main()':
a.cc:38:5: error: 'llint\U00003000Center1' was not declared in this scope
38 | llint Center1=(llint)(N/2)-1;
| ^~~~~~~~~~~~~~
a.cc:39:5: error: 'llint\U00003000Center2' was not declared in this scope
39 | llint Center2=(llint)(N/2);
| ^~~~~~~~~~~~~~
a.cc:43:42: error: 'Center1' was not declared in this scope
43 | llint leng=abs(homesx[i]-homesxs[Center1]) + abs(homesy[i]-homesys[Center1]);
| ^~~~~~~
a.cc:47:51: error: 'Center1' was not declared in this scope
47 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center1];zans[1]=homesys[Center1];}
| ^~~~~~~
a.cc:50:42: error: 'Center1' was not declared in this scope
50 | llint leng=abs(homesx[i]-homesxs[Center1]) + abs(homesy[i]-homesys[Center2]);
| ^~~~~~~
a.cc:50:76: error: 'Center2' was not declared in this scope
50 | llint leng=abs(homesx[i]-homesxs[Center1]) + abs(homesy[i]-homesys[Center2]);
| ^~~~~~~
a.cc:54:52: error: 'Center1' was not declared in this scope
54 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center1];zans[1]=homesys[Center2];}
| ^~~~~~~
a.cc:54:77: error: 'Center2' was not declared in this scope
54 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center1];zans[1]=homesys[Center2];}
| ^~~~~~~
a.cc:57:42: error: 'Center2' was not declared in this scope
57 | llint leng=abs(homesx[i]-homesxs[Center2]) + abs(homesy[i]-homesys[Center1]);
| ^~~~~~~
a.cc:57:76: error: 'Center1' was not declared in this scope
57 | llint leng=abs(homesx[i]-homesxs[Center2]) + abs(homesy[i]-homesys[Center1]);
| ^~~~~~~
a.cc:61:52: error: 'Center2' was not declared in this scope
61 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center2];zans[1]=homesys[Center1];}
| ^~~~~~~
a.cc:61:77: error: 'Center1' was not declared in this scope
61 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center2];zans[1]=homesys[Center1];}
| ^~~~~~~
a.cc:64:42: error: 'Center2' was not declared in this scope
64 | llint leng=abs(homesx[i]-homesxs[Center2]) + abs(homesy[i]-homesys[Center2]);
| ^~~~~~~
a.cc:68:52: error: 'Center2' was not declared in this scope
68 | if(ans>sum-maxl){ans=sum-maxl;zans[0]=homesxs[Center2];zans[1]=homesys[Center2];}
| ^~~~~~~
|
s239809272 | p00486 | C++ | è³ÅACµ½ÌÉAOJ¾ÆWAÉÈÁÄßµ¢
#include<iostream>
#include<cstdlib>
#include<queue>
#include<cstdio>
#include<vector>
#include<cassert>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<map>
#include<climits>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
ll myabs(ll a,ll b){
return max(a,b)-min(a,b);
}
void precalc(vector<pair<ll,ll> > &in,vector<pli> & ret,map<ll,int> & Y){
int n = in.size();
ll mini = LONG_LONG_MAX;
//yÀW̳kAŬlßĨ
map<ll,int> M;
rep(i,(int)in.size()){
M[in[i].first]++;
mini = min(mini,in[i].first);
}
//úlðvZ
ll pos = 2*M[mini],neg = 2*(n-M[mini]),prev = mini;
ll cur=0;
rep(i,(int)in.size())cur += 2*((ll)in[i].first-(ll)mini);
ret.push_back(make_pair(cur,mini));
//
int index = 0;
Y[mini] = index++;
map<ll,int>::iterator itr = M.begin();itr++;
while(itr != M.end()){
int fir = (*itr).first,sec=(*itr).second;
ll diff = fir - prev;
Y[fir] = index++;
cur = cur + pos * diff - neg * diff;
// cout << cur << " " << pos/2 <<" " << neg/2 <<" " << diff << endl;
ret.push_back(make_pair(cur,fir));
neg-=sec*2;
pos+=sec*2;
prev = fir;
itr++;
}
}
void bf(vector<pair<ll,ll> > &in){
vector<ll> x,y;
rep(i,in.size()){
swap(in[i].second,in[i].first);
x.push_back(in[i].second);
y.push_back(in[i].first);
}
sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end());
sort(y.begin(),y.end());y.erase(unique(y.begin(),y.end()),y.end());
ll ans = LONG_LONG_MAX;
ll ansx,ansy;
rep(i,y.size()){
rep(j,x.size()){
vector<ll> dist;
rep(k,in.size()){
dist.push_back(myabs(in[k].second,x[j])+myabs(in[k].first,y[i]));
}
sort(dist.begin(),dist.end());
ll tmp = 0;
rep(k,dist.size()){
tmp += dist[k]*2;
}
tmp -= dist[dist.size()-1];
if (tmp < ans){
ans = tmp;
ansy = x[j];
ansx = y[i];
}else if (tmp == ans && x[j] < ansx){
ans = tmp;
ansx = x[j];
ansy = y[i];
}else if (tmp == ans && x[j] == ansx && y[i] < ansy){
ans = tmp;
ansx = x[j];
ansy = y[i];
}
}
}
cout << "brute force " << endl;
cout << ans <<endl << ansx <<" " << ansy << endl;
}
main(){
int w,h,n;
while(cin>>w>>h>>n){
vector<pair<ll,ll> > in(n);
//input is x,y
rep(i,n){
cin>>in[i].first>>in[i].second;
}
vector<pli> y,x;//XRAAÀWÌyA
map<ll,int> Y,X;
precalc(in,y,Y);
rep(i,n)swap(in[i].first,in[i].second);
precalc(in,x,X);
rep(i,n)swap(in[i].first,in[i].second);
//ð
int mx = 0,my=0;
rep(i,x.size())if (x[i].first < x[mx].first)mx = i;
rep(i,y.size())if (y[i].first < y[my].first)my = i;
const int D=10;
ll ans = LONG_LONG_MAX;
ll ansx,ansy;
rep(k,(int)in.size()){
//æèyÀWÌCfbNX,æèÀWnkÍin[k].first,in[k].second
int xind = X[in[k].second];
int yind = Y[in[k].first ];
//¦ÌêðßéB(i,j)
REP(i,max(0,yind-D),min(yind+D,(int)Y.size())){
REP(j,max(0,xind-D),min(xind+D,(int)X.size())){
//¦ÌêÌAðæè©È©Á½lðßé
ll tmp = (ll)y[i].first + (ll)x[j].first;
tmp -= myabs((ll)y[i].second,(ll)in[k].first);
tmp -= myabs((ll)x[j].second,(ll)in[k].second);
ll ty=y[i].second,tx=x[j].second;
if (tmp < ans){
ans = tmp;
ansx = tx;
ansy = ty;
}else if (tmp == ans && tx < ansx){
ans = tmp;
ansx = tx;
ansy = ty;
}else if (tmp == ans && tx == ansx && ty < ansy){
ans = tmp;
ansx = tx;
ansy = ty;
}
}
}
REP(i,max(0,my-D),min(my+D,(int)Y.size())){
REP(j,max(0,mx-D),min(mx+D,(int)X.size())){
//¦ÌêÌAðæè©È©Á½lðßé
ll tmp = (ll)y[i].first + (ll)x[j].first;
tmp -= myabs((ll)y[i].second,(ll)in[k].first);
tmp -= myabs((ll)x[j].second,(ll)in[k].second);
ll ty=y[i].second,tx=x[j].second;
if (tmp < ans){
ans = tmp;
ansx = tx;
ansy = ty;
}else if (tmp == ans && tx < ansx){
ans = tmp;
ansx = tx;
ansy = ty;
}else if (tmp == ans && tx == ansx && ty < ansy){
ans = tmp;
ansx = tx;
ansy = ty;
}
}
}
}
cout << ans << endl << ansy <<" " << ansx << endl;
//bf(in);
}
} | a.cc:1:1: error: extended character is not valid in an identifier
1 | è³ÅACµ½ÌÉAOJ¾ÆWAÉÈÁÄßµ¢
| ^
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character is not valid in an identifier
a.cc:1:1: error: extended character ¢ is not valid in an identifier
a.cc:1:1: error: '\302\216\303\250\302\214\302\263\302\202\303\205AC\302\202\302\265\302\202\302\275\302\202\303\214\302\202\303\211AOJ\302\202\302\276\302\202\303\206WA\302\202\303\211\302\202\303\210\302\202\303\201\302\202\303\204\302\224\303\237\302\202\302\265\302\202\302\242' does not name a type
1 | è³ÅACµ½ÌÉAOJ¾ÆWAÉÈÁÄßµ¢
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member o |
s474074539 | p00486 | C++ | #include<iostream>
#include<algorithm>
#include<cassert>
#include<map>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int D=1;
const ll inf = 1LL<<60;
inline ll myabs(ll a,ll b){
return max(a,b)-min(a,b);
}
inline ll mymin(ll a, ll b){
return a < b?a:b;
}
inline ll mymax(ll a, ll b){
return a > b?a:b;
}
inline int mymin(int a, int b){
return a < b?a:b;
}
inline int mymax(int a, int b){
return a > b?a:b;
}
//inline void precalc(const vector<pair<ll,ll> > in,vector<pli> & ret){
inline vector<pll> precalc(const vector<pair<ll,ll> > in,bool flag){
vector<pll> ret;
int n = in.size();
//y座æ¨ã®å§ç¸®ãæå°å¤æ±ãã¦ãã
map<ll,int> M;
vector<ll> all;
rep(i,(int)in.size()){
if (flag){
M[in[i].first]++;
all.push_back(in[i].first);
}else {
M[in[i].second]++;
all.push_back(in[i].second);
}
}
sort(all.begin(),all.end());
all.erase(unique(all.begin(),all.end()),all.end());
//åæå¤ãè¨ç®
int num = M[all[0]];
ll pos = 2*num;
ll neg = 2*(n-num);
ll prev = all[0];
ll cur=0;
rep(i,(int)in.size()){
if (flag)cur = cur + 2*((ll)in[i].first-(ll)all[0]);
else cur = cur + 2*((ll)in[i].second-(ll)all[0]);
}
ret.push_back(make_pair(cur,all[0]));
REP(i,1,all.size()){
ll fir = all[i];
int sec=M[all[i]];
ll diff = fir - prev;
cur = cur + (pos * diff);
cur = cur - (neg * diff);
neg=neg-(sec*2);
pos=pos+(sec*2);
assert(neg+pos == 2*n);
prev = fir;
ret.push_back(make_pair(cur,fir));
}
return ret;
}
void bf(vector<pair<ll,ll> > &in,ll tans,ll tansx,ll tansy){
vector<ll> x,y;
rep(i,in.size()){
swap(in[i].second,in[i].first);
x.push_back(in[i].second);
y.push_back(in[i].first);
}
sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end());
sort(y.begin(),y.end());y.erase(unique(y.begin(),y.end()),y.end());
ll ans = inf;
ll ansx,ansy;
rep(i,y.size()){
rep(j,x.size()){
vector<ll> dist;
rep(k,in.size()){
dist.push_back(llabs(in[k].second,x[j])+llabs(in[k].first,y[i]));
}
sort(dist.begin(),dist.end());
ll tmp = 0;
rep(k,dist.size()){
tmp += dist[k]*2;
}
tmp -= dist[dist.size()-1];
if (tmp < ans){
ans = tmp;
ansy = x[j];
ansx = y[i];
}else if (tmp == ans && x[j] < ansx){
ans = tmp;
ansx = x[j];
ansy = y[i];
}else if (tmp == ans && x[j] == ansx && y[i] < ansy){
ans = tmp;
ansx = x[j];
ansy = y[i];
}
}
}
//cout << "brute force " << endl;
//cout << ans <<endl << ansy <<" " << ansx << endl;
//assert(ans == tans);
//assert(ansx == tansy);
//assert(ansy == tansx);
}
main(){
ll w,h;
int n;
while(cin>>w>>h){
cin>>n;
vector<pair<ll,ll> > in(n);
//input is x,y
rep(i,n){
cin>>in[i].first>>in[i].second;
}
vector<pll> y,x;//ã¹ã³ã¢ã座æ¨ã®ãã¢
map<ll,int> X,Y;
x = precalc(in,false);
y = precalc(in,true);
//è§£ã
int mx = 0,my=0;
vector<int> mxs,mys;
rep(i,(int)x.size()){
X[x[i].second]=i;
if (x[i].first < x[mx].first)mx = i;
else if (x[i].first == x[mx].first && x[i].second < x[mx].second)mx = i;
}
rep(i,x.size())if (x[i].first == x[mx].first)mxs.push_back(i);
rep(i,(int)y.size()){
Y[y[i].second]=i;
if (y[i].first < y[my].first)my = i;
else if (y[i].first == y[my].first && y[i].second < y[my].second)my = i;
}
rep(i,y.size())if (y[i].first == y[my].first)mys.push_back(i);
ll ansx=-1,ansy=-1;
ll ans = inf;
rep(k,(int)in.size()){
rep(ii,mys.size()){
rep(jj,mxs.size()){
REP(i,mymax(0,mys[ii]-D),mymin(mys[ii]+D,(int)y.size())){
REP(j,mymax(0,mxs[jj]-D),mymin(mxs[jj]+D,(int)x.size())){
ll tmp = y[i].first;
tmp = tmp + x[j].first;
tmp = tmp - llabs(y[i].second,in[k].first);
tmp = tmp - llabs(x[j].second,in[k].second);
ll ty=y[i].second;
ll tx=x[j].second;
if (tmp < ans || (tmp == ans && ty < ansy) || (tmp == ans && ty == ansy && tx < ansx) ){
ans = tmp;
ansx = tx;
ansy = ty;
}
}
}
}
}
/*
//åãé¤ãy座æ¨ã®ã¤ã³ããã¯ã¹,åãé¤ã座æ¨å°éã¯in[k].first,in[k].second
//assert(X.find(in[k].second) != X.end() && Y.find(in[k].first) != Y.end());
int xind = X[in[k].second];
int yind = Y[in[k].first ];
//çãã®å ´æã決ããã(i,j)
REP(i,mymax(0,yind-5),mymin(yind+5,(int)Y.size())){
REP(j,mymax(0,xind-5),mymin(xind+5,(int)X.size())){
//çãã®å ´æã®ãå¾å¾©ãåãé¤ããªãã£ãå¤ãæ±ãã
ll tmp = (ll)y[i].first + (ll)x[j].first;
tmp = tmp - myabs((ll)y[i].second,(ll)in[k].first);
tmp = tmp - myabs((ll)x[j].second,(ll)in[k].second);
ll ty=y[i].second,tx=x[j].second;
if (tmp < ans || (tmp == ans && ty < ansy) || (tmp == ans && ty == ansy && tx < ansx) ){
ans = tmp;
ansx = tx;
ansy = ty;
}
}
}*/
}
assert(ansx != -1);
cout << ans << endl;
cout << ansy <<" " << ansx << endl;
}
} | a.cc: In function 'void bf(std::vector<std::pair<long long int, long long int> >&, ll, ll, ll)':
a.cc:98:30: error: too many arguments to function 'long long int llabs(long long int)'
98 | dist.push_back(llabs(in[k].second,x[j])+llabs(in[k].first,y[i]));
| ~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:984:36: note: declared here
984 | __extension__ extern long long int llabs (long long int __x)
| ^~~~~
a.cc:98:55: error: too many arguments to function 'long long int llabs(long long int)'
98 | dist.push_back(llabs(in[k].second,x[j])+llabs(in[k].first,y[i]));
| ~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:984:36: note: declared here
984 | __extension__ extern long long int llabs (long long int __x)
| ^~~~~
a.cc: At global scope:
a.cc:129:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
129 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:168:33: error: too many arguments to function 'long long int llabs(long long int)'
168 | tmp = tmp - llabs(y[i].second,in[k].first);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:984:36: note: declared here
984 | __extension__ extern long long int llabs (long long int __x)
| ^~~~~
a.cc:169:33: error: too many arguments to function 'long long int llabs(long long int)'
169 | tmp = tmp - llabs(x[j].second,in[k].second);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:984:36: note: declared here
984 | __extension__ extern long long int llabs (long long int __x)
| ^~~~~
|
s370649583 | p00486 | C++ | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<long long,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
P pa1[100005];
P pa2[100005];
int h,w,n;
bool comp1(P a,P b){
    return a.first<b.first;
}
bool comp2(P a,P b){
    return a.second<b.second;
}
bool decide(P1 a,P1 b){
    if(a.first<b.first){
        return true;
    }else if(a.first>b.first){
        return false;
    }else{
        if(a.second.first<b.second.first){
            return true;
        }else if(a.second.first>b.second.first){
            return false;
        }else{
            return a.second.second<b.second.second;
        }
    }
}
int main(){
    scanf("%d %d",&h,&w);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        pa1[i]=mp(x,y);
        pa2[i]=pa1[i];
    }
    sort(pa2+1,pa2+(n+1),comp2);
    sort(pa1+1,pa1+(n+1),comp1);
    int ha=(n+1)/2;
    int ax=pa1[ha].first;
    int ay=pa2[ha].second;
    vector<P1>vec;
    vector<int>dx,dy;
    if(pa1[ha+1].first!=ax){
        dx.pb(ax);
        dx.pb(pa1[ha+1].first);
    }
    else{
        dx.pb(ax);
    }
    if(pa2[ha+1].second!=ay){
        dy.pb(ay);
        dy.pb(pa2[ha+1].second);
    }
    else{
        dy.pb(ay);     
    }
 
    for(int i=0;i<dx.size();i++){
        for(int j=0;j<=dy.size();j++){
            long long sd=0;
            int maxi=0;
            for(int g=1;g<=n;g++){
                sd+=(abs(pa1[g].first-dx[i])+abs(pa1[g].second-dy[j]));
                maxi=max(maxi,(abs(pa1[g].first-dx[i])+abs(pa1[g].second-dy[j])));
            }
            vec.pb(mp(sd*2-maxi,mp(dx[i],dy[j])));
        }
    }
sort(vec.begin(),vec.end(),decide); printf("%lld\n%d%d\n",vec[0].first,vec[0].second.first,vec[0].second.second);
return 0;
} | a.cc:27:2: error: stray '#' in program
27 |     return a.first<b.first;
| ^
a.cc:27:8: error: stray '#' in program
27 |     return a.first<b.first;
| ^
a.cc:27:14: error: stray '#' in program
27 |     return a.first<b.first;
| ^
a.cc:27:20: error: stray '#' in program
27 |     return a.first<b.first;
| ^
a.cc:30:2: error: stray '#' in program
30 |     return a.second<b.second;
| ^
a.cc:30:8: error: stray '#' in program
30 |     return a.second<b.second;
| ^
a.cc:30:14: error: stray '#' in program
30 |     return a.second<b.second;
| ^
a.cc:30:20: error: stray '#' in program
30 |     return a.second<b.second;
| ^
a.cc:33:2: error: stray '#' in program
33 |     if(a.first<b.first){
| ^
a.cc:33:8: error: stray '#' in program
33 |     if(a.first<b.first){
| ^
a.cc:33:14: error: stray '#' in program
33 |     if(a.first<b.first){
| ^
a.cc:33:20: error: stray '#' in program
33 |     if(a.first<b.first){
| ^
a.cc:34:2: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:8: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:14: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:20: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:26: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:32: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:38: error: stray '#' in program
34 |         return true;
| ^
a.cc:34:44: error: stray '#' in program
34 |         return true;
| ^
a.cc:35:2: error: stray '#' in program
35 |     }else if(a.first>b.first){
| ^
a.cc:35:8: error: stray '#' in program
35 |     }else if(a.first>b.first){
| ^
a.cc:35:14: error: stray '#' in program
35 |     }else if(a.first>b.first){
| ^
a.cc:35:20: error: stray '#' in program
35 |     }else if(a.first>b.first){
| ^
a.cc:36:2: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:8: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:14: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:20: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:26: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:32: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:38: error: stray '#' in program
36 |         return false;
| ^
a.cc:36:44: error: stray '#' in program
36 |         return false;
| ^
a.cc:37:2: error: stray '#' in program
37 |     }else{
| ^
a.cc:37:8: error: stray '#' in program
37 |     }else{
| ^
a.cc:37:14: error: stray '#' in program
37 |     }else{
| ^
a.cc:37:20: error: stray '#' in program
37 |     }else{
| ^
a.cc:38:2: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:8: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:14: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:20: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:26: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:32: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:38: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:38:44: error: stray '#' in program
38 |         if(a.second.first<b.second.first){
| ^
a.cc:39:2: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:8: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:14: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:20: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:26: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:32: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:38: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:44: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:50: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:56: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:62: error: stray '#' in program
39 |             return true;
| ^
a.cc:39:68: error: stray '#' in program
39 |             return true;
| ^
a.cc:40:2: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:8: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:14: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:20: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:26: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:32: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:38: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:40:44: error: stray '#' in program
40 |         }else if(a.second.first>b.second.first){
| ^
a.cc:41:2: error: stray '#' in program
41 |             return false;
| ^
a.cc:41:8: error: stray '#' in program
41 |             return false;
| ^
a.cc:41:14: error: stray '#' in program
41 |             return false;
| ^
a.cc:41:20: error: stray '#' in program
41 |             return false;
| ^
a.cc:41:26: error: stray '#' in program
41 |             return false;
| ^
a.cc:41:32: error: stray '#' in program
41 |             return false;
| ^ |
s744466155 | p00486 | C++ | #include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
typedef struct
{
long long int w[100];
}big;
big tasu(big a,big b)
{
long long int w;
big q;
long long int mae = 0;
for(int i = 0; i < 100; i++)
{
w = a.w[i] + b.w[i] + mae;
mae = w / 1000000;
w = w % 1000000;
q.w[i] = w;
}
return q;
}
big syoki(long long int a)
{
big q;
for(int i = 0; i < 100; i++)
{
q.w[i] = 0;
}
q.w[0] = a;
return q;
}
void hyozi(big a)
{
char flg = 0;
for(int i = 100 - 1; i >= 0; i--)
{
if(flg != 0)
{
printf("%06lld",a.w[i]);
}
else if(a.w[i] != 0)
{
printf("%lld",a.w[i]);
flg = 1;
}
}
printf("\n");
}
long long int wkyori(WWW a,WWW b)
{
return abs(a.x - b.x) + abs(a.y - b.y);
}
typedef struct
{
long long int x;
long long int y;
}WWW;
WWW ww[100000];
long long int x[100000];
long long int y[100000];
int main()
{
long long int w,h;
int n;
scanf("%lld %lld",&w,&h);
scanf("%d",&n);
long long int xw,yw;
for(int i = 0; i < n; i++)
{
scanf("%lld %lld",&xw,&yw);
x[i] = xw;
y[i] = yw;
ww[i].x = xw;
ww[i].y = yw;
}
sort(x,x + n);
sort(y,y + n);
WWW ori;
int sai;
if(n % 2 == 1)
{
ori.x = x[(n + 1) / 2];
ori.y = y[(n + 1) / 2];
int longer = 0;
for(int i = 0; i < n; i++)
{
if(longer < wkyori(ori,ww[i]))
{
longer = wkyori(ori,ww[i]);
sai = i;
}
}
}
else
{
WWW s;
int longer = 0;
for(int i = 0; i < n; i++)
{
if(ww[i].x > x[n / 2])
{
s.x = x[n / 2];
}
else
{
s.x = x[n / 2 + 1];
}
if(ww[i].y > y[n / 2])
{
s.y = y[n / 2];
}
else
{
s.y = y[n / 2 + 1];
}
if(longer < wkyori(s,ww[i]))
{
longer = wkyori(s,ww[i]);
sai = i;
}
else if(longer == wkyori(s,ww[i]))
{
if(ww[i].x < ww[sai].x || (ww[i].x == ww[sai].x && ww[i].y < ww[sai].y)
{
sai = i;
}
}
}
if(ww[sai].x > x[n / 2])
{
ori.x = x[n / 2];
}
else
{
ori.x = x[n / 2 + 1];
}
if(ww[sai].y > y[n / 2])
{
ori.y = y[n / 2];
}
else
{
ori.y = y[n / 2 + 1];
}
}
big last = syoki(0);
for(int i = 0; i < n; i++)
{
if(i != sai)
{
last = tasu(last,wkyori(ori,ww[i]) * 2);
}
else
{
last = tasu(last,wkyori(ori,ww[i]));
}
}
hyozi(last);
printf("%lld %lld\n",ori.x,ori.y);
return 0;
} | a.cc:55:22: error: 'WWW' was not declared in this scope
55 | long long int wkyori(WWW a,WWW b)
| ^~~
a.cc:55:28: error: 'WWW' was not declared in this scope
55 | long long int wkyori(WWW a,WWW b)
| ^~~
a.cc:55:33: error: expression list treated as compound expression in initializer [-fpermissive]
55 | long long int wkyori(WWW a,WWW b)
| ^
a.cc: In function 'int main()':
a.cc:96:29: error: 'wkyori' cannot be used as a function
96 | if(longer < wkyori(ori,ww[i]))
| ~~~~~~^~~~~~~~~~~
a.cc:98:30: error: 'wkyori' cannot be used as a function
98 | longer = wkyori(ori,ww[i]);
| ~~~~~~^~~~~~~~~~~
a.cc:125:29: error: 'wkyori' cannot be used as a function
125 | if(longer < wkyori(s,ww[i]))
| ~~~~~~^~~~~~~~~
a.cc:127:30: error: 'wkyori' cannot be used as a function
127 | longer = wkyori(s,ww[i]);
| ~~~~~~^~~~~~~~~
a.cc:130:35: error: 'wkyori' cannot be used as a function
130 | else if(longer == wkyori(s,ww[i]))
| ~~~~~~^~~~~~~~~
a.cc:132:86: error: expected ')' before '{' token
132 | if(ww[i].x < ww[sai].x || (ww[i].x == ww[sai].x && ww[i].y < ww[sai].y)
| ~ ^
| )
133 | {
| ~
a.cc:136:13: error: expected primary-expression before '}' token
136 | }
| ^
a.cc:160:34: error: 'wkyori' cannot be used as a function
160 | last = tasu(last,wkyori(ori,ww[i]) * 2);
| ~~~~~~^~~~~~~~~~~
a.cc:164:34: error: 'wkyori' cannot be used as a function
164 | last = tasu(last,wkyori(ori,ww[i]));
| ~~~~~~^~~~~~~~~~~
|
s843684933 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[] a=new int[n];
int[] b=new int[n];
buff=new double[n];
for(int i=0;i<n;i++){
a[i]=ir.nextInt();
b[i]=ir.nextInt();
}
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)>>>1;
if(ok(mid,a,b)) lb=mid;
else ub=mid;
}
out.println(lb);
}
static double[] buff;
public static boolean ok(int m,int[] a,int[] b){
for(int i=0;i<n;i++){
buff[i]=b[i]-(double)a[i]/m;
}
Arrays.sort(buff);
double tot=0;
for(int i=0;i<m;i++) tot+=buff[n-1-i];
return tot>=0;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:37: error: cannot find symbol
for(int i=0;i<n;i++){
^
symbol: variable n
location: class Main
Main.java:42: error: cannot find symbol
for(int i=0;i<m;i++) tot+=buff[n-1-i];
^
symbol: variable n
location: class Main
2 errors
|
s393965984 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[][] bs=new int[n][]
for(int i=0;i<n;i++) bs[i]=ir.nextIntArray(2);
Arrays.sort(bs,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return Integer.compare(a[1],b[1]);
}
});
int[][] f=new int[n][];
for(int i=0;i<n;i++) f[i]=new int[]{bs[i][0],i};
Arrays.sort(f,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return Integer.compare(a[0],b[0]);
}
});
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)>>>1;
if(ok(mid,bs,f)) lb=mid;
else ub=mid;
}
out.println(lb);
}
public static boolean ok(int m,int[][] bs,int[][] f){
int n=bs.length;
for(int i=0;i<n-m;i++){
int ct=0;
long tot=0;
for(int j=0;j<n&&ct<m;j++){
if(f[j][1]>=i){
ct++;
tot+=(long)f[j][0];
}
}
if(tot<=(long)bs[i][1]*m) return true;
}
return false;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:18: error: ';' expected
int[][] bs=new int[n][]
^
1 error
|
s826236429 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[][] bs=new int[n][];
for(int i=0;i<n;i++) bs[i]=ir.nextIntArray(2);
Arrays.sort(bs,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return Integer.compare(a[1],b[1]);
}
});
int[][] f=new int[n][];
for(int i=0;i<n;i++) f[i]=new int[]{bs[i][0],i};
Arrays.sort(f,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return Integer.compare(a[0],b[0]);
}
});
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)>>>1;
if(ok(mid,bs,f)) lb=mid;
else ub=mid;
}
out.println(lb);
}
public static boolean ok(int m,int[][] bs,int[][] f){
int n=bs.length;
for(int i=0;i<n-m;i++){
int ct=0;
long tot=0;
for(int j=0;j<n&&ct<m;j++){
if(f[j][1]>=i){
ct++;
tot+=(long)f[j][0];
}
}
if(cnt!=m) continue;
if(tot<=(long)bs[i][1]*m) return true;
}
return false;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:52: error: cannot find symbol
if(cnt!=m) continue;
^
symbol: variable cnt
location: class Main
1 error
|
s445526135 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[][] bs=new int[n][];
for(int i=0;i<n;i++) bs[i]=ir.nextIntArray(2);
Arrays.sort(bs,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return -Integer.compare(a[1],b[1]);
}
});
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)/2;
if(ok(mid)) lb=mid;
else ub=mid;
}
out.println(lb);
}
public static boolean ok(int m,int[][] bs){
if(m==0) return true;
PriorityQueue<Integer> pque=new PriorityQueue>();
long tot=0;
for(int i=0;i<m;i++){
pque.offer(-fs[i][0]);
tot+=(long)fs[i][0];
}
if(tot<=(long)fs[m-1][1]*(long)m) return true;
for(int i=m;i<n;i++){
tot+=(long)pque.poll();
tot+=(long)fs[i][0];
if(tot<=(long)fs[i][1]*m) return true;
}
return false;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:37: error: '(' or '[' expected
PriorityQueue<Integer> pque=new PriorityQueue>();
^
Main.java:37: error: -> expected
PriorityQueue<Integer> pque=new PriorityQueue>();
^
2 errors
|
s320269072 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[][] bs=new int[n][];
for(int i=0;i<n;i++) bs[i]=ir.nextIntArray(2);
Arrays.sort(bs,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return -Integer.compare(a[1],b[1]);
}
});
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)/2;
if(ok(mid)) lb=mid;
else ub=mid;
}
out.println(lb);
}
public static boolean ok(int m,int[][] bs){
if(m==0) return true;
PriorityQueue<Integer> pque=new PriorityQueue<>();
long tot=0;
for(int i=0;i<m;i++){
pque.offer(-fs[i][0]);
tot+=(long)fs[i][0];
}
if(tot<=(long)fs[m-1][1]*(long)m) return true;
for(int i=m;i<n;i++){
tot+=(long)pque.poll();
tot+=(long)fs[i][0];
if(tot<=(long)fs[i][1]*m) return true;
}
return false;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:29: error: method ok in class Main cannot be applied to given types;
if(ok(mid)) lb=mid;
^
required: int,int[][]
found: int
reason: actual and formal argument lists differ in length
Main.java:40: error: cannot find symbol
pque.offer(-fs[i][0]);
^
symbol: variable fs
location: class Main
Main.java:41: error: cannot find symbol
tot+=(long)fs[i][0];
^
symbol: variable fs
location: class Main
Main.java:43: error: cannot find symbol
if(tot<=(long)fs[m-1][1]*(long)m) return true;
^
symbol: variable fs
location: class Main
Main.java:44: error: cannot find symbol
for(int i=m;i<n;i++){
^
symbol: variable n
location: class Main
Main.java:46: error: cannot find symbol
tot+=(long)fs[i][0];
^
symbol: variable fs
location: class Main
Main.java:47: error: cannot find symbol
if(tot<=(long)fs[i][1]*m) return true;
^
symbol: variable fs
location: class Main
7 errors
|
s720337452 | p00487 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
int[][] bs=new int[n][];
for(int i=0;i<n;i++) bs[i]=ir.nextIntArray(2);
Arrays.sort(bs,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return -Integer.compare(a[1],b[1]);
}
});
int lb=0,ub=n+1;
while(ub-lb>1){
int mid=(lb+ub)/2;
if(ok(mid,bs)) lb=mid;
else ub=mid;
}
out.println(lb);
}
public static boolean ok(int m,int[][] bs){
if(m==0) return true;
int n=bs.length;
PriorityQueue<Integer> pque=new PriorityQueue<>();
long tot=0;
for(int i=0;i<m;i++){
pque.offer(-fs[i][0]);
tot+=(long)fs[i][0];
}
if(tot<=(long)fs[m-1][1]*(long)m) return true;
for(int i=m;i<n;i++){
tot+=(long)pque.poll();
tot+=(long)fs[i][0];
if(tot<=(long)fs[i][1]*m) return true;
}
return false;
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:41: error: cannot find symbol
pque.offer(-fs[i][0]);
^
symbol: variable fs
location: class Main
Main.java:42: error: cannot find symbol
tot+=(long)fs[i][0];
^
symbol: variable fs
location: class Main
Main.java:44: error: cannot find symbol
if(tot<=(long)fs[m-1][1]*(long)m) return true;
^
symbol: variable fs
location: class Main
Main.java:47: error: cannot find symbol
tot+=(long)fs[i][0];
^
symbol: variable fs
location: class Main
Main.java:48: error: cannot find symbol
if(tot<=(long)fs[i][1]*m) return true;
^
symbol: variable fs
location: class Main
5 errors
|
s248130756 | p00487 | Java |
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main {
int INF = 1 << 28;
Bag[] bags;
int n;
boolean ok(int x) {
long sum = 0;
PriorityQueue<Bag> que = new PriorityQueue<P0564.Bag>(1, new Comp());
for(int i=0;i<x-1;i++) que.add(bags[i]);
for(int i=0;i<x-1;i++) sum += bags[i].a;
for(int i=x-1;i<n;i++) {
long min = x * bags[i].b - bags[i].a;
if( sum <= min ) return true;
sum += bags[i].a;
que.add(bags[i]);
sum -= que.remove().a;
}
return false;
}
void run() {
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
bags = new Bag[n];
for(int i=0;i<n;i++) bags[i] = new Bag(Integer.parseInt( sc.next() ), Integer.parseInt( sc.next() ) );
sort(bags);
int l = 0, r = n-1;
while( r-l>1 ) {
int c = (l+r) / 2;
if( ok(c) ) l = c;
else r = c;
}
System.out.println(l);
}
class Bag implements Comparable<Bag>{
int a, b;
Bag(int a, int b) {
this.a = a;
this.b = b;
}
@Override
public int compareTo(Bag o) {
// TODO 自動生成されたメソッド・スタブ
return o.b - b;
}
}
class Comp implements Comparator<Bag> {
@Override
public int compare(Bag o1, Bag o2) {
// TODO 自動生成されたメソッド・スタブ
return o2.a - o1.a;
}
}
public static void main(String[] args) {
new Main().run();
}
void debug(Object... os) {
System.err.println(Arrays.deepToString(os));
}
} | Main.java:16: error: package P0564 does not exist
PriorityQueue<Bag> que = new PriorityQueue<P0564.Bag>(1, new Comp());
^
1 error
|
s836737638 | p00487 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef __int64 ll;
typedef struct {
ll a, b;
} BUG;
BUG foo[300000];
int n;
int seg[1 << 19][2];
int seg_size;
ll _max(ll a, ll b)
{
return (a > b ? a : b);
}
void init(int n)
{
seg_size = 1;
while (n > seg_size){
seg_size *= 2;
}
memset(seg, -1, sizeof(seg));
}
void update(int k, int x)
{
k += seg_size;
seg[k][0] = x;
seg[k][1] = k - seg_size;
while (k != 0){
k = (k - 1) / 2;
if (seg[k * 2 + 1][0] > seg[k * 2 + 2][0]){
seg[k][0] = seg[k * 2 + 1][0];
seg[k][1] = seg[k * 2 + 1][1];
}
else {
seg[k][0] = seg[k * 2 + 2][0];
seg[k][1] = seg[k * 2 + 2][1];
}
}
}
int comp(const void *a, const void *b)
{
BUG x, y;
x = *(BUG *)a;
y = *(BUG *)b;
if (x.b != y.b){
return (y.b - x.b);
}
else {
return (x.a - y.a);
}
}
int canPut(int piv)
{
int i;
int pos;
ll lim;
init(piv);
lim = 0;
for (i = 0; i < piv - 1; i++){
lim += foo[i].a;
update(i, foo[i].a);
}
while (i < n){
if (i == piv - 1){
lim += foo[i].a;
update(i, foo[i].a);
}
else {
pos = seg[0][1];
lim -= seg[0][0];
lim += foo[i].a;
update(pos, foo[i].a);
}
if (lim <= foo[i].b * piv){
return (1);
}
i++;
}
return (0);
}
int main(void)
{
int i;
int left, right, center;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%I64d %I64d", &foo[i].a, &foo[i].b);
}
left = 0;
right = n;
qsort(foo, n, sizeof(BUG), comp);
while (left != right){
center = (left + right + 1) / 2;
if (canPut(center)){
left = center;
}
else {
right = center - 1;
}
}
printf("%d\n", left);
return (0);
} | main.c:5:9: error: unknown type name '__int64'; did you mean '__int64_t'?
5 | typedef __int64 ll;
| ^~~~~~~
| __int64_t
|
s423123452 | p00487 | C++ | #include<bits/stdc++.h>
using namespace std;
#define reps(i,j,n) for(int i = (j) ; i < (int)(n) ; ++i)
#define rep(i,n) reps(i,0,n)
#define each(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++)
typedef pair< int , int > Pi;
typedef pair< int , Pi > Pii;
typedef long long int64;
const int INF = 1 << 30;
template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is>>a.first>>a.second; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os<<a.first<<" "<<a.second; }
template<typename T> istream& operator>>(istream& is, vector< T >& vc){ rep(i,sz(vc)) is >> vc[i]; return is;}
template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ rep(i,sz(vc)) os << vc[i] << endl; return os; }
int N;
Pi data[300000];
int calc(int value) { //value:許容匹数
int64 sum = 0; //放出量の合計
priority_queue< Pi, vector< Pi >, greater< Pi > > que; //許容量が小さい順
for(int i = 0; i < N; i++){
que.push( Pi( data[i].second, data[i].first));
sum += data[i].first;
// sum / que.size() を摂取する → sum / que.size() <= que.top()
while(!que.empty() && sum > (int64)valueue.size() * que.top().first){
sum -= que.top().second;
que.pop();
}
if(que.size() >= value) return true;
}
return false;
}
int Binary_Search( int row, int high) {
int mid = (row + high + 1) >> 1;
if(row == high) return(row);
else if(calc(mid)) return(Binary_Search( mid, high));
else return(Binary_Search( row, mid - 1));
}
int main() {
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d %d", &data[i].first, &data[i].second);
}
sort( data, data + N);
cout << Binary_Search( 0, N) << endl;
} | a.cc: In function 'int calc(int)':
a.cc:23:17: error: expected primary-expression before '(' token
23 | que.push( Pi( data[i].second, data[i].first));
| ^
a.cc:23:19: error: reference to 'data' is ambiguous
23 | que.push( Pi( data[i].second, data[i].first));
| ^~~~
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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:23:35: error: reference to 'data' is ambiguous
23 | que.push( Pi( data[i].second, data[i].first));
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:24:12: error: reference to 'data' is ambiguous
24 | sum += data[i].first;
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:26:40: error: 'valueue' was not declared in this scope; did you mean 'value'?
26 | while(!que.empty() && sum > (int64)valueue.size() * que.top().first){
| ^~~~~~~
| value
a.cc: In function 'int main()':
a.cc:46:21: error: reference to 'data' is ambiguous
46 | scanf("%d %d", &data[i].first, &data[i].second);
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:46:37: error: reference to 'data' is ambiguous
46 | scanf("%d %d", &data[i].first, &data[i].second);
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:48:9: error: reference to 'data' is ambiguous
48 | sort( data, data + N);
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
a.cc:48:15: error: reference to 'data' is ambiguous
48 | sort( data, data + N);
| ^~~~
/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:17:4: note: 'Pi data [300000]'
17 | Pi data[300000];
| ^~~~
|
s843993362 | p00487 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <cstring>
#include <cmath>
using namespace std;
const long double eps = 1e-12;
typedef long long ll;
typedef pair<int , int> pt;
#define sz(a) ((int) a.size() )
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)
#define For(i , a , b) for (int i = a ; i <= b ; i++)
#define Ford(i , a , b) for (int i = a ; i >= b ; i--)
#define Rep(i , n) for (int i = 0 ; i < n ; i++)
const int maxn = 300000 + 1912;
int n;
pt a[maxn];
void ReadData() {
scanf("%d" , &n);
For(i , 1 , n) scanf("%d%d" , &a[i].first , &a[i].second);
}
bool cmp(pt a , pt b) {
if (a.second == b.second) return a.first < b.first;
return a.second > b.second;
}
priority_queue<int> qu;
void Process() {
int res = 0;
long long sum = 0;
sort(a + 1 , a + 1 + n , cmp);
For(i , 1 , n) {
qu.push(a[i].first);
sum += a[i].first;
while (sz(qu) && sum > 1LL * a[i].second * sz(qu)) {
sum -= qu.top();s
qu.pop();
}
res = max(res , sz(qu));
}
cout << res << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("/users/youaremysky/documents/workspace/input.inp" , "r" , stdin);
ReadData();
Process();
} | a.cc: In function 'void Process()':
a.cc:49:30: error: 's' was not declared in this scope
49 | sum -= qu.top();s
| ^
|
s023001001 | p00487 | C++ | #include <iostream>
#include <algorithm>
#include <set>
#include <numeric>
#include <iterator>
using namespace std;
typedef pair<int, int> P;
int N;
P A[300000];
multiset<int> os;
bool f(long long X) {
multiset<long long> s(os);
multiset<int> g;
long long t = 0;
for (int i=0; i<X-1; i++) {
int x = A[i].second;
s.erase(s.find(x));
g.insert(x);
t += x;
}
for (int i=0; i<N-X+1; i++) {
int x = A[i].second;
long long b = (long long)A[i].first * X - x;
auto it = s.find(x);
if (it != s.end()) s.erase(it);
else {
auto it2 = g.find(x);
if (it2 != g.end()) {
g.erase(it2);
long long d = *s.begin();
s.erase(s.begin());
t += t - x + d;
g.insert(d);
}
}
if (t <= b) return true;
}
return false;
}
int main() {
cin >> N;
for (int i=0; i<N; i++) {
int a, b;
cin >> a >> b;
A[i] = P(b, a);
}
sort(A, A+N);
for (int i=0; i<N; i++) os.insert(A[i].second);
int lo = 0, hi = N+1;
while (hi - lo > 1) {
int mid = (lo + hi) / 2;
if (f(mid)) lo = mid;
else hi = mid;
}
cout << lo << "\n";
return 0;
} | a.cc: In function 'bool f(long long int)':
a.cc:14:27: error: no matching function for call to 'std::multiset<long long int>::multiset(std::multiset<int>&)'
14 | multiset<long long> s(os);
| ^
In file included from /usr/include/c++/14/set:64,
from a.cc:3:
/usr/include/c++/14/bits/stl_multiset.h:269:9: note: candidate: 'template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator, const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
269 | multiset(_InputIterator __first, _InputIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:269:9: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:204:9: note: candidate: 'template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator, const _Compare&, const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
204 | multiset(_InputIterator __first, _InputIterator __last,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:204:9: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:188:9: note: candidate: 'template<class _InputIterator> std::multiset<_Key, _Compare, _Alloc>::multiset(_InputIterator, _InputIterator) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
188 | multiset(_InputIterator __first, _InputIterator __last)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:188:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:263:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(std::initializer_list<_Tp>, const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
263 | multiset(initializer_list<value_type> __l, const allocator_type& __a)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:263:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:257:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(std::multiset<_Key, _Compare, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; std::__type_identity_t<_Alloc> = std::allocator<long long int>]'
257 | multiset(multiset&& __m, const __type_identity_t<allocator_type>& __a)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:257:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:252:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(const std::multiset<_Key, _Compare, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; std::__type_identity_t<_Alloc> = std::allocator<long long int>]'
252 | multiset(const multiset& __m,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:252:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:248:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
248 | multiset(const allocator_type& __a)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:248:38: note: no known conversion for argument 1 from 'std::multiset<int>' to 'const std::multiset<long long int>::allocator_type&' {aka 'const std::allocator<long long int>&'}
248 | multiset(const allocator_type& __a)
| ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:240:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(std::initializer_list<_Tp>, const _Compare&, const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
240 | multiset(initializer_list<value_type> __l,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:240:45: note: no known conversion for argument 1 from 'std::multiset<int>' to 'std::initializer_list<long long int>'
240 | multiset(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:228:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(std::multiset<_Key, _Compare, _Alloc>&&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
228 | multiset(multiset&&) = default;
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:228:16: note: no known conversion for argument 1 from 'std::multiset<int>' to 'std::multiset<long long int>&&'
228 | multiset(multiset&&) = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:219:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(const std::multiset<_Key, _Compare, _Alloc>&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
219 | multiset(const multiset&) = default;
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:219:16: note: no known conversion for argument 1 from 'std::multiset<int>' to 'const std::multiset<long long int>&'
219 | multiset(const multiset&) = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:174:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset(const _Compare&, const allocator_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; allocator_type = std::allocator<long long int>]'
174 | multiset(const _Compare& __comp,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:174:32: note: no known conversion for argument 1 from 'std::multiset<int>' to 'const std::less<long long int>&'
174 | multiset(const _Compare& __comp,
| ~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:165:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::multiset() [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
165 | multiset() = default;
| ^~~~~~~~
/usr/include/c++/14/bits/stl_multiset.h:165:7: note: candidate expects 0 arguments, 1 provided
|
s694403846 | p00487 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
using namespace std;
#define int long long
struct segtree {
vector<int> dat;
int n;
segtree(int n_) {
n = 1;
while (n < n_) n *= 2;
dat.resize(2*n, 0);
}
void update(int i, int x) {
i += n - 1;
int diff = x - dat[i];
dat[i] = x;
while (i > 0) {
i = (i - 1) / 2;
dat[i] += diff;
}
}
int query(int a, int b, int k = 0, int l = 0, int r = -1) {
if (r == -1) r = n;
if (r <= a || l >= b) return 0;
if (a <= l && r <= b) {
return dat[k];
}
int lv = query(a, b, k * 2 + 1, l, (l + r) / 2);
int rv = query(a, b, k * 2 + 2, (l + r) / 2, r);
return lv + rv;
}
};
int main()
{
int N; cin >> N;
vector<int> a(N), b(N);
segtree P(N), Q(N);
vector<tuple<int, int, int>> tmp;
for (int i = 0; i < N; ++i) {
cin >> a[i] >> b[i];
tmp.push_back(make_tuple(a[i], i, b[i]));
}
sort(begin(a), end(a));
sort(begin(tmp), end(tmp));
vector<pair<int, int>> data;
for (int i = 0; i < N; ++i) {
int aaa, bbb, val;
tie(aaa, bbb, val) = tmp[i];
data.push_back(make_pair(val, i));
}
sort(begin(data), end(data));
for (int i = 0; i < N; ++i) {
P.update(i, a[i]);
Q.update(i, 1);
}
int ma = 0;
for (int i = 0; i < N; ++i) {
pair<int, int> d = data[i];
int l = d.second, r = N-1;
int to = 1;
{
int n = N;
while (n>1) {n /= 2; to++;}
}
for (int j = 0; j < to; ++j) {
int mid = (l + r) / 2;
int PP = P.query(0, mid + 1);
int QQ = Q.query(0, mid + 1);
double v = double(PP) / QQ;
if (v <= d.first) {
l = mid;
} else {
r = mid;
}
}
P.update(d.second, 0);
Q.update(d.second, 0);
ma = max(ma, Q.query(0, l+1));
}
cout << ma + 1 << endl;
} | cc1plus: error: '::main' must return 'int'
|
s118725771 | p00487 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
using namespace std;
#define int long long
struct segtree {
vector<int> dat;
int n;
segtree(int n_) {
n = 1;
while (n < n_) n *= 2;
dat.resize(2*n, 0);
}
void update(int i, int x) {
i += n - 1;
int diff = x - dat[i];
dat[i] = x;
while (i > 0) {
i = (i - 1) / 2;
dat[i] += diff;
}
}
int query(int a, int b, int k = 0, int l = 0, int r = -1) {
if (r == -1) r = n;
if (r <= a || l >= b) return 0;
if (a <= l && r <= b) {
return dat[k];
}
int lv = query(a, b, k * 2 + 1, l, (l + r) / 2);
int rv = query(a, b, k * 2 + 2, (l + r) / 2, r);
return lv + rv;
}
};
int main()
{
int N; cin >> N;
vector<int> a(N), b(N);
segtree P(N), Q(N);
vector<tuple<int, int, int>> tmp;
for (int i = 0; i < N; ++i) {
cin >> a[i] >> b[i];
tmp.push_back(make_tuple(a[i], i, b[i]));
}
sort(begin(a), end(a));
sort(begin(tmp), end(tmp));
vector<pair<int, int>> data;
for (int i = 0; i < N; ++i) {
int aaa, bbb, val;
tie(aaa, bbb, val) = tmp[i];
data.push_back(make_pair(val, i));
}
sort(begin(data), end(data));
for (int i = 0; i < N; ++i) {
P.update(i, a[i]);
Q.update(i, 1);
}
int ma = 0;
for (int i = 0; i < N; ++i) {
pair<int, int> d = data[i];
int l = 0, r = N-1;
for (int j = 0; j < 20; ++j) {
int mid = (l + r) / 2;
int PP = P.query(0, mid + 1);
int QQ = Q.query(0, mid + 1);
double v = double(PP) / QQ;
if (v <= d.first) {
l = mid;
} else {
r = mid;
}
}
ma = max(ma, Q.query(0, l+1));
P.update(d.second, 0);
Q.update(d.second, 0);
}
cout << ma << endl;
} | cc1plus: error: '::main' must return 'int'
|
s187876949 | p00487 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
int bit[100001][2],n;
vector<P> bug;
int sum(int i,int num){
int s = 0;
while(i > 0){
s += bit[i][num];
i -= i & -i;
}
return s;
}
void add(int i,int x,int num){
while(i <= 100000){
bit[i][num] += x;
i += i & -i;
}
}
bool C(int x,int ok){
return sum(x,0) * ok >= sum(x,1);
}
int main(){
int ma = 0;
cin >> n;
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
bug.push_back(P(b,a));
}
sort(bug.begin(),bug.end(),greater<P>());
for(int i = 0;i < n;i++){
int ok = bug[i].first,foo = bug[i].second;
add(foo,1,0);
add(foo,foo,1);
int low = 0,up = 100001;
while(up - low > 1){
int mid = (up + low) / 2;
if(C(mid,ok)) low = mid;
else up = mid;
}
int s = sum(low,0);
if(low != 100000 && sum(low + 1,0) - sum(low,0) >= 2){
int j = 1;
for(;j < sum(low + 1,0) - sum(low,0);j++){
if((sum(low,0) + j) * ok < sum(low,1) + j * (low + 1)) break;
}
s += j - 1;
}
ma = max(s,ma);
}
cout << ma << endl;
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s696113650 | p00487 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
int bit[100001][2],n;
vector<P> bug;
signed sum(int i,int num){
int s = 0;
while(i > 0){
s += bit[i][num];
i -= i & -i;
}
return s;
}
void add(int i,int x,int num){
while(i <= 100000){
bit[i][num] += x;
i += i & -i;
}
}
bool C(int x,int ok){
return sum(x,0) * ok >= sum(x,1);
}
int main(){
int ma = 0;
cin >> n;
for(int i = 0;i < n;i++){
int a,b;
cin >> a >> b;
bug.push_back(P(b,a));
}
sort(bug.begin(),bug.end(),greater<P>());
for(int i = 0;i < n;i++){
int ok = bug[i].first,foo = bug[i].second;
add(foo,1,0);
add(foo,foo,1);
int low = 0,up = 100001;
while(up - low > 1){
int mid = (up + low) / 2;
if(C(mid,ok)) low = mid;
else up = mid;
}
int s = sum(low,0);
if(low != 100000 && sum(low + 1,0) - sum(low,0) >= 2){
int j = 1;
for(;j < sum(low + 1,0) - sum(low,0);j++){
if((sum(low,0) + j) * ok < sum(low,1) + j * (low + 1)) break;
}
s += j - 1;
}
ma = max(s,ma);
}
cout << ma << endl;
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s664569156 | p00487 | C++ | #include<bits/stdc++.h>
typedef p pair<int,int>
#define x first
#define y second
using namespace std;
p a[300010],c;
priority_queue<p,vector<p>,greater<p> >Q;
int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;} | a.cc:2:9: error: 'p' does not name a type
2 | typedef p pair<int,int>
| ^
a.cc:6:1: error: 'p' does not name a type
6 | p a[300010],c;
| ^
a.cc:7:1: error: 'priority_queue' does not name a type
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:22: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:8:54: error: 'a' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:74: error: 'a' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:69: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
a.cc:8:126: error: 'c' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:148: error: 'Q' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:255: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:8:264: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
| std::endl
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s182095556 | p00487 | C++ | #include<bits/stdc++.h>
typedef pair<int,int> p;
#define x first
#define y second
using namespace std;
p a[300010],c;
priority_queue<p,vector<p>,greater<p> >Q;
int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;} | a.cc:2:9: error: 'pair' does not name a type
2 | typedef pair<int,int> p;
| ^~~~
a.cc:6:1: error: 'p' does not name a type
6 | p a[300010],c;
| ^
a.cc:7:16: error: 'p' was not declared in this scope
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:25: error: 'p' was not declared in this scope
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:26: error: template argument 1 is invalid
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:26: error: template argument 2 is invalid
a.cc:7:36: error: 'p' was not declared in this scope
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:37: error: template argument 1 is invalid
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:39: error: template argument 1 is invalid
7 | priority_queue<p,vector<p>,greater<p> >Q;
| ^
a.cc:7:39: error: template argument 2 is invalid
a.cc:7:39: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:8:54: error: 'a' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:74: error: 'a' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:126: error: 'c' was not declared in this scope
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:8:150: error: request for member 'push' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:8:167: error: request for member 'empty' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~~
a.cc:8:184: error: request for member 'size' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:8:193: error: request for member 'top' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:8:212: error: request for member 'top' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:8:222: error: request for member 'pop' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:8:236: error: request for member 'size' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:8:247: error: request for member 'size' in 'Q', which is of non-class type 'int'
8 | int main(){int n,r=0;cin>>n;for(int i=0;i<n;i++)cin>>a[i].x>>a[i].y;sort(a,a+n);long long s=0;for(int i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;Q.push(c);while(!Q.empty()){if(s<=Q.size()*Q.top().x)break;s-=Q.top().y,Q.pop();}if(r<Q.size())r=Q.size();}cout<<r<<endl;return 0;}
| ^~~~
|
s619671944 | p00487 | C++ | #include<iostream>
#include<algorithm>
#include<queue>
typedef pair<int,int> p;
#define x first
#define y second
using namespace std;
p a[300010],c;
priority_queue<p,vector<p>,greater<p> >q;
int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;} | a.cc:4:9: error: 'pair' does not name a type
4 | typedef pair<int,int> p;
| ^~~~
a.cc:8:1: error: 'p' does not name a type
8 | p a[300010],c;
| ^
a.cc:9:16: error: 'p' was not declared in this scope
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:25: error: 'p' was not declared in this scope
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:26: error: template argument 1 is invalid
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:26: error: template argument 2 is invalid
a.cc:9:36: error: 'p' was not declared in this scope
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:37: error: template argument 1 is invalid
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:39: error: template argument 1 is invalid
9 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:9:39: error: template argument 2 is invalid
a.cc:9:39: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:10:61: error: 'a' was not declared in this scope
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:82: error: 'a' was not declared in this scope
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:130: error: 'c' was not declared in this scope
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:154: error: request for member 'push' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:171: error: request for member 'empty' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~~
a.cc:10:188: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:197: error: request for member 'top' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:216: error: request for member 'top' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:226: error: request for member 'pop' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:240: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:251: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
|
s099996431 | p00487 | C++ | #include<iostream>
#include<algorithm>
#include<queue>
typedef long long int ll;
typedef pair<ll,ll> p;
#define x first
#define y second
using namespace std;
p a[300010],c;
priority_queue<p,vector<p>,greater<p> >q;
int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;} | a.cc:5:9: error: 'pair' does not name a type
5 | typedef pair<ll,ll> p;
| ^~~~
a.cc:9:1: error: 'p' does not name a type
9 | p a[300010],c;
| ^
a.cc:10:16: error: 'p' was not declared in this scope
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:25: error: 'p' was not declared in this scope
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:26: error: template argument 1 is invalid
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:26: error: template argument 2 is invalid
a.cc:10:36: error: 'p' was not declared in this scope
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:37: error: template argument 1 is invalid
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:39: error: template argument 1 is invalid
10 | priority_queue<p,vector<p>,greater<p> >q;
| ^
a.cc:10:39: error: template argument 2 is invalid
a.cc:10:39: error: template argument 3 is invalid
a.cc: In function 'int main()':
a.cc:11:61: error: 'a' was not declared in this scope
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:11:82: error: 'a' was not declared in this scope
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:11:130: error: 'c' was not declared in this scope
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:11:154: error: request for member 'push' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:11:171: error: request for member 'empty' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~~
a.cc:11:188: error: request for member 'size' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:11:197: error: request for member 'top' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:11:216: error: request for member 'top' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:11:226: error: request for member 'pop' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:11:240: error: request for member 'size' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:11:251: error: request for member 'size' in 'q', which is of non-class type 'int'
11 | int main(){int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
|
s645517950 | p00487 | C++ | #include<iostream>
#include<algorithm>
#include<queue>
typedef long long int ll;
typedef pair<ll,ll> p;
#define x first
#define y second
using namespace std;
p a[300010],c;
int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;} | a.cc:5:9: error: 'pair' does not name a type
5 | typedef pair<ll,ll> p;
| ^~~~
a.cc:9:1: error: 'p' does not name a type
9 | p a[300010],c;
| ^
a.cc: In function 'int main()':
a.cc:10:27: error: 'p' was not declared in this scope
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:37: error: template argument 2 is invalid
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:50: error: template argument 1 is invalid
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:50: error: template argument 2 is invalid
a.cc:10:50: error: template argument 3 is invalid
a.cc:10:102: error: 'a' was not declared in this scope
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:123: error: 'a' was not declared in this scope
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:171: error: 'c' was not declared in this scope
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^
a.cc:10:195: error: request for member 'push' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:212: error: request for member 'empty' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~~
a.cc:10:229: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:238: error: request for member 'top' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:257: error: request for member 'top' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:267: error: request for member 'pop' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~
a.cc:10:281: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
a.cc:10:292: error: request for member 'size' in 'q', which is of non-class type 'int'
10 | int main(){priority_queue<p,vector<p>,greater<p> >q;int n,r=0,i;cin>>n;for(i=0;i<n;i++)scanf("%d%d",&a[i].x,&a[i].y);sort(a,a+n);long long s=0;for(i=0;i<n;i++){s+=a[i].x,c.x=a[i].y,c.y=a[i].x;q.push(c);while(!q.empty()){if(s<=q.size()*q.top().x)break;s-=q.top().y,q.pop();}if(r<q.size())r=q.size();}cout<<r<<endl;return 0;}
| ^~~~
|
s490917633 | p00487 | C++ | #include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#define INF 2147483600
int main(){
int n;
cin>>n;
vector<pair<long, long>> vec(n);
rep(i,n) cin>>vec[i].se >> vec[i].fi;
sort(all(vec), greater<pair<long,long>>());
int l=0, r=n+1;
while(r-l>1){
auto f = [&](int k){
if(k==0) return true;
// fi:b, se:a
priority_queue<long> pq;
long acc = 0;
rep(i,k){
pq.push(vec[i].se);
acc += vec[i].se;
}
if(acc <= k*vec[k-1].fi) return true;
repl(i,k,n){
long mx = pq.top(); pq.pop();
acc -= mx;
pq.push(min(mx, vec[i].se));
acc += min(mx, vec[i].se);
if(acc <= k*vec[i].fi) return true;
}
return false;
};
if(f((r+l)/2)) l = k;
else r = k;
}
cout << l << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:48:24: error: 'k' was not declared in this scope
48 | if(f((r+l)/2)) l = k;
| ^
a.cc:49:14: error: 'k' was not declared in this scope
49 | else r = k;
| ^
|
s157682849 | p00487 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Bug;
#define a second
#define b first
vector<Bug> bug;
int solve(int l,int r){
if(l+1==r)return l;
int k=(l+r)/2;
ll sumA=0;
priority_queue<int> pq;
for(auto x:bug){
sumA+=x.a;
pq.push(x.a);
if(pq.size()>k){
sumA-=pq.top();
pq.pop();
}
if(pq.size()==k && sumA<=(ll)k*x.b){
return solve(k,r);
}
}
return solve(l,k);
}
int main(void){
int N;
cin>>N;
bug.resize(N);
for(auto x:bug)cin>>x.a>>x.b;
sort(a.begin(),a.end(),greater<Bug>());
cout<<solve(0,N+1)<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:5:11: error: 'second' was not declared in this scope
5 | #define a second
| ^~~~~~
a.cc:33:14: note: in expansion of macro 'a'
33 | sort(a.begin(),a.end(),greater<Bug>());
| ^
|
s361036416 | p00487 | C++ | #include<algorithm>
#include<queue>
#include<map>
#include<utility>
using namespace std;
typedef long long ll;
pair<int,int> a[333333];
int n;
bool check(int k){
priority_queue <int> q;
ll s=0;
int i;
for(i=0;i<k;i++){
q.push(a[i].first);
s+=a[i].first;
}
//cout << s << " : " << a[k-1].second*k << endl;
if(s<=k*a[k-1].second) return 1;
while(i<n){
s-=q.top(); q.pop();
q.push(a[i].first);
s+=a[i].first;
//cout << s << " : " << k*a[i].second << endl;
if(s<=k*a[i].second) return 1;
i++;
}
//cout << s << " : " << k*a[i].second << endl;
return s<=k*a[i].second;
}
main(){
cin >> n;
for(int i=0;i<n;i++){
cin >> a[i].second >> a[i].first;
a[i].first*=-1;
// a[i].second*=-1;
}
sort(a,a+n);//世具ソートス
for(int i=0;i<n;i++){
a[i].first*=-1;
//a[i].second*=-1;
swap(a[i].first,a[i].second);
//cout << a[i].first << ' ' << a[i].second << endl;
}
int ed = n;
int st=0;
int res=0;
while(st<=ed){
int h=(st+ed)/2;
//cout << "check" << endl;
if(check(h)){
//cout << "ok..." << h << endl;
st=h+1;
res=max(res,h);
}
else{
//cout << "ng..." << h << endl;
ed=h-1;
}
}
cout << res << endl;
return 0;
} | a.cc:32:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
32 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:33:3: error: 'cin' was not declared in this scope
33 | cin >> n;
| ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
4 | #include<utility>
+++ |+#include <iostream>
5 | using namespace std;
a.cc:65:3: error: 'cout' was not declared in this scope
65 | cout << res << endl;
| ^~~~
a.cc:65:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:65:18: error: 'endl' was not declared in this scope
65 | cout << res << endl;
| ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
4 | #include<utility>
+++ |+#include <ostream>
5 | using namespace std;
|
s307091280 | p00487 | C++ | //Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
struct A
{
ll a,b;
}bug[300005];
bool comp(const A& a,const A& b)
{
if(A.b!=B.b) return A.b>B.b;
} return A.a<B.b;
ll bit[(1<<17)+1]={};
ll bit2[(1<<17)+1]={};
void add(int i,ll x)
{
while(i<=(1<<17))
{
bit[i]+=x;
i += i & -i;
}
}
void add2(int i,ll x)
{
while(i<=(1<<17))
{
bit2[i]+=x;
i += i & -i;
}
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%lld %lld",&bug[i].a,&bug[i].b);
}
sort(bug,bug+n,comp);
int ret=0;
for(int i=0;i<n;i++)
{
ll bord=bug[i].b;
add(bug[i].a,bug[i].a);
add2(bug[i].a,1);
ll now=0;
int many=0;
int nowid=0;
int id=(1<<17);
while(id>0 && nowid+id<=(1<<17))
{
if(now+bit[nowid+id]<=bord*(many+bit2[nowid+id]))
{
now+=bit[nowid+id];
many+=bit2[nowid+id];
nowid+=id;
id/=2;
}
else
{
id/=2;
}
}
ret=max(ret,many);
}
printf("%d\n",ret);
} | a.cc: In function 'bool comp(const A&, const A&)':
a.cc:34:13: error: expected unqualified-id before '.' token
34 | if(A.b!=B.b) return A.b>B.b;
| ^
a.cc:34:30: error: expected primary-expression before '.' token
34 | if(A.b!=B.b) return A.b>B.b;
| ^
a.cc:34:33: error: 'B' was not declared in this scope
34 | if(A.b!=B.b) return A.b>B.b;
| ^
a.cc: At global scope:
a.cc:35:9: error: expected unqualified-id before 'return'
35 | } return A.a<B.b;
| ^~~~~~
|
s690040172 | p00487 | C++ | //Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
#define a first
#define b second
P bug[300005];
ll bit[(1<<17)+1]={};
ll bit2[(1<<17)+1]={};
void add(int i,ll x)
{
while(i<=(1<<17))
{
bit[i]+=x;
i += (i & -i);
}
}
ll sum(int i)
{
ll s=0LL;
while(i>0)
{
s+=bit[i];
i -= (i & -i);
}
return s;
}
void add2(int i,ll x)
{
while(i<=(1<<17))
{
bit2[i]+=x;
i += (i & -i);
}
}
ll sum2(int i)
{
ll s=0LL;
while(i>0)
{
s+=bit2[i];
i -= (i & -i);
}
return s;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
ll x,y;
scanf("%lld %lld",&x,&y);
bug[i]=mp(y,x);
}
sort(bug,bug+n,greater<P>());
int ret=0;
for(int i=0;i<n;i++)
{
//printf("%d %d\n",bug[i].a,bug[i].b);
ll bord=bug[i].first;
add(bug[i].second,bug[i].second);
add2(bug[i].second,1LL);
int lb=0;
int ub=(1<<17);
while(ub-lb>1)
{
int mid=(lb+ub)>>1;
ll s1=sum(mid);
ll s2=sum2(mid);
if(s1<=s2*bord) lb=mid;
else ub=mid;
}
ret=max(ret,sum2(lb));
//printf("%d\n",maxv);
}
printf("%d\n",ret);
} | a.cc: In function 'int main()':
a.cc:98:24: error: no matching function for call to 'max(int&, ll)'
98 | ret=max(ret,sum2(lb));
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:6:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:98:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
98 | ret=max(ret,sum2(lb));
| ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:8:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:98:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
98 | ret=max(ret,sum2(lb));
| ~~~^~~~~~~~~~~~~~
|
s718253763 | p00487 | C++ | #include "stdio.h"
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define DEEP 19
long long int gfb[(1 << DEEP)];
long long int mkb[(1 << DEEP)];
void adb(long long int* a,int b,long long int x)
{
int n = b + 1;
while(n)
{
a[n - 1] += x;
n -= (n & (-n));
}
}
long long int wa(long long int* a,int b)
{
long long int w = 0;
int n = b + 1;
while(b != (1 << DEEP))
{
w += a[n - 1];
n += (n & (-n));
}
return w;
}
pair<long long int,int> aw[(1 << DEEP)];
int at[(1 << DEEP)];
pair<long long int,int> bw[(1 << DEEP)];
int main()
{
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
int aq,bq;
scanf("%d %d",&aq,&bq);
aw[i] = make_pair(aq,i);
bw[i] = make_pair(bq,i);
}
sort(aw,aw + n);
for(int i = 0; i < n; i++)
{
at[aw[i].second] = i;
}
sort(bw,bw + n,greater<int>);
for(int i = 0; i < (1 << DEEP); i++)
{
gfb[i] = 0;
mkb[i] = 0;
}
int na = 0;
int max = 0;
for(int i = 0; i < n; i++)
{
adb(gfb,at[bw[i].second],aw[at[bw[i].second]].first);
adb(mkb,at[bw[i].second],1);
if(bw[i].first == bw[i + 1].first)
{
continue;
}
int minf = bw[i].first;
if(wa(gfb,na) <= minf * wa(mkb,na))
{
while(1)
{
if(na >= n - 1)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na + 1) > minf * wa(mkb,na + 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na++;
}
}
else
{
while(1)
{
if(na <= 0)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na - 1) > minf * wa(mkb,na - 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na--;
}
}
}
printf("%d\n",max);
return 0;
} | a.cc: In function 'int main()':
a.cc:55:36: error: expected primary-expression before ')' token
55 | sort(bw,bw + n,greater<int>);
| ^
|
s837470636 | p00487 | C++ | #include "stdio.h"
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define DEEP 19
long long int gfb[(1 << DEEP)];
long long int mkb[(1 << DEEP)];
void adb(long long int* a,int b,long long int x)
{
int n = b + 1;
while(n)
{
a[n - 1] += x;
n -= (n & (-n));
}
}
long long int wa(long long int* a,int b)
{
long long int w = 0;
int n = b + 1;
while(b != (1 << DEEP))
{
w += a[n - 1];
n += (n & (-n));
}
return w;
}
pair<long long int,int> aw[(1 << DEEP)];
int at[(1 << DEEP)];
pair<long long int,int> bw[(1 << DEEP)];
int main()
{
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
int aq,bq;
scanf("%d %d",&aq,&bq);
aw[i] = make_pair(aq,i);
bw[i] = make_pair(bq,i);
}
sort(aw,aw + n);
for(int i = 0; i < n; i++)
{
at[aw[i].second] = i;
}
sort(bw,bw + n,greater<int>());
for(int i = 0; i < (1 << DEEP); i++)
{
gfb[i] = 0;
mkb[i] = 0;
}
int na = 0;
int max = 0;
for(int i = 0; i < n; i++)
{
adb(gfb,at[bw[i].second],aw[at[bw[i].second]].first);
adb(mkb,at[bw[i].second],1);
if(bw[i].first == bw[i + 1].first)
{
continue;
}
int minf = bw[i].first;
if(wa(gfb,na) <= minf * wa(mkb,na))
{
while(1)
{
if(na >= n - 1)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na + 1) > minf * wa(mkb,na + 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na++;
}
}
else
{
while(1)
{
if(na <= 0)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na - 1) > minf * wa(mkb,na - 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na--;
}
}
}
printf("%d\n",max);
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
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:2:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = std::pair<long long int, int>*; _Iterator2 = std::pair<long long int, int>*; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<long long int, int>*; _Compare = greater<int>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:6: required from here
55 | sort(bw,bw + n,greater<int>());
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: no match for call to '(std::greater<int>) (std::pair<long long int, int>&, std::pair<long long int, int>&)'
158 | { return bool(_M_comp(*__it1, *__it2)); }
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:49:
/usr/include/c++/14/bits/stl_function.h:394:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ^~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:29: note: no known conversion for argument 1 from 'std::pair<long long int, int>' to 'const int&'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<long long int, int>; _Iterator = std::pair<long long int, int>*; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_algo.h:1757:20: required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<greater<int> >]'
1757 | while (__comp(__val, __next))
| ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1785 | std::__unguarded_linear_insert(__i,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
1786 | __gnu_cxx::__ops::__val_comp_iter(__comp));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<long long int, int>*; _Compare = greater<int>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:6: required from here
55 | sort(bw,bw + n,greater<int>());
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:240:30: error: no match for call to '(std::greater<int>) (std::pair<long long int, int>&, std::pair<long long int, int>&)'
240 | { return bool(_M_comp(__val, *__it)); }
| ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ^~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:29: note: no known conversion for argument 1 from 'std::pair<long long int, int>' to 'const int&'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = std::pair<long long int, int>*; _Value = std::pair<long long int, int>; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = pair<long long int, int>*; _Distance = long int; _Tp = pair<long long int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<greater<int> >]'
140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:247:23: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Distance = long int; _Tp = pair<long long int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
247 | std::__push_heap(__first, __holeIndex, __topIndex,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248 | _GLIBCXX_MOVE(__value), __cmp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:356:22: required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
356 | std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_R |
s453283682 | p00487 | C++ | #include "stdio.h"
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define DEEP 19
long long int gfb[(1 << DEEP)];
long long int mkb[(1 << DEEP)];
void adb(long long int* a,int b,long long int x)
{
int n = b + 1;
while(n)
{
a[n - 1] += x;
n -= (n & (-n));
}
}
long long int wa(long long int* a,int b)
{
long long int w = 0;
int n = b + 1;
while(b != (1 << DEEP))
{
w += a[n - 1];
n += (n & (-n));
}
return w;
}
pair<long long int,int> aw[(1 << DEEP)];
int at[(1 << DEEP)];
pair<long long int,int> bw[(1 << DEEP)];
int main()
{
int n;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
int aq,bq;
scanf("%d %d",&aq,&bq);
aw[i] = make_pair(aq,i);
bw[i] = make_pair(bq,i);
}
sort(aw,aw + n);
for(int i = 0; i < n; i++)
{
at[aw[i].second] = i;
}
sort(bw,bw + n,greater<int>());
for(int i = 0; i < (1 << DEEP); i++)
{
gfb[i] = 0;
mkb[i] = 0;
}
int na = 0;
int max = 0;
for(int i = 0; i < n; i++)
{
adb(gfb,at[bw[i].second],aw[at[bw[i].second]].first);
adb(mkb,at[bw[i].second],1);
if(bw[i].first == bw[i + 1].first)
{
continue;
}
int minf = bw[i].first;
if(wa(gfb,na) <= minf * wa(mkb,na))
{
while(1)
{
if(na >= n - 1)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na + 1) > minf * wa(mkb,na + 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na++;
}
}
else
{
while(1)
{
if(na <= 0)
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
if(wa(gfb,na - 1) > minf * wa(mkb,na - 1))
{
if(max < wa(mkb,na))
{
max = wa(mkb,na);
}
break;
}
na--;
}
}
}
printf("%d\n",max);
return 0;
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
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:2:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = std::pair<long long int, int>*; _Iterator2 = std::pair<long long int, int>*; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<long long int, int>*; _Compare = greater<int>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:6: required from here
55 | sort(bw,bw + n,greater<int>());
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:158:30: error: no match for call to '(std::greater<int>) (std::pair<long long int, int>&, std::pair<long long int, int>&)'
158 | { return bool(_M_comp(*__it1, *__it2)); }
| ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:49:
/usr/include/c++/14/bits/stl_function.h:394:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ^~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:29: note: no known conversion for argument 1 from 'std::pair<long long int, int>' to 'const int&'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Val_comp_iter<_Compare>::operator()(_Value&, _Iterator) [with _Value = std::pair<long long int, int>; _Iterator = std::pair<long long int, int>*; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_algo.h:1757:20: required from 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<greater<int> >]'
1757 | while (__comp(__val, __next))
| ~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1785:36: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1785 | std::__unguarded_linear_insert(__i,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
1786 | __gnu_cxx::__ops::__val_comp_iter(__comp));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = pair<long long int, int>*; _Compare = greater<int>]'
4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:6: required from here
55 | sort(bw,bw + n,greater<int>());
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:240:30: error: no match for call to '(std::greater<int>) (std::pair<long long int, int>&, std::pair<long long int, int>&)'
240 | { return bool(_M_comp(__val, *__it)); }
| ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:7: note: candidate: 'constexpr bool std::greater<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = int]'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ^~~~~~~~
/usr/include/c++/14/bits/stl_function.h:394:29: note: no known conversion for argument 1 from 'std::pair<long long int, int>' to 'const int&'
394 | operator()(const _Tp& __x, const _Tp& __y) const
| ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = std::pair<long long int, int>*; _Value = std::pair<long long int, int>; _Compare = std::greater<int>]':
/usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = pair<long long int, int>*; _Distance = long int; _Tp = pair<long long int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_val<greater<int> >]'
140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:247:23: required from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Distance = long int; _Tp = pair<long long int, int>; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
247 | std::__push_heap(__first, __holeIndex, __topIndex,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248 | _GLIBCXX_MOVE(__value), __cmp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:356:22: required from 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
356 | std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = pair<long long int, int>*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_R |
s361276162 | p00488 | Java | package java_kadai_1;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[3];
int[] b = new int[2];
for(int i;i<3;i++){
a[i] = sc.nextInt();
}
for(int i;i<2;i++){
b[i] = sc.nextInt();
}
int c=2000,d = 2000;
for(int i=0; i<3;i++){
if(a[i]<c){
c = a[i];
}
}
for(int i=0; i<2;i++){
if(b[i]<d){
d = b[i];
}
}
System.out.printf("%d", c+d-50);
}
} | Main.java:10: error: variable i might not have been initialized
for(int i;i<3;i++){
^
Main.java:13: error: variable i might not have been initialized
for(int i;i<2;i++){
^
2 errors
|
s621047284 | p00488 | Java |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] a = new int[3];
int[] b = new int[2];
for(int i;i<3;i++){
a[i] = sc.nextInt();
}
for(int i;i<2;i++){
b[i] = sc.nextInt();
}
int c=2000,d = 2000;
for(int i=0; i<3;i++){
if(a[i]<c){
c = a[i];
}
}
for(int i=0; i<2;i++){
if(b[i]<d){
d = b[i];
}
}
System.out.printf("%d", c+d-50);
}
} | Main.java:9: error: variable i might not have been initialized
for(int i;i<3;i++){
^
Main.java:12: error: variable i might not have been initialized
for(int i;i<2;i++){
^
2 errors
|
s974572230 | p00488 | Java | import java.util.Scanner;
public class main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int [] pasta = new int[3];
int [] drink = new int[2];
int [][] price = new int[3][2];
for(int i = 0;i < 3;i++){
pasta[i] = sc.nextInt();
}
for(int j = 0;j < 2;j++){
drink[j] = sc.nextInt();
}
for(int i = 0;i < 3;i++){
for(int j = 0;j < 2;j++){
price[i][j] = pasta[i] + drink[j]-50;
}
}
int min = price[0][0];
for(int i = 0;i < 3;i++){
for(int j = 0;j < 2;j++){
if(min > price[i][j]){
min = price[i][j];
}
}
}
System.out.println(min);
}
} | Main.java:2: error: class main is public, should be declared in a file named main.java
public class main{
^
1 error
|
s466903109 | p00488 | Java | Main class{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int pasta[]=new int[3];
int juice[] = new int [2];
for(int i=0;i<3;i++)pasta[i]=in.nextInt();
for(int i=0;i<2;i++)juice[i]=in.nextInt();
int p=0,j=0;
for(int i=1;i<3;i++){
if(pasta[i]<pasta[p])p=i;
}
for(int i=1;i<2;i++){
if(juice[i]<juice[j])j=i;
}
int ans = pasta[p]+juice[j]-50;
System.out.println(ans);
}
} | Main.java:1: error: class, interface, enum, or record expected
Main class{
^
Main.java:1: error: <identifier> expected
Main class{
^
2 errors
|
s975871981 | p00488 | Java | class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int pasta[]=new int[3];
int juice[] = new int [2];
for(int i=0;i<3;i++)pasta[i]=in.nextInt();
for(int i=0;i<2;i++)juice[i]=in.nextInt();
int p=0,j=0;
for(int i=1;i<3;i++){
if(pasta[i]<pasta[p])p=i;
}
for(int i=1;i<2;i++){
if(juice[i]<juice[j])j=i;
}
int ans = pasta[p]+juice[j]-50;
System.out.println(ans);
}
} | Main.java:3: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner in = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s960715076 | p00488 | Java | import java.util.*;
public class main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int m[] = new int[5];
int minP = 2001,minJ = 2001;
for(int i=0; i<5; i++){
m[i] =s.nextInt();
}
for(int i=0; i<5; i++){
if(i < 3){
if(m[i] < minP) minP = m[i];
}
else{
if(m[i] < minJ) minJ = m[i];
}
}
System.out.println(minP + minJ -50);
}
} | Main.java:3: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s867956760 | p00488 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] pasta = new int[3];
int[] juice = new int[2];
for(int i=0;i<3;i++){
pasta[i] = sc.nextInt();
}
for(int i=0;i<2;i++){
juice[i] = sc.nextInt();
}
int bestpasta = pasta[0];
int bestjuice = juice[0];
for(int i=1;i<3;i++){
if(bestpasta > pasta[i]){
bestpasta = pasta[i];
}
}
for(int i=1;i<2;i++){
if(bestjuice > juice[i]){
best juice = juice[i];
}
}
System.out.println(bestpasta + bestjuice - 50);
}
} | Main.java:22: error: cannot find symbol
best juice = juice[i];
^
symbol: class best
location: class Main
Main.java:22: error: variable juice is already defined in method main(String[])
best juice = juice[i];
^
2 errors
|
s269322995 | p00488 | Java | package SD;
import java.util.Scanner;
public class aoj0565 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int a,b,c,d,e;
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
d=sc.nextInt();
e=sc.nextInt();
int[] x={a,b,c};
int [] y={d,e};
for(int i=0;i<x.length/2;i++){
for(int j=0;j<x.length;j++){
if(x[j]<x[i]){
int t=x[i];
x[i]=x[j];
x[j]=t;
}
}
}
for(int i=0;i<y.length/2;i++){
for(int j=0;j<y.length;j++){
if(y[j]<y[i]){
int s=y[i];
y[i]=y[j];
y[j]=s;
}
}
}
int A=x[0]+y[0]-50;
System.out.println(A);
}
} | Main.java:3: error: class aoj0565 is public, should be declared in a file named aoj0565.java
public class aoj0565 {
^
1 error
|
s516408674 | p00488 | Java | package zyugyo;
import java.util.Scanner;
public class aoj0565 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int a=0,b=0,c;
for(int i = 0;i < 3;i++){
c=in.nextInt();
if(i == 0) a = c;
else{
if(a > c){
a = c;
}
}
}
for(int i = 0;i < 2;i++){
c=in.nextInt();
if(i == 0) b = c;
else{
if(b > c){
b = c;
}
}
}
c = a + b - 50;
System.out.println(c);
}
} | Main.java:5: error: class aoj0565 is public, should be declared in a file named aoj0565.java
public class aoj0565 {
^
1 error
|
s809619170 | p00488 | Java | package zyugyo;
import java.util.Scanner;
public class main {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int a=0,b=0,c;
for(int i = 0;i < 3;i++){
c=in.nextInt();
if(i == 0) a = c;
else{
if(a > c){
a = c;
}
}
}
for(int i = 0;i < 2;i++){
c=in.nextInt();
if(i == 0) b = c;
else{
if(b > c){
b = c;
}
}
}
c = a + b - 50;
System.out.println(c);
}
} | Main.java:5: error: class main is public, should be declared in a file named main.java
public class main {
^
1 error
|
s619916601 | p00488 | Java | import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
int[] pasta = {0,0,0};
int[] juice = {0,0};
Scanner sc = new Scanner(System.in);
for(int i = 0; i < 3; i++){
pasta[i] = sc.nextInt();
}
for(int i = 0; i < 2; i++){
juice[i] = sc.nextInt();
}
int min = pasta[0] + juice[0];
for(int i = 0; i < 3; i++){
for(int j = 0; j < 2; j++){
if(min > pasta[i] + juice[j]) min = pasta[i] + juice[j];
}
}
System.out.println(min - 50);
}
} | Main.java:3: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s714057992 | p00488 | Java | public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pasta=2000, juice=2000;
int i;
for(i=0;i<5;i++){
if(i<3){
pasta = Math.min(pasta, sc.nextInt());
}
else{
juice = Math.min(juice, sc.nextInt());
}
}
System.out.println(pasta+juice-50);
}
} | Main.java:1: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0565
Main.java:4: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class AOJ0565
3 errors
|
s991316081 | p00488 | Java | package software_design;
import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pasta=2000, juice=2000;
int i;
for(i=0;i<5;i++){
if(i<3){
pasta = Math.min(pasta, sc.nextInt());
}
else{
juice = Math.min(juice, sc.nextInt());
}
}
System.out.println(pasta+juice-50);
}
} | Main.java:3: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s483078583 | p00488 | Java | import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pasta=2000, juice=2000;
int i;
for(i=0;i<5;i++){
if(i<3){
pasta = Math.min(pasta, sc.nextInt());
}
else{
juice = Math.min(juice, sc.nextInt());
}
}
System.out.println(pasta+juice-50);
}
} | Main.java:2: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s346460266 | p00488 | Java | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pasta=2000, juice=2000;
int i;
for(i=0;i<5;i++){
if(i<3){
pasta = Math.min(pasta, sc.nextInt());
}
else{
juice = Math.min(juice, sc.nextInt());
}
}
System.out.println(pasta+juice-50);
} | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
1 error
|
s524744037 | p00488 | Java | import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int pasta=2000, juice=2000;
int i;
for(i=0;i<5;i++){
if(i<3){
pasta = Math.min(pasta, sc.nextInt());
}
else{
juice = Math.min(juice, sc.nextInt());
}
}
System.out.println(pasta+juice-50);
}
} | Main.java:2: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s278277366 | p00488 | Java | import java.util.Scanner;
public class Lunch {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//1でパスタの最安値、2でジュースの最安値を記録
int min1 = 2000, min2 =2000;
for(int i=0; i<5; i++){
if(i<3){
min1 = Math.min(min1, sc.nextInt());
}
else{
min2 = Math.min(min2, sc.nextInt());
}
}
System.out.println(min1+min2-50);
}
} | Main.java:3: error: class Lunch is public, should be declared in a file named Lunch.java
public class Lunch {
^
1 error
|
s317571210 | p00488 | Java | import java.util.Scanner;
//Lunch
public class AOJ0565 {
void run(){
Scanner sc = new Scanner(System.in);
System.out.println((Math.min(sc.nextInt(), Math.min(sc.nextInt(), sc.nextInt())))+Math.min(sc.nextInt(), sc.nextInt())-50);
}
public static void main(String[] args) {
new AOJ0565().run();
}
} | Main.java:4: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s120223043 | p00488 | Java | package software_design;
import java.util.Arrays;
import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] pasta = new int [3];
int[] juice = new int [2];
pasta[0] = sc.nextInt();
pasta[1] = sc.nextInt();
pasta[2] = sc.nextInt();
juice[0] = sc.nextInt();
juice[1] = sc.nextInt();
Arrays.sort(pasta);
Arrays.sort(juice);
System.out.println(pasta[0]+juice[0]-50);
}
} | Main.java:4: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s684598074 | p00488 | Java | import java.util.Arrays;
import java.util.Scanner;
public class AOJ0565 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] pasta = new int [3];
int[] juice = new int [2];
pasta[0] = sc.nextInt();
pasta[1] = sc.nextInt();
pasta[2] = sc.nextInt();
juice[0] = sc.nextInt();
juice[1] = sc.nextInt();
Arrays.sort(pasta);
Arrays.sort(juice);
System.out.println(pasta[0]+juice[0]-50);
}
} | Main.java:3: error: class AOJ0565 is public, should be declared in a file named AOJ0565.java
public class AOJ0565 {
^
1 error
|
s320688627 | p00488 | C | #include<stdio.h>
int main(void)
{
int ne[6];
int ans[2];
int i;
for(i=0;i<5;i++){
scanf("%d",&ne[i]);
}
if(ne[0]<ne[1] && ne[0]<ne[2])
ans[0]=ne[0];
else if(ne[1]<ne[0] && ne[1]<ne[2])
ans[0]=ne[1];
else
ans[0]=ne[2];
if(ne[3]<ne[4])
ans[1]=ne[3];
else
ans[1]=ne[4];
printf("%d\n",ans[0]+ans[1]-50);
return 0;
}
}
| main.c:31:1: error: expected identifier or '(' before '}' token
31 | }
| ^
|
s842320646 | p00488 | C | #include <stdio.h>
main(){
int a,b,c,d,e,f,g,h;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if(a<=b&&a<=c)
int f=a;
else if(b<=c)
int f=b;
else
int f=c;
if(d<=e)
int g=d;
else
int g=e;
int h=f+g-50;
printf("%d\n", h);
| main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main(){
| ^~~~
main.c: In function 'main':
main.c:11:1: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:1: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:1: error: expected expression before 'int'
15 | int f=c;
| ^~~
main.c:17:1: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:1: error: expected expression before 'int'
19 | int g=e;
| ^~~
main.c:20:5: error: redeclaration of 'h' with no linkage
20 | int h=f+g-50;
| ^
main.c:4:19: note: previous declaration of 'h' with type 'int'
4 | int a,b,c,d,e,f,g,h;
| ^
main.c:21:1: error: expected declaration or statement at end of input
21 | printf("%d\n", h);
| ^~~~~~
|
s776737381 | p00488 | C | #include <stdio.h>
main(){
int a,b,c,d,e,f,g,h;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if(a<=b&&a<=c)
int f=a;
else if(b<=c)
int f=b;
else
int f=c;
if(d<=e)
int g=d;
else
int g=e;
int h=f+g-50;
printf("%d\n", h);
}
| main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main(){
| ^~~~
main.c: In function 'main':
main.c:11:1: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:1: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:1: error: expected expression before 'int'
15 | int f=c;
| ^~~
main.c:17:1: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:1: error: expected expression before 'int'
19 | int g=e;
| ^~~
main.c:20:5: error: redeclaration of 'h' with no linkage
20 | int h=f+g-50;
| ^
main.c:4:19: note: previous declaration of 'h' with type 'int'
4 | int a,b,c,d,e,f,g,h;
| ^
|
s281523319 | p00488 | C | #include <stdio.h>
main(){
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if((a<=b)&&(a<=c))
int f=a;
else if(b<=c)
int f=b;
else
int f=c;
if(d<=e)
int g=d;
else
int g=e;
int h=f+g-50;
printf("%d\n", h);
}
| main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main(){
| ^~~~
main.c: In function 'main':
main.c:11:1: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:1: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:1: error: expected expression before 'int'
15 | int f=c;
| ^~~
main.c:17:1: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:1: error: expected expression before 'int'
19 | int g=e;
| ^~~
main.c:20:7: error: 'f' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'g' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
|
s392225285 | p00488 | C | #include <stdio.h>
main(){
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if((a<=b)&&(a<=c))
int f=a;
else if(b<=c)
int f=b;
else if
int f=c;
if(d<=e)
int g=d;
else if
int g=e;
int h=f+g-50;
printf("%d\n", h);
}
| main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
3 | main(){
| ^~~~
main.c: In function 'main':
main.c:11:5: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:5: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:5: error: expected '(' before 'int'
15 | int f=c;
| ^~~
| (
main.c:17:5: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:5: error: expected '(' before 'int'
19 | int g=e;
| ^~~
| (
main.c:20:7: error: 'f' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'g' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
|
s553669667 | p00488 | C | #include <stdio.h>
int main(){
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if((a<=b)&&(a<=c))
int f=a;
else if(b<=c)
int f=b;
else if
int f=c;
if(d<=e)
int g=d;
else if
int g=e;
int h=f+g-50;
printf("%d\n", h);
return 0;
}
| main.c: In function 'main':
main.c:11:5: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:5: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:5: error: expected '(' before 'int'
15 | int f=c;
| ^~~
| (
main.c:17:5: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:5: error: expected '(' before 'int'
19 | int g=e;
| ^~~
| (
main.c:20:7: error: 'f' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'g' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
|
s945111780 | p00488 | C | #include <stdio.h>
int main(){
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
if((a<=b)&&(a<=c))
int f=a;
else if(b<=c)
int f=b;
else
int f=c;
if(d<=e)
int g=d;
else
int g=e;
int h=f+g-50;
printf("%d\n", h);
return 0;
}
| main.c: In function 'main':
main.c:11:5: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:5: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:5: error: expected expression before 'int'
15 | int f=c;
| ^~~
main.c:17:5: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:5: error: expected expression before 'int'
19 | int g=e;
| ^~~
main.c:20:7: error: 'f' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'g' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
|
s591165260 | p00488 | C | #include <stdio.h>
int main(){
int a,b,c,d,e;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &d);
scanf("%d", &e);
if((a<=b)&&(a<=c))
int f=a;
else if(b<=c)
int f=b;
else
int f=c;
if(d<=e)
int g=d;
else
int g=e;
int h=f+g-50;
printf("%d\n", h);
return 0;
}
| main.c: In function 'main':
main.c:11:5: error: expected expression before 'int'
11 | int f=a;
| ^~~
main.c:13:5: error: expected expression before 'int'
13 | int f=b;
| ^~~
main.c:15:5: error: expected expression before 'int'
15 | int f=c;
| ^~~
main.c:17:5: error: expected expression before 'int'
17 | int g=d;
| ^~~
main.c:19:5: error: expected expression before 'int'
19 | int g=e;
| ^~~
main.c:20:7: error: 'f' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:9: error: 'g' undeclared (first use in this function)
20 | int h=f+g-50;
| ^
|
s737011113 | p00488 | C | #include <stdio.h>
int main(void)
{
int pasta, juice;
int mini[2] = {3000, 3000};
int i;
for (i = 0; i < 3; i++){
scanf("%d", &pasta);
if (mini[0] > pasta) mini[0] = pasta;
}
for (i = 0; i < 2; i++){
scanf("%d", &juice);
if (mini[1] > juice) mini[1] = juice;
}
printf("%d\n", mini[0] + mini[1] - 50);
return 0;
}
| main.c:21:1: error: stray '\22' in program
21 | <U+0012>
| ^~~~~~~~
|
s916481551 | p00488 | C | #include<stdio.h>
int main(void){
int a,a1,b,b1,i;
for(i=0;i<3,i++){
scanf("%d",&a);
if(i!=0){
if(a1<a){
a=a1;
}
}
a1=a;
}
for(i=0;i<2,i++){
scanf("%d",&b);
if(i!=0){
if(b1<b){
b=b1;
}
}
b1=b;
}
printf("%d\n",a1+b1-50);
return 0;
} | main.c: In function 'main':
main.c:4:16: error: expected ';' before ')' token
4 | for(i=0;i<3,i++){
| ^
| ;
main.c:13:16: error: expected ';' before ')' token
13 | for(i=0;i<2,i++){
| ^
| ;
|
s119756283 | p00488 | C | #include <stdio.h>
int a,b=2000,c;
int main(void){
for(;c<3;++c)scanf("%d",&a),b=(a<b)?a:b;
scanf("%d%d",&a,&c),a=(a<c)a:c;
printf("%d\n",a+b-50);
return 0;
} | main.c: In function 'main':
main.c:6:36: error: expected ';' before 'a'
6 | scanf("%d%d",&a,&c),a=(a<c)a:c;
| ^
| ;
|
s426727425 | p00488 | C | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);} | 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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^
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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^~~~
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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^~~~~
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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^~~~~
main.c:1:17: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:55: 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);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^~~~~~
main.c:1:55: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:55: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:55: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:73: error: lvalue required as left operand of assignment
1 | a;main(b,c,d,e){scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);a=!printf("%d\n",(c<a=(a<b?a:b)?c:a)+(d<e?d:e)-50);}
| ^
|
s260534834 | p00488 | C | #include <stdio.h>
int main(void) {
int a,b,c,d,e;
scanf("%d\n%d\n%d\n%d\n%d",&a,&b,&c,&d,&e);
if(a=<b && a=<c && d=<e){
a=a+d-50;
printf("%d\n",a);
}
if(b=<a && b=<c && d=<e){
a=b+d-50;
printf("%d\n",a);
}
if(c=<a && c=<b && d=<e){
a=c+d-50;
printf("%d\n",a);
}
if(b=<a && b=<c && e=<d){
a=b+e-50;
printf("%d\n",a);
}
if(a=<b && a=<c && e=<d){
a=a+e-50;
printf("%d\n",a);
}
if(c=<a && c=<b && e=<d){
a=c+e-50;
printf("%d\n",a);
}
// your code goes here
return 0;
} | main.c: In function 'main':
main.c:7:6: error: expected expression before '<' token
7 | if(a=<b && a=<c && d=<e){
| ^
main.c:11:6: error: expected expression before '<' token
11 | if(b=<a && b=<c && d=<e){
| ^
main.c:15:14: error: expected expression before '<' token
15 | if(c=<a && c=<b && d=<e){
| ^
main.c:19:14: error: expected expression before '<' token
19 | if(b=<a && b=<c && e=<d){
| ^
main.c:23:14: error: expected expression before '<' token
23 | if(a=<b && a=<c && e=<d){
| ^
main.c:27:14: error: expected expression before '<' token
27 | if(c=<a && c=<b && e=<d){
| ^
|
s433144638 | p00488 | C | #include <stdio.h>
int main(void) {
int a,b,c,d,e;
scanf("%d\n%d\n%d\n%d\n%d",&a,&b,&c,&d,&e);
if(a<=b && a<=c && d<=e){
a=a+d-50;
printf("%d\n",a);
}
if(b<=a && b<=c && d<=e){
a=b+d-50;
printf("%d\n",a);
}
if(c<=a && c<=b && d<=e){
a=c+d-50;
printf("%d\n",a);
}
if(a<=b && a<=c && e<=d){
a=a+e-50;
printf("%d\n",a);
}
if(c<=a && c<=b && e<=d){
a=c+e-50;
printf("%d\n",a);
}
if(b<=a && b<=c && e<=d){
a=b+e-50;
printf("%d\n",a);
} | main.c: In function 'main':
main.c:31:1: error: expected declaration or statement at end of input
31 | }
| ^
|
s073901121 | p00488 | C | #include <stdio.h>
int main(void) {
int a,b,c,d,e,f,g,h;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
if (a<=b && b<=c){
f=a;
} else if (a<=c && c<=b){
f=a;
} else if (b<=c && c<=a){
f=b;
} else if (b<=a && a<=c){
f=b;
} else if (c=<a && a<=b){
f=c;
} else if (c<=b && b<=a){
f=c;
}
if(d<e){
g=d;
} else if(e<d){
g=e;
}
h=f+g-50;
printf("%d\n",h);
return 0;
} | main.c: In function 'main':
main.c:14:22: error: expected expression before '<' token
14 | } else if (c=<a && a<=b){
| ^
|
s269158896 | p00488 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,f,g,h,i,j,k;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);
scanf("%d",&e);
f=a+d-50;
g=a+e-50;
h=b+d-50;
i=b+e-50;
j=c+d-50;
k=c+e-50;
if(f<g&&f<h&&f<i&&f<j&&f<k){
printf("%d\n",f);
break;
}
else if(g<f&&g<h&&g<i&&g<j&&g<k){
printf("%d\n",g);
break;
}
else if(h<f&&h<g&&h<i&&h<j&&h<k){
printf("%d\n",h);
break;
}
else if(i<f&&i<h&&i<g&&i<j&&i<k){
printf("%d\n",i);
break;
}
else if(j<f&&j<h&&j<i&&j<g&&j<k){
printf("%d\n",j);
break;
}
else if(k<f&&k<h&&k<i&&k<j&&k<g){
printf("%d\n",k);
break;
}
return 0;
} | main.c: In function 'main':
main.c:18:1: error: break statement not within loop or switch
18 | break;
| ^~~~~
main.c:22:1: error: break statement not within loop or switch
22 | break;
| ^~~~~
main.c:26:1: error: break statement not within loop or switch
26 | break;
| ^~~~~
main.c:30:1: error: break statement not within loop or switch
30 | break;
| ^~~~~
main.c:34:1: error: break statement not within loop or switch
34 | break;
| ^~~~~
main.c:38:1: error: break statement not within loop or switch
38 | break;
| ^~~~~
|
s232406686 | p00488 | C | #include<stdio.h>
int main(void)
{
int game,n,i,j,team[100];
int a,b,c,d,ban[100];
scanf("%d",&n);
for(i=0;i<n;i++){
team[i]=0;
ban[i]=1;
}
game=n*(n-1)/2;
for(i=0;i<game;i++){
scanf("%d %d %d %d",&a,&b,&c,&d);
if(c>d){
team[a-1]+=3;
}
else if(c==d){
team[a-1]+=1; team[b-1]+=1;
else{
team[b-1]+=3;
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(team[i]<team[j]){
ban[i]++;
}
printf("%d\n",ban[i]);
}
return 0;
} | main.c: In function 'main':
main.c:19:1: error: expected '}' before 'else'
19 | else{
| ^~~~
main.c:30:1: error: expected declaration or statement at end of input
30 | }
| ^
main.c:30:1: error: expected declaration or statement at end of input
|
s621975163 | p00488 | C | #include<stdio.h>
int main(void)
{
int game,n,i,j,team[100];
int a,b,c,d,ban[100];
scanf("%d",&n);
for(i=0;i<n;i++){
team[i]=0;
ban[i]=1;
}
game=n*(n-1)/2;
for(i=0;i<game;i++){
scanf("%d %d %d %d",&a,&b,&c,&d);
if(c>d){
team[a-1]+=3;
}
else if(c==d){
team[a-1]+1;
team[b-1]+1;
else{
team[b-1]+3;
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(team[i]<team[j]){
ban[i]++;
}
printf("%d\n",ban[i]);
}
return 0;
} | main.c: In function 'main':
main.c:20:1: error: expected '}' before 'else'
20 | else{
| ^~~~
main.c:31:1: error: expected declaration or statement at end of input
31 | }
| ^
main.c:31:1: error: expected declaration or statement at end of input
|
s486327778 | p00488 | C | #include<stdio.h>
#include<stdlib.h>
int main(){
int a[3],b[2],Ans=0,amin=0,bmin=0;
scanf("%d",&a[0]);
amin=a[0];
scanf("%d",&a[1]);
if(amin>a[1])amin=a[1];
scanf("%d",&a[2]);
if(amin>a[2])amin=a[2];
scanf("%d",&b[0]);
scanf("%d",&b[1]);
bmin=min(b[0],b[1]);
Ans=amin+bmin-50;
printf("%d\n",Ans);
return 0;
} | main.c: In function 'main':
main.c:15:14: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
15 | bmin=min(b[0],b[1]);
| ^~~
| main
|
s211103976 | p00488 | C | #include<stdio.h>
#include<stdlib.h>
int main(){
int a[3],b[2],Ans=0,amin=0,bmin=0;
scanf("%d",&a[08]);
amin=a[0];
scanf("%d",&a[1]);
if(amin>a[1])amin=a[1];
scanf("%d",&a[2]);
if(amin>a[2])amin=a[2];
scanf("%d",&b[0]);
scanf("%d",&b[1]);
bmin=min(b[0],b[1]);
Ans=amin+bmin-50;
printf("%d\n",Ans);
return 0;
} | main.c: In function 'main':
main.c:7:23: error: invalid digit "8" in octal constant
7 | scanf("%d",&a[08]);
| ^~
main.c:15:14: error: implicit declaration of function 'min'; did you mean 'main'? [-Wimplicit-function-declaration]
15 | bmin=min(b[0],b[1]);
| ^~~
| main
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.