submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s203611498 | p00609 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#pragma warning(disable:4996)
int n, m, r, x[100000], y[100000];
vector<int>dp[11000];
int main() {
while (true) {
cin >> n >> m >> r; if (n == 0)break;
for (int i = 0; i < 11000; i++)dp[i].clear();
for (int i = 0; i < n; i++)cin >> x[i] >> y[i];
for (int i = 0; i < m; i++) {
int AA, BB; cin >> AA >> BB;
dp[AA].push_back(BB);
}
for (int i = 0; i < 11000; i++)sort(dp[i].begin(), dp[i].end());
int cnt = 0;
for (int i = 0; i < n; i++) {
for (int j = -r * 4; j <= r * 4; j++) {
int J = x[i] + j; if (J < 0)continue;
int L = sqrt(r*r*16 - j*j);
int P1 = y[i] - L, Q1 = y[i] + L;
int pos1 = lower_bound(dp[J].begin(), dp[J].end(), P1) - dp[J].begin();
int pos2 = lower_bound(dp[J].begin(), dp[J].end(), Q1 + 1) - dp[J].begin();
cnt += pos2 - pos1;
}
}
cout << cnt << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:41: error: 'sqrt' was not declared in this scope
22 | int L = sqrt(r*r*16 - j*j);
| ^~~~
|
s548664854 | p00609 | C++ | import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
void log(A...)(A arg) {
stderr.writeln(arg);
}
int size(T)(in T s) {
return cast(int)s.length;
}
struct Point {
int x, y;
int index;
};
class RangeTree {
class Node {
Node parent;
Node left, right;
int left_x, right_x;
Point[] ys;
override string toString() const {
return format("([%s,%s] -> %s)", left_x, right_x, ys);
}
}
Node construct(Point[] ps) {
auto n = new Node;
n.left_x = ps.front.x;
n.right_x = ps.back.x;
if(ps.length <= 1024) {
n.ys = ps.dup.sort!"a.y < b.y".array;
return n;
}
auto l = construct(ps[0 .. $ / 2]);
auto r = construct(ps[$ / 2 .. $]);
l.parent = n;
r.parent = n;
n.left = l;
n.right = r;
auto li = 0, ri = 0;
while (true) {
if (li >= l.ys.length && ri >= r.ys.length) break;
if (li >= l.ys.length) n.ys ~= r.ys[ri++];
else if (ri >= r.ys.length) n.ys ~= l.ys[li++];
else {
n.ys ~= (l.ys[li].y < r.ys[ri].y ? l.ys[li++] : r.ys[ri++]);
}
}
return n;
}
Node root;
this(Point[] ps) {
ps.sort!"a.x < b.x";
this.root = construct(ps);
}
/* (sx <= x <= gx && sy <= y <= gy)????????§??????(x, y)??§?±?esult???????????\??§??????. ??¢????????¢?????????????±???¨??¢???*/
Point[] query(int sx, int sy, int gx, int gy) {
Point[] result;
void f(Node cur_root) {
if (gx < cur_root.left_x || cur_root.right_x < sx) {
// do nothing
} else if (sx <= cur_root.left_x && cur_root.right_x <= gx) {
auto ys = cur_root.ys;
result ~= ys.assumeSorted!"a.y < b.y".upperBound(Point(0, sy - 1)).lowerBound(Point(0, gy + 1)).array;
} else {
if(cur_root.left is null || cur_root.right is null) {
foreach (p; cur_root.ys.assumeSorted!"a.y < b.y".upperBound(Point(0, sy - 1)).lowerBound(Point(0, gy + 1))) {
if (sx <= p.x && p.x <= gx && sy <= p.y && p.y <= gy) {
result ~= p;
}
}
} else {
f(cur_root.left);
f(cur_root.right);
}
}
}
f(root);
return result;
}
}
void main() {
int AN, BN, R;
Point[] A, B;
bool input() {
scanf("%d %d %d\n", &AN, &BN, &R);
if (AN == 0 && BN == 0) return false;
A = new Point[AN];
B = new Point[BN];
foreach (i; 0 .. AN) { scanf("%d %d\n", &A[i].x, &A[i].y); }
foreach (i; 0 .. BN) { scanf("%d %d\n", &B[i].x, &B[i].y); }
return true;
}
void solve() {
long ans = 0;
auto tree = new RangeTree(B);
foreach (a; A) {
auto ns = tree.query(a.x - 4 * R, a.y - 4 * R, a.x + 4 * R, a.y + 4 * R);
long dist_sq(in Point a, in Point b) {
long dx = a.x - b.x;
long dy = a.y - b.y;
return dx * dx + dy * dy;
}
foreach (n; ns) {
if (dist_sq(a, n) <= (4*R) * (4*R)) {
ans++;
}
}
}
writeln(ans);
}
while (input()) solve();
} | a.cc:1:1: error: 'import' does not name a type
1 | import std.algorithm;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import std.array;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import std.ascii;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import std.container;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import std.conv;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import std.math;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import std.numeric;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import std.range;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import std.stdio;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import std.string;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import std.typecons;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:6: error: variable or field 'log' declared void
13 | void log(A...)(A arg) {
| ^~~
a.cc:13:10: error: 'A' was not declared in this scope
13 | void log(A...)(A arg) {
| ^
a.cc:16:10: error: 'T' was not declared in this scope
16 | int size(T)(in T s) {
| ^
a.cc:26:14: error: field 'parent' has incomplete type 'RangeTree::Node'
26 | Node parent;
| ^~~~~~
a.cc:25:11: note: definition of 'class RangeTree::Node' is not complete until the closing brace
25 | class Node {
| ^~~~
a.cc:27:14: error: field 'left' has incomplete type 'RangeTree::Node'
27 | Node left, right;
| ^~~~
a.cc:25:11: note: definition of 'class RangeTree::Node' is not complete until the closing brace
25 | class Node {
| ^~~~
a.cc:27:20: error: field 'right' has incomplete type 'RangeTree::Node'
27 | Node left, right;
| ^~~~~
a.cc:25:11: note: definition of 'class RangeTree::Node' is not complete until the closing brace
25 | class Node {
| ^~~~
a.cc:29:14: error: expected unqualified-id before '[' token
29 | Point[] ys;
| ^
a.cc:30:9: error: 'override' does not name a type
30 | override string toString() const {
| ^~~~~~~~
a.cc:34:5: error: expected ';' at end of member declaration
34 | Node construct(Point[] ps) {
| ^~~~
| ;
a.cc:34:28: error: expected ',' or '...' before 'ps'
34 | Node construct(Point[] ps) {
| ^~
a.cc:34:10: error: ISO C++ forbids declaration of 'construct' with no type [-fpermissive]
34 | Node construct(Point[] ps) {
| ^~~~~~~~~
a.cc:59:5: error: 'Node' does not name a type
59 | Node root;
| ^~~~
a.cc:60:5: error: expected unqualified-id before 'this'
60 | this(Point[] ps) {
| ^~~~
a.cc:66:10: error: expected unqualified-id before '[' token
66 | Point[] query(int sx, int sy, int gx, int gy) {
| ^
a.cc:90:2: error: expected ';' after class definition
90 | }
| ^
| ;
a.cc: In member function 'int RangeTree::construct(Point*)':
a.cc:35:22: error: 'Node' does not name a type
35 | auto n = new Node;
| ^~~~
a.cc:36:20: error: 'ps' was not declared in this scope
36 | n.left_x = ps.front.x;
| ^~
a.cc:42:34: error: expected unqualified-id before '.' token
42 | auto l = construct(ps[0 .. $ / 2]);
| ^
a.cc:43:31: error: '$' was not declared in this scope
43 | auto r = construct(ps[$ / 2 .. $]);
| ^
a.cc:43:38: error: expected unqualified-id before '.' token
43 | auto r = construct(ps[$ / 2 .. $]);
| ^
a.cc: At global scope:
a.cc:92:1: error: '::main' must return 'int'
92 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:94:10: error: structured binding declaration cannot have type 'Point'
94 | Point[] A, B;
| ^~
a.cc:94:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:94:10: error: empty structured binding declaration
a.cc:94:13: error: expected initializer before 'A'
94 | Point[] A, B;
| ^
a.cc:95:15: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
95 | bool input() {
| ^~
a.cc:95:15: note: remove parentheses to default-initialize a variable
95 | bool input() {
| ^~
| --
a.cc:95:15: note: or replace parentheses with braces to value-initialize a variable
a.cc:95:18: error: a function-definition is not allowed here before '{' token
95 | bool input() {
| ^
a.cc:104:18: error: a function-definition is not allowed here before '{' token
104 | void solve() {
| ^
a.cc:122:12: error: 'input' was not declared in this scope; did you mean 'int'?
122 | while (input()) solve();
| ^~~~~
| int
a.cc:122:21: error: 'solve' was not declared in this scope
122 | while (input()) solve();
| ^~~~~
|
s705992287 | p00609 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
#include <vector>
#include<memory>
using namespace std;
struct po {
int index;
vector<int> coors;
po(int _d):coors(_d) {
index = -1;
}
po() {}
};
template<class T>
class axisSorter {
int k;
public:
axisSorter(int _k) : k(_k) {}
bool operator()(const T &a, const T &b) {
return a.coors[k] < b.coors[k];
}
};
long long int getdis(const po&l, const po&r) {
long long int dis = 0;
for (int i = 0; i < l.coors.size(); ++i) {
dis += (l.coors[i] - r.coors[i])*(l.coors[i] - r.coors[i]);
}
return dis;
}
template<class T, int Dim = 2>
struct kdtree {
public:
T val;
shared_ptr<kdtree<T>> ltree, rtree;
int depth;
int axis;
kdtree(const T &p_) :val(p_), ltree(nullptr), rtree(nullptr) {
}
kdtree(vector<T>&ps_, const int& l, const int& r, const int depth_ = 0) : ltree(nullptr), rtree(nullptr), depth(depth_), axis(depth%Dim) {
init(ps_, l, r);
}
~kdtree() {
}
//??´??????????????????????????°????±??????????
int query(const T & center, const int r) {
vector<T>ans;
bool aok = true;
for (int i = 0; i < Dim; ++i) {
int d = center.coors[i] - amin.coors[i];
num += d*d;
}
if (aok) {
ans.emplace_back(val);
}
axisSorter<T> as(axis);
if (as(val, amax) || val.coors[axis] == amax.coors[axis]) {
if (rtree != nullptr) {
vector<T>tans(rtree->query(amin, amax));
ans.insert(ans.end(), tans.begin(), tans.end());
}
}
if (as(amin, val) || val.coors[axis] == amin.coors[axis]) {
if (ltree != nullptr) {
vector<T>tans(ltree->query(amin, amax));
ans.insert(ans.end(), tans.begin(), tans.end());
}
}
return ans;
}
//????????????????±??????????
void get_closest(const T& apo,int r, long long int &ans) {
if (getdis(apo, val) <= r*r)ans++;
axisSorter<T> as(axis);
if (as(apo, val) || val.coors[axis] == apo.coors[axis]) {
if (ltree)ltree->get_closest(apo, r,ans);
long long int dis = apo.coors[axis] - val.coors[axis];
if (dis*dis > r*r)return;
else {
if (rtree)rtree->get_closest(apo, r,ans);
}
}
else {
if (rtree)rtree->get_closest(apo,r, ans);
long long int dis = val.coors[axis] - apo.coors[axis];
if (dis*dis > r*r)return;
else {
if (ltree)ltree->get_closest(apo,r, ans);
}
}
}
private:
void init(vector<T>&ps, const int& l, const int& r) {
if (l >= r) {
return;
}
const int mid = (l + r) / 2;
nth_element(ps.begin() + l, ps.begin() + mid, ps.begin() + r, axisSorter<T>(axis));
val = ps[mid];
ltree = make_kdtree(ps, l, mid, depth + 1);
rtree = make_kdtree(ps, mid + 1, r, depth + 1);
}
};
//[l..r)
template<class T>
unique_ptr<kdtree<T>>make_kdtree(vector<T>&ps_, const int& l, const int& r, const int& depth = 0) {
if (l >= r)return nullptr;
else {
return make_unique<kdtree<T>>(ps_, l, r, depth);
}
}
int main() {
while (1) {
int AN, BN, R; cin >> AN >> BN >> R;
if (!AN&&!BN)break;
R *= 4;
long long int ans = 0;
vector<po>pos;
for (int i = 0; i < AN; ++i) {
int x, y; cin >> x >> y;
pos.push_back(po{ 2 });
pos[i].coors[0] = x;
pos[i].coors[1] = y;
}
auto tree(make_kdtree(pos, 0, AN));
for (int i = 0; i < BN; ++i) {
int x, y; cin >> x >> y;
po apo = po{ 2 };
apo.coors[0] = x;
apo.coors[1] = y;
tree->get_closest(apo, R, ans);
}
cout << ans << endl;
}
return 0;
} | a.cc: In member function 'int kdtree<T, Dim>::query(const T&, int)':
a.cc:55:51: error: 'amin' was not declared in this scope; did you mean 'fmin'?
55 | int d = center.coors[i] - amin.coors[i];
| ^~~~
| fmin
a.cc:56:25: error: 'num' was not declared in this scope; did you mean 'enum'?
56 | num += d*d;
| ^~~
| enum
a.cc:62:29: error: 'amax' was not declared in this scope; did you mean 'fmax'?
62 | if (as(val, amax) || val.coors[axis] == amax.coors[axis]) {
| ^~~~
| fmax
a.cc:64:60: error: 'amin' was not declared in this scope; did you mean 'fmin'?
64 | vector<T>tans(rtree->query(amin, amax));
| ^~~~
| fmin
a.cc:68:24: error: 'amin' was not declared in this scope; did you mean 'fmin'?
68 | if (as(amin, val) || val.coors[axis] == amin.coors[axis]) {
| ^~~~
| fmin
a.cc:70:66: error: 'amax' was not declared in this scope; did you mean 'fmax'?
70 | vector<T>tans(ltree->query(amin, amax));
| ^~~~
| fmax
|
s072152360 | p00609 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define Dim 2
typedef complex<double> P;
typedef vector<int> kdVal;
int dist(int p, int base)
{
return p-base;
}
int R;
bool isInto(kdVal k, kdVal r)
{
P a(r[0], r[1]), b=(k[0], k[1]);
double dd=abs(a-b);
if(dd <= 3*R) return true;
return false;
}
class kdTree
{
public:
kdVal v;
kdTree *l,*r;
kdTree()
:l(NULL),r(NULL)
{}
kdTree(kdVal v)
:v(v),l(NULL), r(NULL)
{}
~kdTree()
{
if(l!=NULL) delete l;
if(r!=NULL) delete r;
}
void insert(kdVal k, int d)
{
if(v[d%Dim] > k[d%Dim])
{
if(l==NULL) l = new kdTree(k);
else l->insert(k,d+1);
}
else
{
if(r==NULL) r = new kdTree(k);
else r->insert(k, d+1);
}
}
void print()
{
for(int i=0; i<v.size(); i++)
cout << v[i] << " ";
puts("");
if(l!=NULL)
{
printf(" l ");
l->print();
}
if(r!=NULL)
{
printf(" r ");
r->print();
}
}
void create(vector<kdVal >& val, int lowerb, int upperb)
{
int mid=(lowerb+upperb)/2;
v = val[mid];
if(lowerb!=mid)
{
l = new kdTree;
l->create(val, lowerb, mid-1);
}
if(upperb!=mid)
{
r = new kdTree;
r->create(val, mid+1, upperb);
}
}
int count(kdVal k, int d)
{
int ret=0, dd=dist(k[d%Dim], v[d%Dim]);
if(isInto(k, v)) ++ret;
if(abs(dd) <= 3*R)
{
if(l!=NULL) ret += l->count(k, d+1);
if(r!=NULL) ret += r->count(k, d+1);
}
else if(dd < 0)
{
if(l!=NULL) ret += l->count(k, d+1);
}
else
{
if(r!=NULL) ret += r->count(k, d+1);
}
return ret;
}
};
int main()
{
int A,B;
while(scanf("%d%d%d", &A,&B,&R), (A||B||R))
{
int ret=0;
vector<kdVal > a(A), b(B);
for(int i=0; i<A; i++)
{
kdVal d(2);
for(int j=0; j<2; ++j)
scanf("%d", &d[j]);
a[i]=d;
}
for(int i=0; i<B; i++)
{
kdVal d(2);
for(int j=0; j<2; ++j)
scanf("%d", &d[j]);
b[i]=d;
}
sort(b.begin(), b.end());
kdTree* d_2 = new kdTree;
d_2->create(b, 0, b.size()-1);
for(int i=0; i<a.size(); i++)
ret+=d_2->count(a[i], 0);
printf("%d\n", ret);
delete d_2;
}
} | a.cc:7:9: error: 'complex' does not name a type
7 | typedef complex<double> P;
| ^~~~~~~
a.cc: In function 'bool isInto(kdVal, kdVal)':
a.cc:20:9: error: 'P' was not declared in this scope
20 | P a(r[0], r[1]), b=(k[0], k[1]);
| ^
a.cc:21:23: error: 'a' was not declared in this scope
21 | double dd=abs(a-b);
| ^
a.cc:21:25: error: 'b' was not declared in this scope
21 | double dd=abs(a-b);
| ^
a.cc: In member function 'void kdTree::print()':
a.cc:65:25: error: 'cout' was not declared in this scope
65 | cout << v[i] << " ";
| ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <algorithm>
+++ |+#include <iostream>
4 | using namespace std;
|
s490277216 | p00609 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
vector<int> v[10000];
int main(){
int aN,bN,R;
while(cin >> aN >> bN >> R , aN){
for(int i = 0 ; i < 10000 ; i++) v.clear();
for(int i = 0 ; i < aN ; i++){
int x,y;
cin >> x >> y;
v[y].push_back(x);
}
for(int i = 0 ; i < 10000 ; i++)
sort(v[i].begin(),v[i].end());
int D = 4 * R , ans = 0 ;
for(int i = 0 ; i < bN ; i++){
int x,y;
cin >> x >> y;
for(int p = -D ; p <= D ; p++){
if(y+p < 0 || y+p >= 10000) continue;
int m = sqrt( D*D - p*p );
ans += upper_bound(v[y+p].begin(),v[y+p].end(),x+m) -
lower_bound(v[y+p].begin(),v[y+p].end(),x-m);
}
}
cout << ans << endl;
}
}#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
vector<int> v[10000];
int main(){
int aN,bN,R;
while(cin >> aN >> bN >> R , aN){
for(int i = 0 ; i < 10000 ; i++) v.clear();
for(int i = 0 ; i < aN ; i++){
int x,y;
cin >> x >> y;
v[y].push_back(x);
}
for(int i = 0 ; i < 10000 ; i++)
sort(v[i].begin(),v[i].end());
int D = 4 * R , ans = 0 ;
for(int i = 0 ; i < bN ; i++){
int x,y;
cin >> x >> y;
for(int p = -D ; p <= D ; p++){
if(y+p < 0 || y+p >= 10000) continue;
int m = sqrt( D*D - p*p );
ans += upper_bound(v[y+p].begin(),v[y+p].end(),x+m) -
lower_bound(v[y+p].begin(),v[y+p].end(),x-m);
}
}
cout << ans << endl;
}
} | a.cc:35:2: error: stray '#' in program
35 | }#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:14:52: error: request for member 'clear' in 'v', which is of non-class type 'std::vector<int> [10000]'
14 | for(int i = 0 ; i < 10000 ; i++) v.clear();
| ^~~~~
a.cc: At global scope:
a.cc:35:3: error: 'include' does not name a type
35 | }#include <iostream>
| ^~~~~~~
a.cc:43:13: error: redefinition of 'std::vector<int> v [10000]'
43 | vector<int> v[10000];
| ^
a.cc:9:13: note: 'std::vector<int> v [10000]' previously declared here
9 | vector<int> v[10000];
| ^
a.cc:45:5: error: redefinition of 'int main()'
45 | int main(){
| ^~~~
a.cc:11:5: note: 'int main()' previously defined here
11 | int main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:48:52: error: request for member 'clear' in 'v', which is of non-class type 'std::vector<int> [10000]'
48 | for(int i = 0 ; i < 10000 ; i++) v.clear();
| ^~~~~
|
s765752055 | p00609 | C++ | for(;;){
if(0){
}else if(c[j][(xmn+xmx)/2+1]<=vmx){
xmn=(xmn+xmx)/2+1;
}else if(c[j][(xmn+xmx)/2]>vmx){
xmx=(xmn+xmx)/2-1;
}else{
break;
}
}
}
sm+=(xmn+xmx)/2-(nmn+nmx)/2+1;
}
}
}
cout<<sm<<endl;
}
return 0;
} | a.cc:1:13: error: expected unqualified-id before 'for'
1 | for(;;){
| ^~~
a.cc:1:19: error: expected unqualified-id before ')' token
1 | for(;;){
| ^
a.cc:11:11: error: expected declaration before '}' token
11 | }
| ^
a.cc:12:11: error: 'sm' does not name a type
12 | sm+=(xmn+xmx)/2-(nmn+nmx)/2+1;
| ^~
a.cc:13:9: error: expected declaration before '}' token
13 | }
| ^
a.cc:14:7: error: expected declaration before '}' token
14 | }
| ^
a.cc:15:5: error: expected declaration before '}' token
15 | }
| ^
a.cc:16:5: error: 'cout' does not name a type
16 | cout<<sm<<endl;
| ^~~~
a.cc:17:3: error: expected declaration before '}' token
17 | }
| ^
a.cc:18:3: error: expected unqualified-id before 'return'
18 | return 0;
| ^~~~~~
a.cc:19:1: error: expected declaration before '}' token
19 | }
| ^
|
s102409558 | p00609 | C++ | #include<stdio.h>
#include<string.h>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 100010
#define eps 1e-8
struct Nodes{
int x,y;
}p1[maxn],p2[maxn];
vector<int>vect[10010];
int n,m,r;
double ly,ry;
bool cmp(Nodes a,Nodes b)
{
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
double sqr(double x)
{
return x*x;
}
void cal(int x,Nodes s)
{
double tmp;
tmp=sqr(4*r+0.0)+0.0-sqr(x-s.x+0.0);
ly=s.y-sqrt(tmp)-eps;
ry=s.y+sqrt(tmp)+eps;
}
int main()
{
int i,j,k;
int ans,L,R;
int k1,k2;
double tmp;
while(scanf("%d%d%d",&n,&m,&r),n+m+r){
for(i=1;i<=n;i++){
scanf("%d%d",&p1[i].x,&p1[i].y);
}
for(i=1;i<=m;i++){
scanf("%d%d",&p2[i].x,&p2[i].y);
}
sort(p2+1,p2+m+1,cmp);
for(i=0;i<10000;i++){
vect[i].clear();
}
for(i=1;i<=m;i++){
for(j=i;j<=m;j++){
if(p2[j].x!=p2[i].x)break;
vect[p2[i].x].push_back(p2[j].y);
}
}
ans=0;
for(i=1;i<=n;i++){
L=max(0,p1[i].x-4*r);
R=min(9999,p1[i].x+4*r);
for(j=L;j<=R;j++){
cal(j,p1[i]);
//printf("%d %lf %lf\n",j,ly,ry);
k1=lower_bound(vect[j].begin(),vect[j].end(),ly)-vect[j].begin();
k2=upper_bound(vect[j].begin(),vect[j].end(),ry)-vect[j].begin();
//printf("**%d %d\n",k1,k2);
ans+=k2-k1;
}
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'void cal(int, Nodes)':
a.cc:28:16: error: 'sqrt' was not declared in this scope; did you mean 'sqr'?
28 | ly=s.y-sqrt(tmp)-eps;
| ^~~~
| sqr
|
s933099538 | p00609 | C++ | #include <iostream>
#include <complex>
using namespace std;
#define P complex<int>
//#define P complex<double>
#define EPS 1e-4
#define DEBUG false
int an,bn,r;
P a[10000], b;
int searchX(int lb, int ub, int search ){ // ( -1,an )
while( ub-lb>1 ){
int mid = (lb+ub)/2;
if( a[mid].real() >=search ) ub=mid;
else lb=mid;
}
return ub;
}
int searchY( int lb, int ub, int search ){
while( ub-lb>1 ){
int mid=(lb+ub)/2;
if( a[mid].imag() >= search ) ub=mid;
else lb=mid;
}
return ub;
}
int main(){
while( cin>>an>>bn>>r && (an||bn) ){
for( int i=0;i<an;i++ )
cin >> a[i].real() >> a[i].imag();
bool flag;
do{
flag=false;
for( int i=1;i<an;i++ ){
if( a[i-1].real() > a[i].real() ||
(a[i-1].real()==a[i].real() && a[i-1].imag() > a[i].imag() )){
P p=a[i-1]; a[i-1]=a[i]; a[i]=p;
flag=true;
}
}
}while( flag );
if( DEBUG )
for( int i=0;i<an;i++ )
cout << i << " " << a[i] << endl;
int ans=0;
for( int i=0;i<bn;i++ ){
cin >> b.real() >> b.imag();
if( DEBUG )
cout << "b: "<<b << endl;
// a[lb] ~ a[ub-1] の範囲で a[.].real()=search となる
int lb = searchX( -1,an, b.real()-4*r );
int ub = searchX( lb,an, b.real()+4*r+1 );
int j = searchY( lb,ub, b.imag()-4*r );
int end = searchY( j ,ub, b.imag()+4*r+1 );
if( DEBUG )
cout << " lb="<<lb << " ub=" << ub
<< " j="<< j << " end=" << end << endl;
for( ; j<end;j++ ){
if( abs(a[j]-b) - 4.0*r < EPS )
ans++;
}
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:11: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
33 | cin >> a[i].real() >> a[i].imag();
| ~~~ ^~ ~~~~~~~~~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'int'
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: invalid conversion from 'int' to 'void*' [-fpermissive]
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
| |
| int
a.cc:33:23: error: cannot bind rvalue '(void*)((long int)a[i].std::complex<int>::real())' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: invalid conversion from 'int' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
| |
| int
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:33:23: error: invalid conversion from 'int' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
33 | cin >> a[i].real() >> a[i].imag();
| ~~~~~~~~~^~
| |
| int
/usr/inclu |
s478258939 | p00609 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int tile[10000][10000];
int r;
void printDebug(){
for(int i = 0; i < 10; i++){
for(int j = 0; j < 10; j++){
cout << tile[i][j];
}
cout << "\n";
}
}
void powerPlus(int x, int y, int coordinate[r+1]){
tile[x][y]++; // これは正直どっちでもいい
for(int i = 1; i <= r; i++){
if(x+i < 10000) tile[y][x+i]++;
if(x-i >= 0) tile[y][x-i]++;
if(y+i < 10000) tile[y+i][x]++;
if(y-i >= 0) tile[y-i][x]++;
}
for(int i = 1; i <= r; i++){
for(int j = 1; j <= coordinate[i]; j++){
if(y+i < 10000){
if(x+j < 10000) tile[y+i][x+j]++;
if(x-j >= 0) tile[y+i][x-j]++;
}
if(y-i >= 0){
if(x+j < 10000) tile[y-i][x+j]++;
if(x-j >= 0) tile[y-i][x-j]++;
}
}
}
};
int main(int argc, const char * argv[])
{
int an, bn;
while(true){
cin >> an >> bn >> r;
r = 4 * r;
if(an == 0 && bn == 0 && r == 0) return 0;
int coordinate[r+1];
coordinate[0] = r;
for(int i = 1; i < r; i++){
coordinate[i] = sqrt(r*r - i*i);
// cout << i << " " << coordinate[i] << "\n"; // DEBUG
}
coordinate[r] = 0;
if(an == 0 && bn == 0) return 0;
for(int i = 0; i < an; i++){
int xa, ya;
cin >> xa >> ya;
powerPlus(ya, xa, coordinate);
// printDebug(); // DEBUG
}
int sum = 0;
for(int i = 0; i < bn; i++){
int xb, yb;
cin >> xb >> yb;
sum += tile[yb][xb];
}
cout << sum;
}
return 0;
} | a.cc:17:46: error: size of array 'coordinate' is not an integral constant-expression
17 | void powerPlus(int x, int y, int coordinate[r+1]){
| ~^~
|
s708766094 | p00609 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int tile[10000][10000];
int r;
void powerPlus(int x, int y, int coordinate[r+1]){
tile[x][y]++; // これは正直どっちでもいい
for(int i = 1; i <= r; i++){
if(x+i < 10000) tile[y][x+i]++;
if(x-i >= 0) tile[y][x-i]++;
if(y+i < 10000) tile[y+i][x]++;
if(y-i >= 0) tile[y-i][x]++;
}
for(int i = 1; i <= r; i++){
for(int j = 1; j <= coordinate[i]; j++){
if(y+i < 10000){
if(x+j < 10000) tile[y+i][x+j]++;
if(x-j >= 0) tile[y+i][x-j]++;
}
if(y-i >= 0){
if(x+j < 10000) tile[y-i][x+j]++;
if(x-j >= 0) tile[y-i][x-j]++;
}
}
}
};
int main(int argc, const char * argv[])
{
int an, bn;
while(true){
cin >> an >> bn >> r;
r = 4 * r;
if(an == 0 && bn == 0 && r == 0) return 0;
int coordinate[r+1];
coordinate[0] = r;
for(int i = 1; i < r; i++){
coordinate[i] = sqrt(r*r - i*i);
// cout << i << " " << coordinate[i] << "\n"; // DEBUG
}
coordinate[r] = 0;
if(an == 0 && bn == 0) return 0;
for(int i = 0; i < an; i++){
int xa, ya;
cin >> xa >> ya;
powerPlus(ya, xa, coordinate);
// printDebug(); // DEBUG
}
int sum = 0;
for(int i = 0; i < bn; i++){
int xb, yb;
cin >> xb >> yb;
sum += tile[yb][xb];
}
cout << sum;
}
return 0;
} | a.cc:8:46: error: size of array 'coordinate' is not an integral constant-expression
8 | void powerPlus(int x, int y, int coordinate[r+1]){
| ~^~
|
s612064232 | p00609 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int tile[10000][10000];
int r;
void powerPlus(int x, int y, int coordinate[r+1]);
void powerPlus(int x, int y, int coordinate[r+1]){
tile[x][y]++; // これは正直どっちでもいい
for(int i = 1; i <= r; i++){
if(x+i < 10000) tile[y][x+i]++;
if(x-i >= 0) tile[y][x-i]++;
if(y+i < 10000) tile[y+i][x]++;
if(y-i >= 0) tile[y-i][x]++;
}
for(int i = 1; i <= r; i++){
for(int j = 1; j <= coordinate[i]; j++){
if(y+i < 10000){
if(x+j < 10000) tile[y+i][x+j]++;
if(x-j >= 0) tile[y+i][x-j]++;
}
if(y-i >= 0){
if(x+j < 10000) tile[y-i][x+j]++;
if(x-j >= 0) tile[y-i][x-j]++;
}
}
}
}
int main(int argc, const char * argv[])
{
int an, bn;
while(true){
cin >> an >> bn >> r;
r = 4 * r;
if(an == 0 && bn == 0 && r == 0) return 0;
int coordinate[r+1];
coordinate[0] = r;
for(int i = 1; i < r; i++){
coordinate[i] = sqrt(r*r - i*i);
// cout << i << " " << coordinate[i] << "\n"; // DEBUG
}
coordinate[r] = 0;
if(an == 0 && bn == 0) return 0;
for(int i = 0; i < an; i++){
int xa, ya;
cin >> xa >> ya;
powerPlus(ya, xa, coordinate);
// printDebug(); // DEBUG
}
int sum = 0;
for(int i = 0; i < bn; i++){
int xb, yb;
cin >> xb >> yb;
sum += tile[yb][xb];
}
cout << sum;
}
return 0;
} | a.cc:8:46: error: size of array 'coordinate' is not an integral constant-expression
8 | void powerPlus(int x, int y, int coordinate[r+1]);
| ~^~
a.cc:10:46: error: size of array 'coordinate' is not an integral constant-expression
10 | void powerPlus(int x, int y, int coordinate[r+1]){
| ~^~
|
s261910576 | p00609 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int tile[10000][10000];
int r;
void powerPlus(int x, int y, const int coordinate[r+1]){
tile[x][y]++; // これは正直どっちでもいい
for(int i = 1; i <= r; i++){
if(x+i < 10000) tile[y][x+i]++;
if(x-i >= 0) tile[y][x-i]++;
if(y+i < 10000) tile[y+i][x]++;
if(y-i >= 0) tile[y-i][x]++;
}
for(int i = 1; i <= r; i++){
for(int j = 1; j <= coordinate[i]; j++){
if(y+i < 10000){
if(x+j < 10000) tile[y+i][x+j]++;
if(x-j >= 0) tile[y+i][x-j]++;
}
if(y-i >= 0){
if(x+j < 10000) tile[y-i][x+j]++;
if(x-j >= 0) tile[y-i][x-j]++;
}
}
}
};
int main(int argc, const char * argv[])
{
int an, bn;
while(true){
cin >> an >> bn >> r;
r = 4 * r;
if(an == 0 && bn == 0 && r == 0) return 0;
int coordinate[r+1];
coordinate[0] = r;
for(int i = 1; i < r; i++){
coordinate[i] = sqrt(r*r - i*i);
// cout << i << " " << coordinate[i] << "\n"; // DEBUG
}
coordinate[r] = 0;
if(an == 0 && bn == 0) return 0;
for(int i = 0; i < an; i++){
int xa, ya;
cin >> xa >> ya;
powerPlus(ya, xa, coordinate);
// printDebug(); // DEBUG
}
int sum = 0;
for(int i = 0; i < bn; i++){
int xb, yb;
cin >> xb >> yb;
sum += tile[yb][xb];
}
cout << sum;
}
return 0;
} | a.cc:8:52: error: size of array 'coordinate' is not an integral constant-expression
8 | void powerPlus(int x, int y, const int coordinate[r+1]){
| ~^~
|
s624237115 | p00612 | C++ | import java.lang.*;
import java.math.*;
import java.util.*;
class Main{
public static void main(String s[]){
Scanner sc = new Scanner(System.in);
BigInteger TWO=new BigInteger("2");
BigInteger FOUR=new BigInteger("4");
BigInteger EIGHT=new BigInteger("8");
while(true){
BigInteger biN = sc.nextBigInteger();
if( biN.equals( BigInteger.ZERO) ) break;
BigInteger biT = (biN.subtract(FOUR)).divide(TWO).add(BigInteger.ONE);
//System.out.println( biT );
biN=biN.multiply(TWO).multiply(biN).add( biN.multiply(EIGHT) );
//System.out.println(biN);
biT=biT.multiply(FOUR).multiply(biT.add(BigInteger.ONE));
BigInteger ans = biN.subtract( biT );
//System.out.println( biT );
if(biN.equals(new BigInteger("64")))ans=new BigInteger("64");
System.out.println( ans );
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.lang.*;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.math.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.*;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:11: error: expected ':' before 'static'
7 | public static void main(String s[]){
| ^~~~~~~
| :
a.cc:7:29: error: 'String' has not been declared
7 | public static void main(String s[]){
| ^~~~~~
a.cc:27:2: error: expected ';' after class definition
27 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:8:9: error: 'Scanner' was not declared in this scope
8 | Scanner sc = new Scanner(System.in);
| ^~~~~~~
a.cc:9:9: error: 'BigInteger' was not declared in this scope
9 | BigInteger TWO=new BigInteger("2");
| ^~~~~~~~~~
a.cc:10:20: error: expected ';' before 'FOUR'
10 | BigInteger FOUR=new BigInteger("4");
| ^~~~
a.cc:11:20: error: expected ';' before 'EIGHT'
11 | BigInteger EIGHT=new BigInteger("8");
| ^~~~~
a.cc:13:24: error: expected ';' before 'biN'
13 | BigInteger biN = sc.nextBigInteger();
| ^~~
a.cc:14:17: error: 'biN' was not declared in this scope
14 | if( biN.equals( BigInteger.ZERO) ) break;
| ^~~
a.cc:15:24: error: expected ';' before 'biT'
15 | BigInteger biT = (biN.subtract(FOUR)).divide(TWO).add(BigInteger.ONE);
| ^~~
a.cc:17:13: error: 'biN' was not declared in this scope
17 | biN=biN.multiply(TWO).multiply(biN).add( biN.multiply(EIGHT) );
| ^~~
a.cc:17:30: error: 'TWO' was not declared in this scope
17 | biN=biN.multiply(TWO).multiply(biN).add( biN.multiply(EIGHT) );
| ^~~
a.cc:17:67: error: 'EIGHT' was not declared in this scope
17 | biN=biN.multiply(TWO).multiply(biN).add( biN.multiply(EIGHT) );
| ^~~~~
a.cc:19:13: error: 'biT' was not declared in this scope
19 | biT=biT.multiply(FOUR).multiply(biT.add(BigInteger.ONE));
| ^~~
a.cc:19:30: error: 'FOUR' was not declared in this scope
19 | biT=biT.multiply(FOUR).multiply(biT.add(BigInteger.ONE));
| ^~~~
a.cc:20:24: error: expected ';' before 'ans'
20 | BigInteger ans = biN.subtract( biT );
| ^~~
a.cc:22:31: error: expected type-specifier before 'BigInteger'
22 | if(biN.equals(new BigInteger("64")))ans=new BigInteger("64");
| ^~~~~~~~~~
a.cc:22:49: error: 'ans' was not declared in this scope
22 | if(biN.equals(new BigInteger("64")))ans=new BigInteger("64");
| ^~~
a.cc:22:57: error: expected type-specifier before 'BigInteger'
22 | if(biN.equals(new BigInteger("64")))ans=new BigInteger("64");
| ^~~~~~~~~~
a.cc:23:13: error: 'System' was not declared in this scope
23 | System.out.println( ans );
| ^~~~~~
a.cc:23:33: error: 'ans' was not declared in this scope
23 | System.out.println( ans );
| ^~~
|
s526558419 | p00612 | C++ | #include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
ll n;
while(cin >> n, n){
ll t = n/2;
ll sum = 0;
for(int i = 1 ; i*i < t ; i++){
sum += (n-2*i-1)/(i-1);
}
cout << (n+sum)*8 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:2: error: expected '}' at end of input
19 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s056899801 | p00613 | Java | import java.util.Scanner;
public class CakeMain {
private int x;//cake sum
private int y;
private int[] card;
private int sum;
Scanner in =new Scanner(System.in);
public CakeMain(){
x=in.nextInt();
if (x==0){
return;
}
}
public static void main(String[] args){
CakeMain ck=new CakeMain();
ck.com();
ck.rd();
ck.run();
}
private void run() {
// TODO ?????????????????????????????????????????????
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/2);
}
private void com() {
// TODO ?????????????????????????????????????????????
y=x*(x-1)/2;
}
private void rd() {
// TODO ?????????????????????????????????????????????
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:3: error: class CakeMain is public, should be declared in a file named CakeMain.java
public class CakeMain {
^
1 error
|
s078997973 | p00613 | Java | import java.util.Scanner;
public class CakeMain {
private int x;
private int y;
private int[] card;
private int sum;
Scanner in =new Scanner(System.in);
public CakeMain(){
x=in.nextInt();
if (x==0){
return;
}
}
public static void main(String[] args){
CakeMain ck=new CakeMain();
ck.com();
ck.rd();
ck.run();
}
private void run() {
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/2);
}
private void com() {
y=x*(x-1)/2;
}
private void rd() {
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:3: error: class CakeMain is public, should be declared in a file named CakeMain.java
public class CakeMain {
^
1 error
|
s117692503 | p00613 | Java | import java.util.Scanner;
class Main {
private int x;
private int y;
private int[] card;
private int sum;
Scanner in =new Scanner(System.in);
public CakeMain(){
x=in.nextInt();
if (x==0){
return;
}
}
public static void main(String[] args){
CakeMain ck=new CakeMain();
ck.com();
ck.rd();
ck.run();
}
private void run() {
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/2);
}
private void com() {
y=x*(x-1)/2;
}
private void rd() {
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:9: error: invalid method declaration; return type required
public CakeMain(){
^
1 error
|
s323708525 | p00613 | Java | import java.util.Scanner;
class Main {
private int x;
private int y;
private int[] card;
private int sum;
Scanner in =new Scanner(System.in);
public CakeMain(){
x=in.nextInt();
if (x==0){
return;
}
}
public static void main(String[] args){
CakeMain ck=new Main();
ck.com();
ck.rd();
ck.run();
}
private void run() {
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/2);
}
private void com() {
y=x*(x-1)/2;
}
private void rd() {
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:9: error: invalid method declaration; return type required
public CakeMain(){
^
1 error
|
s080175746 | p00613 | Java | import java.util.Scanner;
class Main {
private int x;
private int y;
private int[] card;
private int sum;
Scanner in =new Scanner(System.in);
public Main(){
x=in.nextInt();
if (x==0){
return;
}
}
public static void main(String[] args){
CakeMain ck=new Main();
ck.com();
ck.rd();
ck.run();
}
private void run() {
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/2);
}
private void com() {
y=x*(x-1)/2;
}
private void rd() {
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:19: error: cannot find symbol
CakeMain ck=new Main();
^
symbol: class CakeMain
location: class Main
1 error
|
s173870700 | p00613 | Java | import java.util.Scanner;
class Main {
private int x;//cake sum
private int y;
private int[] card;
private int sum;
private static int f=0;
Scanner in =new Scanner(System.in);
public Main(){
x=in.nextInt();
if (x==0){
f=1;
return;
}
}
public static void main(String[] args){
while(true){
Main ck=new Main();
if(f==1){
return;
}
ck.com();
if(f==2){
f=0;
continue();
}
ck.rd();
ck.run();
}
}
private void run() {
// TODO ?????????????????????????????????????????????
for(int i=0;i<y;i++){
sum+=card[i];
}
System.out.println(sum/(x-1));
}
private void com() {
// TODO ?????????????????????????????????????????????
if(x==2){
y=in.nextInt();
System.out.println(2);
f=2;
return;
}
y=x*(x-1)/2;
}
private void rd() {
// TODO ?????????????????????????????????????????????
card=new int[y];
for(int i=0;i<y;i++){
card[i]=in.nextInt();
}
}
} | Main.java:29: error: ';' expected
continue();
^
1 error
|
s817839862 | p00613 | C | #include <stdio.h>
int main (){
int K,c,i,sum,;
while (1){
scanf("%d",&K);
if (K==0)break;
sum=0;
for (i=0 ; i < (K*K-K)/2 ; i++){
scanf("%d",&c);
sum=sum+c;
}
printf("%d\n",sum/(K-1) );
}
return 0;
} | main.c: In function 'main':
main.c:4:17: error: expected identifier or '(' before ';' token
4 | int K,c,i,sum,;
| ^
|
s286351879 | p00613 | C | #include <stdio.h>
int main (){
int K,c,i,sum,;
while (1){
scanf("%d",&K);
if (K==0)break;
sum=0;
for (i=0 ; i < (K*K-K)/2 ; i++){
scanf("%d",&c);
sum=sum+c;
}
printf("%d\n",sum/(K-1) );
}
return 0;
} | main.c: In function 'main':
main.c:4:17: error: expected identifier or '(' before ';' token
4 | int K,c,i,sum,;
| ^
|
s850350598 | p00613 | C | #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;
static const double EPS = 1e-8;
int main(){
int K,c;
while(~scanf("%d",&K)){
if(K==0) break;
int sum=0;
for(int i=0;i<K*(K-1)/2;i++){
int c;
scanf("%d",&c);
sum += c;
}
printf("%d\n",sum/(K-1));
}
} | main.c:3:10: fatal error: iostream: No such file or directory
3 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s863698466 | p00613 | C | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
int sum,i,a,n;
int main(){
while (scanf("%d",&n),n){
sum=0;
for (i=1;i<=(n-1)*n/2;i++){
scanf("%d",&a);
sum+=a;
}
sum=sum/(n-1);
printf("%d\n",sum);
}
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s586800423 | p00613 | C | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n,a[100100];
int main(){
while(scanf("%d",&n)==1){
if(n==0) break;
int sum=0;
for(int i=1;i<=(n*(n-1))/2;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
sum/=n-1;
printf("%d\n",sum);
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s800216854 | p00613 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s340829914 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break
}
else{
for(int i=0;i<K;++i){
cin >> c
m += c;
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:14: error: expected ';' before '}' token
10 | break
| ^
| ;
11 | }
| ~
a.cc:14:16: error: 'c' was not declared in this scope
14 | cin >> c
| ^
|
s612841434 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break
}
else{
for(int i=0;i<K;++i){
cin >> c
m += c;
}
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:14: error: expected ';' before '}' token
10 | break
| ^
| ;
11 | }
| ~
a.cc:14:16: error: 'c' was not declared in this scope
14 | cin >> c
| ^
a.cc: At global scope:
a.cc:23:5: error: expected unqualified-id before 'return'
23 | return 0;
| ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
24 | }
| ^
|
s351497458 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break;
}
else{
for(int i=0;i<K;++i){
cin >> c;
m += c;
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:16: error: 'c' was not declared in this scope
14 | cin >> c;
| ^
|
s382386864 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break;
}
else{
for(int i=0;i<K;++i){
cin >> c;
m += c;
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:16: error: 'c' was not declared in this scope
14 | cin >> c;
| ^
|
s171133481 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break;
}
else{
for(int i=0;i<K;++i){
cin >> c;
m += c;
}
}
}
int r;
r = m/(K-1);
cout << r << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:16: error: 'c' was not declared in this scope
14 | cin >> c;
| ^
|
s306143353 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break;
}
else{
for(int i=0;i<K(K-1)/2;++i){
int c;
cin >> c;
m += c;
}
}
}
int r;
r = m/(K-1);
cout << r << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:20: error: 'K' cannot be used as a function
13 | for(int i=0;i<K(K-1)/2;++i){
| ~^~~~~
|
s506624878 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
int m;
while(cin >> K){
if (K == 0){
break;
}
else{
for(int i=0;i<K(K-1)/2;++i){
int c;
cin >> c;
m += c;
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:20: error: 'K' cannot be used as a function
13 | for(int i=0;i<K(K-1)/2;++i){
| ~^~~~~
|
s562281218 | p00613 | C++ | #include<iostream>
#include<string>
using namespace std;
int main() {
int K;
while(cin >> K){
if (K == 0){
break;
}
else{
int m;
for(int i=0;i<K*(K-1)/2;++i){
int c;
cin >> c;
m += c;
}
}
int r;
r = m/(K-1);
cout << r << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:9: error: 'm' was not declared in this scope
20 | r = m/(K-1);
| ^
|
s370199770 | p00613 | C++ | int main() {
int K;
while(cin >> K){
if (K == 0){
break;
}
else{
int m;
for(int i=0;i<K*(K-1)/2;++i){
int c;
cin >> c;
m += c;
}
int r;
r = m/(K-1);
cout << r << endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:3:10: error: 'cin' was not declared in this scope
3 | while(cin >> K){
| ^~~
a.cc:16:5: error: 'cout' was not declared in this scope
16 | cout << r << endl;
| ^~~~
a.cc:16:18: error: 'endl' was not declared in this scope
16 | cout << r << endl;
| ^~~~
|
s040389681 | p00613 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int k,sum=0;
vector<int> c(n);
while(1){
cin >> k;
if(k==0) break;
for(int i=0;i<k*(k-1)/2,i++){
cin >> c[i];
sum += c[i];
}
cout >> sum/(k-1) >> endl;
}
}
| a.cc: In function 'int main()':
a.cc:8:19: error: 'n' was not declared in this scope
8 | vector<int> c(n);
| ^
a.cc:12:36: error: expected ';' before ')' token
12 | for(int i=0;i<k*(k-1)/2,i++){
| ^
| ;
a.cc:16:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
16 | cout >> sum/(k-1) >> endl;
| ~~~~ ^~ ~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:16:10: note: candidate: 'operator>>(int, int)' (built-in)
16 | cout >> sum/(k-1) >> endl;
| ~~~~~^~~~~~~~~~~~
a.cc:16:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:16:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
16 | cout >> sum/(k-1) >> endl;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:16:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:16:21: required from here
16 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s760097437 | p00613 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
while(1){
int k,sum;
cin >> k;
int n = k*(k-1)/2;
vector<int> c(n);
if(k==0) break;
for(int i=0;i<n,i++){
cin >> c[i];
sum += c[i];
}
cout >> sum/(k-1) >> endl;
}
}
| a.cc: In function 'int main()':
a.cc:13:28: error: expected ';' before ')' token
13 | for(int i=0;i<n,i++){
| ^
| ;
a.cc:17:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
17 | cout >> sum/(k-1) >> endl;
| ~~~~ ^~ ~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:17:10: note: candidate: 'operator>>(int, int)' (built-in)
17 | cout >> sum/(k-1) >> endl;
| ~~~~~^~~~~~~~~~~~
a.cc:17:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:17:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
17 | cout >> sum/(k-1) >> endl;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:17:21: required from here
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s536153016 | p00613 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
while(1){
int k,sum;
cin >> k;
int n = k*(k-1)/2;
vector<int> c(n);
if(k==0) break;
for(int i=0;i<n;i++){
cin >> c[i];
sum += c[i];
}
cout >> sum/(k-1) >> endl;
}
}
| a.cc: In function 'int main()':
a.cc:17:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
17 | cout >> sum/(k-1) >> endl;
| ~~~~ ^~ ~~~~~~~~~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:17:10: note: candidate: 'operator>>(int, int)' (built-in)
17 | cout >> sum/(k-1) >> endl;
| ~~~~~^~~~~~~~~~~~
a.cc:17:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
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/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:17:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
17 | cout >> sum/(k-1) >> endl;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:17:21: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]':
a.cc:17:21: required from here
17 | cout >> sum/(k-1) >> endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s966950148 | p00613 | C++ | {
all=0;
for(int i=0;i<k*(k-1)/2;i++){
cin>>c[i];
all+=c[i];}
cout << all/(k-1)<<endl;} | a.cc:1:1: error: expected unqualified-id before '{' token
1 | {
| ^
|
s661392643 | p00613 | C++ | #include<iostream>
using namespace std;
int main(){
int k,c[100];
long long long all;
while(cin >>k && k!=0){
all=0;
for(int i=0;i<k*(k-1)/2;i++){
cin>>c[i];
all+=c[i];}
cout << all/(k-1)<<endl;}
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:13: error: 'long long long' is too long for GCC
5 | long long long all;
| ^~~~
|
s236623757 | p00613 | C++ |
import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeMap;
public class Main {
static PrintWriter out = new PrintWriter(System.out);
static FastScanner sc = new FastScanner();
static Scanner stdIn = new Scanner(System.in);
static TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();
public static void main(String[] args) {
while(true) {
int k = sc.nextInt();
if(k == 0) break;
int count = 0;
int tmp = k*(k-1)/2;
for(int i = 0; i < tmp; i++) {
count += sc.nextInt();
}
out.println(count /(k-1));
}
out.flush();
}
}
//------------------------------//
//-----------//
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
}else{
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
public boolean hasNext() { skipUnprintable(); return hasNextByte();}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while(isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true){
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
}else if(b == -1 || !isPrintableChar(b)){
return minus ? -n : n;
}else{
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
if (!hasNext()) throw new NoSuchElementException();
int n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while(true){
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
}else if(b == -1 || !isPrintableChar(b)){
return minus ? -n : n;
}else{
throw new NumberFormatException();
}
b = readByte();
}
}
public double nextDouble() {
return Double.parseDouble(next());
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.awt.geom.Point2D;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.*;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.math.BigInteger;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.ArrayDeque;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.ArrayList;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.Arrays;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.util.Collections;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.util.Comparator;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import java.util.Deque;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import java.util.HashMap;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: 'import' does not name a type
12 | import java.util.HashSet;
| ^~~~~~
a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:1: error: 'import' does not name a type
13 | import java.util.List;
| ^~~~~~
a.cc:13:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:14:1: error: 'import' does not name a type
14 | import java.util.NoSuchElementException;
| ^~~~~~
a.cc:14:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:15:1: error: 'import' does not name a type
15 | import java.util.PriorityQueue;
| ^~~~~~
a.cc:15:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:1: error: 'import' does not name a type
16 | import java.util.Scanner;
| ^~~~~~
a.cc:16:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:17:1: error: 'import' does not name a type
17 | import java.util.Stack;
| ^~~~~~
a.cc:17:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:18:1: error: 'import' does not name a type
18 | import java.util.TreeMap;
| ^~~~~~
a.cc:18:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:22:1: error: expected unqualified-id before 'public'
22 | public class Main {
| ^~~~~~
a.cc:46:12: error: expected ':' before 'final'
46 | private final InputStream in = System.in;
| ^~~~~~
| :
a.cc:46:13: error: 'final' does not name a type
46 | private final InputStream in = System.in;
| ^~~~~
a.cc:47:12: error: expected ':' before 'final'
47 | private final byte[] buffer = new byte[1024];
| ^~~~~~
| :
a.cc:47:13: error: 'final' does not name a type
47 | private final byte[] buffer = new byte[1024];
| ^~~~~
a.cc:48:12: error: expected ':' before 'int'
48 | private int ptr = 0;
| ^~~~
| :
a.cc:49:12: error: expected ':' before 'int'
49 | private int buflen = 0;
| ^~~~
| :
a.cc:50:12: error: expected ':' before 'boolean'
50 | private boolean hasNextByte() {
| ^~~~~~~~
| :
a.cc:50:13: error: 'boolean' does not name a type; did you mean 'bool'?
50 | private boolean hasNextByte() {
| ^~~~~~~
| bool
a.cc:66:12: error: expected ':' before 'int'
66 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
| ^~~~
| :
a.cc:67:12: error: expected ':' before 'static'
67 | private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
| ^~~~~~~
| :
a.cc:67:20: error: 'boolean' does not name a type; did you mean 'bool'?
67 | private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
| ^~~~~~~
| bool
a.cc:68:12: error: expected ':' before 'void'
68 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
| ^~~~~
| :
a.cc:69:11: error: expected ':' before 'boolean'
69 | public boolean hasNext() { skipUnprintable(); return hasNextByte();}
| ^~~~~~~~
| :
a.cc:69:12: error: 'boolean' does not name a type; did you mean 'bool'?
69 | public boolean hasNext() { skipUnprintable(); return hasNextByte();}
| ^~~~~~~
| bool
a.cc:70:11: error: expected ':' before 'String'
70 | public String next() {
| ^~~~~~~
| :
a.cc:70:12: error: 'String' does not name a type
70 | public String next() {
| ^~~~~~
a.cc:80:11: error: expected ':' before 'long'
80 | public long nextLong() {
| ^~~~~
| :
a.cc:105:11: error: expected ':' before 'int'
105 | public int nextInt() {
| ^~~~
| :
a.cc:130:11: error: expected ':' before 'double'
130 | public double nextDouble() {
| ^~~~~~~
| :
a.cc:135:2: error: expected ';' after class definition
135 | }
| ^
| ;
a.cc: In member function 'int FastScanner::readByte()':
a.cc:66:34: error: 'hasNextByte' was not declared in this scope
66 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
| ^~~~~~~~~~~
a.cc:66:56: error: 'buffer' was not declared in this scope; did you mean 'buflen'?
66 | private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
| ^~~~~~
| buflen
a.cc: In member function 'void FastScanner::skipUnprintable()':
a.cc:68:44: error: 'hasNextByte' was not declared in this scope
68 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
| ^~~~~~~~~~~
a.cc:68:78: error: 'buffer' was not declared in this scope; did you mean 'buflen'?
68 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
| ^~~~~~
| buflen
a.cc:68:62: error: 'isPrintableChar' was not declared in this scope
68 | private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
| ^~~~~~~~~~~~~~~
a.cc: In member function 'long int FastScanner::nextLong()':
a.cc:81:14: error: 'hasNext' was not declared in this scope
81 | if (!hasNext()) throw new NoSuchElementException();
| ^~~~~~~
a.cc:81:35: error: expected type-specifier before 'NoSuchElementException'
81 | if (!hasNext()) throw new NoSuchElementException();
| ^~~~~~~~~~~~~~~~~~~~~~
a.cc:83:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
83 | boolean minus = false;
| ^~~~~~~
| bool
a.cc:86:13: error: 'minus' was not declared in this scope
86 | minus = true;
| ^~~~~
a.cc:90:23: error: expected type-specifier before 'NumberFormatException'
90 | throw new NumberFormatException();
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:96:34: error: 'isPrintableChar' was not declared in this scope
96 | }else if(b == -1 || !isPrintableChar(b)){
| ^~~~~~~~~~~~~~~
a.cc:97:24: error: 'minus' was not declared in this scope
97 | return minus ? -n : n;
| ^~~~~
a.cc:99:27: error: expected type-specifier before 'NumberFormatException'
99 | throw new NumberFormatException();
| ^~~~~~~~~~~~~~~~~~~~~
a.cc: In member function 'int FastScanner::nextInt()':
a.cc:106:15: error: 'hasNext' was not declared in this scope
106 | if (!hasNext()) throw new NoSuchElementException();
| ^~~~~~~
a.cc:106:36: error: expected type-specifier before 'NoSuchElementException'
106 | if (!hasNext()) throw new NoSuchElementException();
| ^~~~~~~~~~~~~~~~~~~~~~
a.cc:108:10: error: 'boolean' was not declared in this scope; did you mean 'bool'?
108 | boolean minus = false;
| ^~~~~~~
| bool
a.cc:111:14: error: 'minus' was not declared in this scope
111 | minus = true;
| ^~~~~
a.cc:115:24: error: expected type-specifier before 'NumberFormatException'
115 | throw new NumberFormatException();
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:121:35: error: 'isPrintableChar' was not declared in this scope
121 | }else if(b == -1 || !isPrintableChar(b)){
| ^~~~~~~~~~~~~~~
a.cc:122:25: error: 'minus' was not declared in this scope
122 | return minus ? -n : n;
| ^~~~~
a.cc:124:28: error: expected type-specifier before 'NumberFormatException'
124 | throw new NumberFormatException();
| ^ |
s967340541 | p00613 | C++ | #include <iostream>
using namespace std;
int main() {
int k;
while(cin >> k, k) {
int sum;
sum = 0;
for(int i = 0; i < k; i++) {
int a;
cin >> a;
sum += a;
}
cout << a / (k-1) << endl;
}
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'a' was not declared in this scope
14 | cout << a / (k-1) << endl;
| ^
|
s145074177 | p00613 | C++ | #include <iostream>
using namespace std;
int main() {
int k;
while(cin >> k, k) {
int sum;
sum = 0;
for(int i = 0; i < k*(k-1)/2; i++) {
int a;
cin >> a;
sum += a;
}
cout << a / (k-1) << endl;
}
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'a' was not declared in this scope
14 | cout << a / (k-1) << endl;
| ^
|
s740342397 | p00613 | C++ | #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
while(1){
int n;
cin>>n;
if(n==0)break;
int ans=0,a;
for (int i = 0; i < n * (n - 1) / 2; i++) {
cin>>a;
ans += ;
}
cout<<ans/(n-1);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:40: error: expected primary-expression before ';' token
13 | ans += ;
| ^
|
s982075720 | p00613 | C++ | #include <iostream>
uding namespace std;
int main() {
int n;
int num = 0;
int w = 0;
while(cin >> n && n) {
for(int i = 0; i < n*(n-1)/2; i++) {
cin >> num;
w += num;
}
cout << w /(n-1) << endl;
}
return 0;
} | a.cc:2:1: error: 'uding' does not name a type
2 | uding namespace std;
| ^~~~~
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | while(cin >> n && n) {
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:13:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
13 | cout << w /(n-1) << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:13:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
13 | cout << w /(n-1) << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s143685185 | p00613 | C++ | #include <iostream>
using namespace std;
int main(){
int k;
cin >> k;
if(k == 0)
{
break;
}
for(int i = 0;i < k*(k-1)/2;k++)
{
cin >> kazu;
sum += kazu;
}
cout << sum/(k-1) << endl;
}
| a.cc: In function 'int main()':
a.cc:12:7: error: break statement not within loop or switch
12 | break;
| ^~~~~
a.cc:17:14: error: 'kazu' was not declared in this scope
17 | cin >> kazu;
| ^~~~
a.cc:19:7: error: 'sum' was not declared in this scope
19 | sum += kazu;
| ^~~
a.cc:22:11: error: 'sum' was not declared in this scope
22 | cout << sum/(k-1) << endl;
| ^~~
|
s611653941 | p00613 | C++ | #include <iostream>
using namespace std;
int main(){
while(1)
{
int k;
int sum=0;
cin >> k;
if(k == 0)
{
break;
}
for(int i = 0;i < k*(k-1)/2;k++)
{
cin >> kazu;
sum += kazu;
}
cout << sum/(k-1) << endl;
}
}
| a.cc: In function 'int main()':
a.cc:21:14: error: 'kazu' was not declared in this scope
21 | cin >> kazu;
| ^~~~
|
s224437762 | p00613 | C++ | #include <iostrem>
#include <vector>
using namespace std;
int main() {
int K;
vector<int> c;
while(1) {
int sum = 0;
cin >> K;
if(K == 0)
break;
for(int i = 0; i < K*(K-1)/2; i++) {
int C;
cin >> C;
sum += C;
c.push_back(C);
}
cout << sum/(K-1) << endl;
}
return 0;
}
| a.cc:1:10: fatal error: iostrem: No such file or directory
1 | #include <iostrem>
| ^~~~~~~~~
compilation terminated.
|
s879566315 | p00613 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int k,sum;
int a[101];
sum=0;k=0;
for(int i=0;i<101;i++){
a[i] =0;
}
while(1){
cin >> k;
if(k == 0)break;
for(int i=0;i<k-1;i++){
cin >> a[i];
}
for(int i=0;i<k-1;i++){
sum += a[i]
}
sum = sum / (k - 1);
cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before '}' token
20 | sum += a[i]
| ^
| ;
21 | }
| ~
a.cc:26:2: error: expected '}' at end of input
26 | }
| ^
a.cc:4:11: note: to match this '{'
4 | int main(){
| ^
|
s725649647 | p00613 | C++ | #include<iostream>
using namespace std;
int main(void){
int k,c,sum,i;
while(1){
sum=0;
cin >> k;
if(k==0)break;
for(i=0;i<(k*(k-1))/2;i++){
cin>>c;
sum+=c;
}
else cout << sum/(k-1)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:5: error: 'else' without a previous 'if'
21 | else cout << sum/(k-1)<<endl;
| ^~~~
|
s190053324 | p00613 | C++ | #include<iostream>
using namespace std;
int main(){
while(1){
int k,c,sum=0;
cin>>k;
if(k==0)break;
for(int i=0;i<k*(k-1)/2;i++){
cin>>c;
sum+=c;
}
cout<<sum/(k-1)<<endl;
}
return 0;
} | a.cc:5:1: error: extended character is not valid in an identifier
5 | int k,c,sum=0;
| ^
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc:5:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:5:1: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000int' was not declared in this scope
5 | int k,c,sum=0;
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:6:22: error: 'k' was not declared in this scope
6 | cin>>k;
| ^
a.cc:9:30: error: 'c' was not declared in this scope
9 | cin>>c;
| ^
a.cc:10:25: error: 'sum' was not declared in this scope
10 | sum+=c;
| ^~~
a.cc:12:23: error: 'sum' was not declared in this scope
12 | cout<<sum/(k-1)<<endl;
| ^~~
|
s922703454 | p00613 | C++ | include <iostream>
using namespace std;
int main(){
int k;
while(cin >> k,k){
int ans = 0;
for(int i=0;i<k*(k-1)/2;i++){
int tmp;
cin >> tmp;
ans += tmp;
}
cout << ans/(k-1) << endl;
}
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | while(cin >> k,k){
| ^~~
a.cc:13:5: error: 'cout' was not declared in this scope
13 | cout << ans/(k-1) << endl;
| ^~~~
a.cc:13:26: error: 'endl' was not declared in this scope
13 | cout << ans/(k-1) << endl;
| ^~~~
|
s719798733 | p00614 | Java |
class AOJ1028 {
static final int[] c = { 1, 5, 10, 50, 100, 500 };
public void run() {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int P = sc.nextInt();
if (P == 0)
return;
int[] N = new int[6];
for (int i = 0; i < 6; i++)
N[i] = sc.nextInt();
int min = 10000;
loop: for (int k = 0; k < 1 << 6; k++) {
int n = 0;
int p = P;
for (int i = 5; i >= 0; i--)
if (((1 << i) & k) == 0) {
int dn = max((p - 1) / c[i] + 1, 0);
if (p < 0 && i < 5 && (-p) % c[i + 1] / c[i] > 0) {
dn = c[i + 1] / c[i] - (-p) % c[i + 1] / c[i];
if (dn > N[i])
continue loop;
}
dn = min(dn, N[i]);
n += dn;
p -= dn * c[i];
}
if (p > 0)
continue;
p = -p;
for (int i = 5; i >= 0; i--) {
n += p / c[i];
p %= c[i];
}
min = min(min, n);
}
System.out.println(min);
}
}
}
public class Main {
public static void main(String... args) {
new AOJ1028().run();
}
public static void debug(Object... os) {
System.err.println(java.util.Arrays.deepToString(os));
}
}
class Scanner {
final java.util.Scanner sc;
public double nextDouble() {
return Double.parseDouble(sc.next());
}
public Scanner(java.io.InputStream is) {
this.sc = new java.util.Scanner(is);
}
public boolean hasNext() {
return sc.hasNext();
}
public String next() {
return sc.next();
}
public int nextInt() {
return Integer.parseInt(sc.next());
}
public String nextLine() {
return sc.nextLine();
}
public long nextLong() {
return Long.parseLong(sc.next());
}
} | Main.java:20: error: cannot find symbol
int dn = max((p - 1) / c[i] + 1, 0);
^
symbol: method max(int,int)
location: class AOJ1028
Main.java:26: error: cannot find symbol
dn = min(dn, N[i]);
^
symbol: method min(int,int)
location: class AOJ1028
Main.java:37: error: cannot find symbol
min = min(min, n);
^
symbol: method min(int,int)
location: class AOJ1028
3 errors
|
s126065919 | p00614 | C++ | x#include <stdlib.h>
#include <limits.h>
#include <iostream>
using namespace std;
int COIN_TYPE_NUM = 6;
int coin_price[] = {1, 5, 10, 50, 100, 500};
int coin_payment(int p, int* coin_num);
int change_num(int p);
int pay(int p, int* coin_num);
int main(){
int p;
int* coin_num = (int*)malloc(COIN_TYPE_NUM * sizeof(int));
while(true){
cin >> p;
for(int i = 0; i < COIN_TYPE_NUM; ++i){
cin >> coin_num[i];
}
if(p == 0) break;
int ideal_payment = coin_payment(p, coin_num);
cout << ideal_payment << endl;
}
return 0;
}
int coin_payment(int p, int* coin_num){
int min_coin_num = INT_MAX;
int max_payment = 0;
for(int coin_type = COIN_TYPE_NUM-1; coin_type >= 0; coin_type--){
max_payment += coin_num[coin_type]*coin_price[coin_type];
}
for(int i = p; i < max_payment; ++i){
int pay_num = pay(i, coin_num);
if(pay_num == -1) continue;
pay_num += change_num(i-p);
if(pay_num < min_coin_num) min_coin_num = pay_num;
}
return min_coin_num;
}
int change_num(int p){
int retval = 0;
for(int coin_type = COIN_TYPE_NUM-1; coin_type >= 0; coin_type--){
int p_num = p / coin_price[coin_type];
p -= p_num*coin_price[coin_type];
retval += p_num;
if(p == 0) return retval;
}
return retval;
}
int pay(int p, int* coin_num){
int retval = 0;
for(int coin_type = COIN_TYPE_NUM-1; coin_type >= 0; coin_type--){
int p_num = p / coin_price[coin_type];
if(p_num > coin_num[coin_type]) p_num = coin_num[coin_type];
p -= p_num*coin_price[coin_type];
retval += p_num;
if(p == 0) return retval;
}
return -1;
} | a.cc:1:2: error: stray '#' in program
1 | x#include <stdlib.h>
| ^
a.cc:1:1: error: 'x' does not name a type
1 | x#include <stdlib.h>
| ^
|
s249649123 | p00614 | C++ | #include <iostream>
using namespace std;
int ans = 0;
int lest[6];
int sum[6];
int coin[6] = {500, 100, 50, 10, 5, 1};
void search(int cur, int P, int num, int pos){
// cout << cur << " " << P << " " << num << " " << pos << endl;
if(num > ans) return ;
if(pos == 5){
if(cur < P){
if(lest[5]>=P-cur){
num += P-cur;
cur = P;
} else {
return ;
}
}
int l = cur-P;
for(int i=0;i<6;i++){
num += l/coin[i];
l %= coin[i];
}
ans = min(ans, num);
return ;
}
int next = cur;
for(int i=max(0, min(lest[pos], (P-cur)/coin[pos]-1));i<=lest[pos];i++){
next = cur + i*coin[pos];
if(next+sum[pos] < P) continue;
if(num == 4 && num + i + (P-next) >= ans) continue;
if(num + i >= ans) break;
search(next, P, num+i, pos+1);
if(next >= P) break;
}
}
int main(){
int P;
while(cin >> P, P){
for(int i=5;i>=0;i--) cin >> lest[i];
sum[5] = 0;
for(int i=4;i>=0;i--)
sum[i] = sum[i+1]+lest[i+1]*coin[i+1];
ans = 1000000000;
search(0, P, 0, 0);
cout << ans << endl;
}
}
int main(){
int P;
while(cin >> P, P){
for(int i=5;i>=0;i--) cin >> lest[i];
sum[5] = 0;
for(int i=4;i>=0;i--)
sum[i] = sum[i+1]+lest[i+1]*coin[i+1];
ans = 1000000000;
search(0, P, 0, 0);
cout << ans << endl;
}
} | a.cc:54:5: error: redefinition of 'int main()'
54 | int main(){
| ^~~~
a.cc:41:5: note: 'int main()' previously defined here
41 | int main(){
| ^~~~
|
s745225871 | p00614 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int value[6] = {1, 5, 10, 50, 100, 500};
int ns[6];
int p;
#define INF (1<<28)
int count_coins(int n) {
int cnt = 0;
for (int i = 5; i >= 0; i--) {
int c = n / value[i];
n -= c * value[i];
cnt += c;
if (n == 0) break;
}
return cnt;
}
int solve(int index, int rem) {
if (rem == 0) return 0;
if (rem < 0) return count_coins(-rem);
if (index < 0) return INF;
int min_pay = INF;
int s = rem / value[index];
if (s < ns[index]) {
min_pay = min(solve(index-1, rem-value[index]*s) + s,
solve(index-1, rem-value[index]*(s+1)) + s + 1);
return min_pay;
}
return solve(index-1, rem-value[index]*ns[index]) + ns[index];
}
int main() {
while (cin >> p) {
if (p == 0) break;
for (int i = 0; i < 6; i++)
cin >> ns[i];
int min_total = INF;
for (int i = 0; i <= 500; i++) {
if (can_make(p+i)) {
min_total = min(min_total, solve(5, p+i) + count_coins(i));
}
}
cout << min_total << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:45:17: error: 'can_make' was not declared in this scope
45 | if (can_make(p+i)) {
| ^~~~~~~~
|
s895425223 | p00614 | C++ | #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
 
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;
 
int coin[]={500,100,50,10,5,1};
int p,n[6];
 
int pay(int a)
{
    int ret=0;
    rep(i,6)
    {
        int t=min(n[i],a/coin[i]);
        a-=coin[i]*t; ret+=t;
    }
    return a?inf:ret;
}
int change(int a)
{
    int ret=0;
    rep(i,6)ret+=a/coin[i],a%=coin[i];
    return ret;
}
 
int main()
{
    while(cin>>p,p)
    {
        rep(i,6)cin>>n[5-i];
        int ans=inf;
        for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
        cout<<ans<<endl;
    }
    return 0;
} | a.cc:15:2: error: stray '#' in program
15 |  
| ^
a.cc:23:2: error: stray '#' in program
23 |  
| ^
a.cc:25:2: error: stray '#' in program
25 |  
| ^
a.cc:31:2: error: stray '#' in program
31 |  
| ^
a.cc:34:2: error: stray '#' in program
34 |  
| ^
a.cc:37:2: error: stray '#' in program
37 |     int ret=0;
| ^
a.cc:37:8: error: stray '#' in program
37 |     int ret=0;
| ^
a.cc:37:14: error: stray '#' in program
37 |     int ret=0;
| ^
a.cc:37:20: error: stray '#' in program
37 |     int ret=0;
| ^
a.cc:38:2: error: stray '#' in program
38 |     rep(i,6)
| ^
a.cc:38:8: error: stray '#' in program
38 |     rep(i,6)
| ^
a.cc:38:14: error: stray '#' in program
38 |     rep(i,6)
| ^
a.cc:38:20: error: stray '#' in program
38 |     rep(i,6)
| ^
a.cc:39:2: error: stray '#' in program
39 |     {
| ^
a.cc:39:8: error: stray '#' in program
39 |     {
| ^
a.cc:39:14: error: stray '#' in program
39 |     {
| ^
a.cc:39:20: error: stray '#' in program
39 |     {
| ^
a.cc:40:2: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:8: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:14: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:20: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:26: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:32: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:38: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:40:44: error: stray '#' in program
40 |         int t=min(n[i],a/coin[i]);
| ^
a.cc:41:2: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:8: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:14: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:20: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:26: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:32: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:38: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:41:44: error: stray '#' in program
41 |         a-=coin[i]*t; ret+=t;
| ^
a.cc:42:2: error: stray '#' in program
42 |     }
| ^
a.cc:42:8: error: stray '#' in program
42 |     }
| ^
a.cc:42:14: error: stray '#' in program
42 |     }
| ^
a.cc:42:20: error: stray '#' in program
42 |     }
| ^
a.cc:43:2: error: stray '#' in program
43 |     return a?inf:ret;
| ^
a.cc:43:8: error: stray '#' in program
43 |     return a?inf:ret;
| ^
a.cc:43:14: error: stray '#' in program
43 |     return a?inf:ret;
| ^
a.cc:43:20: error: stray '#' in program
43 |     return a?inf:ret;
| ^
a.cc:47:2: error: stray '#' in program
47 |     int ret=0;
| ^
a.cc:47:8: error: stray '#' in program
47 |     int ret=0;
| ^
a.cc:47:14: error: stray '#' in program
47 |     int ret=0;
| ^
a.cc:47:20: error: stray '#' in program
47 |     int ret=0;
| ^
a.cc:48:2: error: stray '#' in program
48 |     rep(i,6)ret+=a/coin[i],a%=coin[i];
| ^
a.cc:48:8: error: stray '#' in program
48 |     rep(i,6)ret+=a/coin[i],a%=coin[i];
| ^
a.cc:48:14: error: stray '#' in program
48 |     rep(i,6)ret+=a/coin[i],a%=coin[i];
| ^
a.cc:48:20: error: stray '#' in program
48 |     rep(i,6)ret+=a/coin[i],a%=coin[i];
| ^
a.cc:49:2: error: stray '#' in program
49 |     return ret;
| ^
a.cc:49:8: error: stray '#' in program
49 |     return ret;
| ^
a.cc:49:14: error: stray '#' in program
49 |     return ret;
| ^
a.cc:49:20: error: stray '#' in program
49 |     return ret;
| ^
a.cc:51:2: error: stray '#' in program
51 |  
| ^
a.cc:54:2: error: stray '#' in program
54 |     while(cin>>p,p)
| ^
a.cc:54:8: error: stray '#' in program
54 |     while(cin>>p,p)
| ^
a.cc:54:14: error: stray '#' in program
54 |     while(cin>>p,p)
| ^
a.cc:54:20: error: stray '#' in program
54 |     while(cin>>p,p)
| ^
a.cc:55:2: error: stray '#' in program
55 |     {
| ^
a.cc:55:8: error: stray '#' in program
55 |     {
| ^
a.cc:55:14: error: stray '#' in program
55 |     {
| ^
a.cc:55:20: error: stray '#' in program
55 |     {
| ^
a.cc:56:2: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:8: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:14: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:20: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:26: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:32: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:38: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:56:44: error: stray '#' in program
56 |         rep(i,6)cin>>n[5-i];
| ^
a.cc:57:2: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:8: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:14: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:20: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:26: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:32: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:38: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:57:44: error: stray '#' in program
57 |         int ans=inf;
| ^
a.cc:58:2: error: stray '#' in program
58 |         for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
| ^
a.cc:58:8: error: stray '#' in program
58 |         for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
| ^
a.cc:58:14: error: stray '#' in program
58 |         for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
| ^
a.cc:58:20: error: stray '#' in program
58 |         for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
| ^
a.cc:58:26: error: stray '#' in program
58 |         for(int i=p;i<=p+1000;i++)ans=min(ans,pay(i)+change(i-p));
| ^
a.cc:58:32: error: stray '#' in program
58 |      & |
s822801879 | p00614 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
enum Coin {
N1 = 0, N5 = 1, N10 = 2, N50 = 3, N100 = 4, N500 = 5
};
int main_calc(int p, int* coins);
int normalize(int &p, int* coins);
int recursive_calc(int p, int* coins, int digit);
void get_coin_names(Coin &c1, Coin &c5, int digit);
int main(int argc, char const* argv[])
{
int p;
int coins[6];
while (true) {
cin >> p >> coins[N1] >> coins[N5] >> coins[N10] >> coins[N50]
>> coins[N100] >> coins[N500];
if (p == 0) break;
cout << main_calc(p, coins) << endl;
}
return 0;
}
int main_calc(int p, int* coins) {
return normalize(p, coins) + recursive_calc(p, coins, 0);
}
// p縺?譯√↓縺ェ繧九∪縺ァ螟ァ縺阪>繧ウ繧、繝ウ縺九i菴ソ縺?// 雜ウ繧翫↑縺??蜷医?荳榊ョ?// return: used coins
// p, coins will be modified
int normalize(int &p, int* coins) {
int _p = p;
int digit = 2, sum = 0;
int base = 100;
int count;
while (_p != _p % 1000) {
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 5縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / (5 * base), n5);
_p -= 5 * count * base;
coins[c5] -= count;
sum += count;
if(_p == _p % 1000) break;
// 1縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / base, n1);
_p -= count * base;
coins[c1] -= count;
sum += count;
if(_p == _p % 1000) break;
digit--;
base /= 10;
}
p %= 1000;
return sum;
}
int* copy(int* coins) {
int* new_coins = new int[6];
for(int i = 0; i < 6; i++) {
new_coins[i] = coins[i];
}
return new_coins;
}
int changes(int v) {
if (v < 5) {
return v;
}
return 1 + v - 5;
}
// digit譯√h繧贋ク九?繧ウ繧、繝ウ縺ァp縺ョdigit譯∽サ・荳翫r蜈ィ驛ィ謇輔≧繧ウ繧、繝ウ謨ー
// 繧ウ繧、繝ウ縺瑚カウ繧翫↑縺??蜷医? -1 繧定ソ斐☆
int min_coins(int p, int* coins, int digit) {
digit -= 1;
int base = 1;
for(int i = 0; i < digit; i++) base *= 10;
int count, sum = 0;
while (true) {
if (digit < 0) return -1;
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
count = min(p / (5 * base), n5);
p -= (5 * base) * count;
sum += count;
if(p == p % 1000) break;
count = min(p / base, n1);
p -= base * count;
sum += count;
if(p == p % 1000) break;
base /= 10;
digit--;
}
return sum;
}
// digit譯√h繧贋ク翫↓縺、縺?※蜀榊クー縺ァ繧ウ繧、繝ウ謨ー繧呈アゅa繧?int recursive_calc(int p, int* coins, int digit) {
//cout << "p: " << p << ", digit: " << digit << endl;
if (digit == 3) {
if (p / 1000 != 0) {
//cout << "500c: " << coins[N500] << endl;
auto r = min_coins(p, coins, 3);
//cout << "3譯∫岼coins: " << r << endl;
return r;
}
return 0;
}
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 10^(digit)縺ァ蜑イ繧? int v = p;
for(int i = 0; i < digit; i++) v = v / 10;
// digit譯∫岼縺?¢蜿悶j蜃コ縺? v %= 10;
if (v == 0) {
auto new_coins = copy(coins);
return recursive_calc(p, new_coins, digit + 1);
}
// 謇輔>譁ケ
// A: c1#v
// B: c5#1
// C: c5#1, c1#(5-v)
// D: c5#2
// E: c10繧医j螟ァ縺阪>繧?▽
// F: c1繧医j蟆上&縺?d縺、
vector<int> amounts;
// A
if (v <= n1) {
int* new_coins = copy(coins);
new_coins[c1] -= v;
int amount = v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// B
if (v <= 5 && n5 >= 1) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
int amount = 1 + changes(5 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// C
if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
new_coins[c1] -= 10 - v;
int amount = 1 + 10 - v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// D
if (n5 >= 2) {
int* new_coins = copy(coins);
new_coins[c5] -= 2;
int amount = 2 + changes(10 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// E
{
// p縺ョ1譯∽ク翫↓1雜ウ縺? int d = 1;
for(int i = 0; i < digit + 1; i++) d *= 10;
int new_p = p + d;
int amount = changes(10 - v);
int r = recursive_calc(new_p, coins, digit + 1);
if (r != -1) amounts.push_back(amount + r);
}
// F
if (amounts.empty()) {
int amount = min_coins(p, coins, digit);
if (amount != -1) amounts.push_back(amount);
}
// 髮?ィ? if (amounts.empty()) return -1;
return *min_element(amounts.begin(), amounts.end());
}
void get_coin_names(Coin &c1, Coin &c5, int digit) {
switch (digit) {
case 0:
c1 = N1;
c5 = N5;
break;
case 1:
c1 = N10;
c5 = N50;
break;
case 2:
c1 = N100;
c5 = N500;
break;
}
} | a.cc:124:3: error: expected unqualified-id before 'if'
124 | if (digit == 3) {
| ^~
a.cc:135:17: error: expected constructor, destructor, or type conversion before '(' token
135 | get_coin_names(c1, c5, digit);
| ^
a.cc:136:12: error: 'coins' was not declared in this scope
136 | int n1 = coins[c1], n5 = coins[c5];
| ^~~~~
a.cc:139:3: error: expected unqualified-id before 'for'
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^~~
a.cc:139:18: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:139:29: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:143:3: error: expected unqualified-id before 'if'
143 | if (v == 0) {
| ^~
a.cc:160:3: error: expected unqualified-id before 'if'
160 | if (v <= n1) {
| ^~
a.cc:174:3: error: expected unqualified-id before 'if'
174 | if (v <= 5 && n5 >= 1) {
| ^~
a.cc:188:3: error: expected unqualified-id before 'if'
188 | if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
| ^~
a.cc:203:3: error: expected unqualified-id before 'if'
203 | if (n5 >= 2) {
| ^~
a.cc:217:3: error: expected unqualified-id before '{' token
217 | {
| ^
a.cc:228:3: error: expected unqualified-id before 'if'
228 | if (amounts.empty()) {
| ^~
a.cc:235:3: error: expected unqualified-id before 'return'
235 | return *min_element(amounts.begin(), amounts.end());
| ^~~~~~
a.cc:236:1: error: expected declaration before '}' token
236 | }
| ^
|
s928914943 | p00614 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
enum Coin {
N1 = 0, N5 = 1, N10 = 2, N50 = 3, N100 = 4, N500 = 5
};
int main_calc(int p, int* coins);
int normalize(int &p, int* coins);
int recursive_calc(int p, int* coins, int digit);
void get_coin_names(Coin &c1, Coin &c5, int digit);
int main(int argc, char const* argv[])
{
int p;
int coins[6];
while (true) {
cin >> p >> coins[N1] >> coins[N5] >> coins[N10] >> coins[N50]
>> coins[N100] >> coins[N500];
if (p == 0) break;
cout << main_calc(p, coins) << endl;
}
return 0;
}
int main_calc(int p, int* coins) {
return normalize(p, coins) + recursive_calc(p, coins, 0);
}
// p縺?譯√↓縺ェ繧九∪縺ァ螟ァ縺阪>繧ウ繧、繝ウ縺九i菴ソ縺?// 雜ウ繧翫↑縺??蜷医?荳榊ョ?// return: used coins
// p, coins will be modified
int normalize(int &p, int* coins) {
int _p = p;
int digit = 2, sum = 0;
int base = 100;
int count;
while (_p != _p % 1000) {
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 5縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / (5 * base), n5);
_p -= 5 * count * base;
coins[c5] -= count;
sum += count;
if(_p == _p % 1000) break;
// 1縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / base, n1);
_p -= count * base;
coins[c1] -= count;
sum += count;
if(_p == _p % 1000) break;
digit--;
base /= 10;
}
p %= 1000;
return sum;
}
int* copy(int* coins) {
int* new_coins = new int[6];
for(int i = 0; i < 6; i++) {
new_coins[i] = coins[i];
}
return new_coins;
}
int changes(int v) {
if (v < 5) {
return v;
}
return 1 + v - 5;
}
// digit譯√h繧贋ク九?繧ウ繧、繝ウ縺ァp縺ョdigit譯∽サ・荳翫r蜈ィ驛ィ謇輔≧繧ウ繧、繝ウ謨ー
// 繧ウ繧、繝ウ縺瑚カウ繧翫↑縺??蜷医? -1 繧定ソ斐☆
int min_coins(int p, int* coins, int digit) {
digit -= 1;
int base = 1;
for(int i = 0; i < digit; i++) base *= 10;
int count, sum = 0;
while (true) {
if (digit < 0) return -1;
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
count = min(p / (5 * base), n5);
p -= (5 * base) * count;
sum += count;
if(p == p % 1000) break;
count = min(p / base, n1);
p -= base * count;
sum += count;
if(p == p % 1000) break;
base /= 10;
digit--;
}
return sum;
}
// digit譯√h繧贋ク翫↓縺、縺?※蜀榊クー縺ァ繧ウ繧、繝ウ謨ー繧呈アゅa繧?int recursive_calc(int p, int* coins, int digit) {
//cout << "p: " << p << ", digit: " << digit << endl;
if (digit == 3) {
if (p / 1000 != 0) {
//cout << "500c: " << coins[N500] << endl;
auto r = min_coins(p, coins, 3);
//cout << "3譯∫岼coins: " << r << endl;
return r;
}
return 0;
}
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 10^(digit)縺ァ蜑イ繧? int v = p;
for(int i = 0; i < digit; i++) v = v / 10;
// digit譯∫岼縺?¢蜿悶j蜃コ縺? v %= 10;
if (v == 0) {
auto new_coins = copy(coins);
return recursive_calc(p, new_coins, digit + 1);
}
// 謇輔>譁ケ
// A: c1#v
// B: c5#1
// C: c5#1, c1#(5-v)
// D: c5#2
// E: c10繧医j螟ァ縺阪>繧?▽
// F: c1繧医j蟆上&縺?d縺、
vector<int> amounts;
// A
if (v <= n1) {
int* new_coins = copy(coins);
new_coins[c1] -= v;
int amount = v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// B
if (v <= 5 && n5 >= 1) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
int amount = 1 + changes(5 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// C
if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
new_coins[c1] -= 10 - v;
int amount = 1 + 10 - v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// D
if (n5 >= 2) {
int* new_coins = copy(coins);
new_coins[c5] -= 2;
int amount = 2 + changes(10 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// E
{
// p縺ョ1譯∽ク翫↓1雜ウ縺? int d = 1;
for(int i = 0; i < digit + 1; i++) d *= 10;
int new_p = p + d;
int amount = changes(10 - v);
int r = recursive_calc(new_p, coins, digit + 1);
if (r != -1) amounts.push_back(amount + r);
}
// F
if (amounts.empty()) {
int amount = min_coins(p, coins, digit);
if (amount != -1) amounts.push_back(amount);
}
// 髮?ィ? if (amounts.empty()) return -1;
return *min_element(amounts.begin(), amounts.end());
}
void get_coin_names(Coin &c1, Coin &c5, int digit) {
switch (digit) {
case 0:
c1 = N1;
c5 = N5;
break;
case 1:
c1 = N10;
c5 = N50;
break;
case 2:
c1 = N100;
c5 = N500;
break;
}
} | a.cc:124:3: error: expected unqualified-id before 'if'
124 | if (digit == 3) {
| ^~
a.cc:135:17: error: expected constructor, destructor, or type conversion before '(' token
135 | get_coin_names(c1, c5, digit);
| ^
a.cc:136:12: error: 'coins' was not declared in this scope
136 | int n1 = coins[c1], n5 = coins[c5];
| ^~~~~
a.cc:139:3: error: expected unqualified-id before 'for'
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^~~
a.cc:139:18: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:139:29: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:143:3: error: expected unqualified-id before 'if'
143 | if (v == 0) {
| ^~
a.cc:160:3: error: expected unqualified-id before 'if'
160 | if (v <= n1) {
| ^~
a.cc:174:3: error: expected unqualified-id before 'if'
174 | if (v <= 5 && n5 >= 1) {
| ^~
a.cc:188:3: error: expected unqualified-id before 'if'
188 | if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
| ^~
a.cc:203:3: error: expected unqualified-id before 'if'
203 | if (n5 >= 2) {
| ^~
a.cc:217:3: error: expected unqualified-id before '{' token
217 | {
| ^
a.cc:228:3: error: expected unqualified-id before 'if'
228 | if (amounts.empty()) {
| ^~
a.cc:235:3: error: expected unqualified-id before 'return'
235 | return *min_element(amounts.begin(), amounts.end());
| ^~~~~~
a.cc:236:1: error: expected declaration before '}' token
236 | }
| ^
|
s489135957 | p00614 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
enum Coin {
N1 = 0, N5 = 1, N10 = 2, N50 = 3, N100 = 4, N500 = 5
};
int main_calc(int p, int* coins);
int normalize(int &p, int* coins);
int recursive_calc(int p, int* coins, int digit);
void get_coin_names(Coin &c1, Coin &c5, int digit);
int main(int argc, char const* argv[])
{
int p;
int coins[6];
while (true) {
cin >> p >> coins[N1] >> coins[N5] >> coins[N10] >> coins[N50]
>> coins[N100] >> coins[N500];
if (p == 0) break;
cout << main_calc(p, coins) << endl;
}
return 0;
}
int main_calc(int p, int* coins) {
return normalize(p, coins) + recursive_calc(p, coins, 0);
}
// p縺?譯√↓縺ェ繧九∪縺ァ螟ァ縺阪>繧ウ繧、繝ウ縺九i菴ソ縺?// 雜ウ繧翫↑縺??蜷医?荳榊ョ?// return: used coins
// p, coins will be modified
int normalize(int &p, int* coins) {
int _p = p;
int digit = 2, sum = 0;
int base = 100;
int count;
while (_p != _p % 1000) {
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 5縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / (5 * base), n5);
_p -= 5 * count * base;
coins[c5] -= count;
sum += count;
if(_p == _p % 1000) break;
// 1縺ョ繧ウ繧、繝ウ繧剃スソ縺?焚
count = min(_p / base, n1);
_p -= count * base;
coins[c1] -= count;
sum += count;
if(_p == _p % 1000) break;
digit--;
base /= 10;
}
p %= 1000;
return sum;
}
int* copy(int* coins) {
int* new_coins = new int[6];
for(int i = 0; i < 6; i++) {
new_coins[i] = coins[i];
}
return new_coins;
}
int changes(int v) {
if (v < 5) {
return v;
}
return 1 + v - 5;
}
// digit譯√h繧贋ク九?繧ウ繧、繝ウ縺ァp縺ョdigit譯∽サ・荳翫r蜈ィ驛ィ謇輔≧繧ウ繧、繝ウ謨ー
// 繧ウ繧、繝ウ縺瑚カウ繧翫↑縺??蜷医? -1 繧定ソ斐☆
int min_coins(int p, int* coins, int digit) {
digit -= 1;
int base = 1;
for(int i = 0; i < digit; i++) base *= 10;
int count, sum = 0;
while (true) {
if (digit < 0) return -1;
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
count = min(p / (5 * base), n5);
p -= (5 * base) * count;
sum += count;
if(p == p % 1000) break;
count = min(p / base, n1);
p -= base * count;
sum += count;
if(p == p % 1000) break;
base /= 10;
digit--;
}
return sum;
}
// digit譯√h繧贋ク翫↓縺、縺?※蜀榊クー縺ァ繧ウ繧、繝ウ謨ー繧呈アゅa繧?int recursive_calc(int p, int* coins, int digit) {
//cout << "p: " << p << ", digit: " << digit << endl;
if (digit == 3) {
if (p / 1000 != 0) {
//cout << "500c: " << coins[N500] << endl;
auto r = min_coins(p, coins, 3);
//cout << "3譯∫岼coins: " << r << endl;
return r;
}
return 0;
}
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 10^(digit)縺ァ蜑イ繧? int v = p;
for(int i = 0; i < digit; i++) v = v / 10;
// digit譯∫岼縺?¢蜿悶j蜃コ縺? v %= 10;
if (v == 0) {
auto new_coins = copy(coins);
return recursive_calc(p, new_coins, digit + 1);
}
// 謇輔>譁ケ
// A: c1#v
// B: c5#1
// C: c5#1, c1#(5-v)
// D: c5#2
// E: c10繧医j螟ァ縺阪>繧?▽
// F: c1繧医j蟆上&縺?d縺、
vector<int> amounts;
// A
if (v <= n1) {
int* new_coins = copy(coins);
new_coins[c1] -= v;
int amount = v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// B
if (v <= 5 && n5 >= 1) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
int amount = 1 + changes(5 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// C
if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
new_coins[c1] -= 10 - v;
int amount = 1 + 10 - v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// D
if (n5 >= 2) {
int* new_coins = copy(coins);
new_coins[c5] -= 2;
int amount = 2 + changes(10 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// E
{
// p縺ョ1譯∽ク翫↓1雜ウ縺? int d = 1;
for(int i = 0; i < digit + 1; i++) d *= 10;
int new_p = p + d;
int amount = changes(10 - v);
int r = recursive_calc(new_p, coins, digit + 1);
if (r != -1) amounts.push_back(amount + r);
}
// F
if (amounts.empty()) {
int amount = min_coins(p, coins, digit);
if (amount != -1) amounts.push_back(amount);
}
// 髮?ィ? if (amounts.empty()) return -1;
return *min_element(amounts.begin(), amounts.end());
}
void get_coin_names(Coin &c1, Coin &c5, int digit) {
switch (digit) {
case 0:
c1 = N1;
c5 = N5;
break;
case 1:
c1 = N10;
c5 = N50;
break;
case 2:
c1 = N100;
c5 = N500;
break;
}
} | a.cc:124:3: error: expected unqualified-id before 'if'
124 | if (digit == 3) {
| ^~
a.cc:135:17: error: expected constructor, destructor, or type conversion before '(' token
135 | get_coin_names(c1, c5, digit);
| ^
a.cc:136:12: error: 'coins' was not declared in this scope
136 | int n1 = coins[c1], n5 = coins[c5];
| ^~~~~
a.cc:139:3: error: expected unqualified-id before 'for'
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^~~
a.cc:139:18: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:139:29: error: 'i' does not name a type
139 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:143:3: error: expected unqualified-id before 'if'
143 | if (v == 0) {
| ^~
a.cc:160:3: error: expected unqualified-id before 'if'
160 | if (v <= n1) {
| ^~
a.cc:174:3: error: expected unqualified-id before 'if'
174 | if (v <= 5 && n5 >= 1) {
| ^~
a.cc:188:3: error: expected unqualified-id before 'if'
188 | if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
| ^~
a.cc:203:3: error: expected unqualified-id before 'if'
203 | if (n5 >= 2) {
| ^~
a.cc:217:3: error: expected unqualified-id before '{' token
217 | {
| ^
a.cc:228:3: error: expected unqualified-id before 'if'
228 | if (amounts.empty()) {
| ^~
a.cc:235:3: error: expected unqualified-id before 'return'
235 | return *min_element(amounts.begin(), amounts.end());
| ^~~~~~
a.cc:236:1: error: expected declaration before '}' token
236 | }
| ^
|
s904538538 | p00614 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
enum Coin {
N1 = 0, N5 = 1, N10 = 2, N50 = 3, N100 = 4, N500 = 5
};
int main_calc(int p, int* coins);
int normalize(int &p, int* coins);
int recursive_calc(int p, int* coins, int digit);
void get_coin_names(Coin &c1, Coin &c5, int digit);
int main(int argc, char const* argv[])
{
int p;
int coins[6];
while (true) {
cin >> p >> coins[N1] >> coins[N5] >> coins[N10] >> coins[N50]
>> coins[N100] >> coins[N500];
if (p == 0) break;
cout << main_calc(p, coins) << endl;
}
return 0;
}
int main_calc(int p, int* coins) {
return normalize(p, coins) + recursive_calc(p, coins, 0);
}
// return: used coins
// p, coins will be modified
int normalize(int &p, int* coins) {
int _p = p;
int digit = 2, sum = 0;
int base = 100;
int count;
while (_p != _p % 1000) {
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
count = min(_p / (5 * base), n5);
_p -= 5 * count * base;
coins[c5] -= count;
sum += count;
if(_p == _p % 1000) break;
count = min(_p / base, n1);
_p -= count * base;
coins[c1] -= count;
sum += count;
if(_p == _p % 1000) break;
digit--;
base /= 10;
}
p %= 1000;
return sum;
}
int* copy(int* coins) {
int* new_coins = new int[6];
for(int i = 0; i < 6; i++) {
new_coins[i] = coins[i];
}
return new_coins;
}
int changes(int v) {
if (v < 5) {
return v;
}
return 1 + v - 5;
}
int min_coins(int p, int* coins, int digit) {
digit -= 1;
int base = 1;
for(int i = 0; i < digit; i++) base *= 10;
int count, sum = 0;
while (true) {
if (digit < 0) return -1;
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
count = min(p / (5 * base), n5);
p -= (5 * base) * count;
sum += count;
if(p == p % 1000) break;
count = min(p / base, n1);
p -= base * count;
sum += count;
if(p == p % 1000) break;
base /= 10;
digit--;
}
return sum;
}
int recursive_calc(int p, int* coins, int digit) {
//cout << "p: " << p << ", digit: " << digit << endl;
if (digit == 3) {
if (p / 1000 != 0) {
//cout << "500c: " << coins[N500] << endl;
auto r = min_coins(p, coins, 3);
return r;
}
return 0;
}
Coin c1, c5;
get_coin_names(c1, c5, digit);
int n1 = coins[c1], n5 = coins[c5];
// 10^(digit)縺ァ蜑イ繧? int v = p;
for(int i = 0; i < digit; i++) v = v / 10;
v %= 10;
if (v == 0) {
auto new_coins = copy(coins);
return recursive_calc(p, new_coins, digit + 1);
}
vector<int> amounts;
// A
if (v <= n1) {
int* new_coins = copy(coins);
new_coins[c1] -= v;
int amount = v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// B
if (v <= 5 && n5 >= 1) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
int amount = 1 + changes(5 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// C
if (v > 5 && n5 >= 1 && c1 >= (5 - v)) {
int* new_coins = copy(coins);
new_coins[c5] -= 1;
new_coins[c1] -= 10 - v;
int amount = 1 + 10 - v;
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// D
if (n5 >= 2) {
int* new_coins = copy(coins);
new_coins[c5] -= 2;
int amount = 2 + changes(10 - v);
int r = recursive_calc(p, new_coins, digit + 1);
if (r != -1) {
amounts.push_back(amount + r);
}
delete new_coins;
}
// E
{
int d = 1;
for(int i = 0; i < digit + 1; i++) d *= 10;
int new_p = p + d;
int amount = changes(10 - v);
int r = recursive_calc(new_p, coins, digit + 1);
if (r != -1) amounts.push_back(amount + r);
}
// F
if (amounts.empty()) {
int amount = min_coins(p, coins, digit);
if (amount != -1) amounts.push_back(amount);
}
if (amounts.empty()) return -1;
return *min_element(amounts.begin(), amounts.end());
}
void get_coin_names(Coin &c1, Coin &c5, int digit) {
switch (digit) {
case 0:
c1 = N1;
c5 = N5;
break;
case 1:
c1 = N10;
c5 = N50;
break;
case 2:
c1 = N100;
c5 = N500;
break;
}
} | a.cc: In function 'int recursive_calc(int, int*, int)':
a.cc:134:34: error: 'v' was not declared in this scope
134 | for(int i = 0; i < digit; i++) v = v / 10;
| ^
a.cc:136:3: error: 'v' was not declared in this scope
136 | v %= 10;
| ^
|
s942472382 | p00615 | Java | package fill_nosubmit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class AOJ10_29
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
for(;;)
{
int n=in.nextInt();
int m=in.nextInt();
if((n|m)==0)
return;
int t=n+m;
ArrayList<Integer> L=new ArrayList<Integer>();
for(int i=0;i<t;i++)
L.add(in.nextInt());
Collections.sort(L);
int max;
if(t==1)
max=L.get(0);
else
max=0;
for(int i=0;i<t-1;i++)
{
int tmp=L.get(i+1)-L.get(i);
if(max<tmp)
max=tmp;
}
System.out.println(max);
}
}
} | Main.java:5: error: class AOJ10_29 is public, should be declared in a file named AOJ10_29.java
public class AOJ10_29
^
1 error
|
s848585959 | p00615 | C | #include <stdio.h>
int main(void)
{
int n, m, x, i, j, t[2000000];
while(1)
{
i=0;
t[1999999]=0;
x=0;
scanf("%d %d", &n, &m);
if(n == 0 && m == 0) break;
for(i = 0; i < n+m; i++)
{
scanf("%d", &t[i]);
}
for(i = 0; i < m; i++)
{
scanf("%d", &tr[i]);
}
for(i = 0; i < n; i++)
{
for(j = i+1; j < n; j++)
{
if(t[i] < t[j])
{
x = t[i];
t[i] = t[j];
t[j] = x;
}
}
}
printf("%d\n", t[0]);
}
return 0;
} | main.c: In function 'main':
main.c:22:24: error: 'tr' undeclared (first use in this function); did you mean 't'?
22 | scanf("%d", &tr[i]);
| ^~
| t
main.c:22:24: note: each undeclared identifier is reported only once for each function it appears in
|
s734487898 | p00615 | C | #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;
static const double EPS = 1e-8;
int main(){
int n,m;
while(~scanf("%d %d",&n,&m)){
if(n==m && m==0) break;
vector<int> elapsedTime;
elapsedTime.push_back(0);
for(int i=0;i<n;i++){
int t;
scanf("%d",&t);
elapsedTime.push_back(t);
}
for(int i=0;i<m;i++){
int t;
scanf("%d",&t);
elapsedTime.push_back(t);
}
sort(elapsedTime.begin(),elapsedTime.end());
int diff=0;
for(int i=0;i+1<elapsedTime.size();i++){
diff = max(diff,abs(elapsedTime[i+1]-elapsedTime[i]));
}
printf("%d\n",diff);
}
} | main.c:3:10: fatal error: iostream: No such file or directory
3 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s525139634 | p00615 | C++ |
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii;
typedef long long ll ;
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
int main(void){
int m, n ;
while(cin >> m >> n , m + n ){
vi ans(m+n+1);
rep(i,n+m)cin>>t[i];
t[n+m]=0;
sort(all(t));
int md = 0;
rep(i,n+m)md = max(md,t[i+1]-t[i]);
cout << md << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:20: error: 't' was not declared in this scope
26 | rep(i,n+m)cin>>t[i];
| ^
a.cc:27:5: error: 't' was not declared in this scope
27 | t[n+m]=0;
| ^
|
s083005966 | p00615 | C++ | #include <stdio.h>
int main(){
int n, m, tl[10001], tr[10001], i, j, k, befor, maxnum;
while(1){
scanf_s("%d %d", &n, &m);
if(n==0 && m==0) break;
for(i=0;i<n;i++){
scanf_s("%d", &tl[i]);
}
tl[i]=1000001;
for(i=0;i<m;i++){
scanf_s("%d", &tr[i]);
}
tr[i]=1000001;
j=0;
k=0;
maxnum=-1;
befor=0;
for(i=0;i<n+m+1;i++){
if(tl[j]>=tr[k]){
if(maxnum<tl[j]-befor){
maxnum = tl[j] - befor;
}
befor=tl[j];
j++;
}
else if(tl[j]<tr[k]){
if(maxnum<tr[k]-befor){
maxnum = tr[k] - befor;
}
befor=tr[k];
k++;
}
if(tl[j]==tr[k]){
i++;
k++;
}
}
printf("%d\n", maxnum);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
7 | scanf_s("%d %d", &n, &m);
| ^~~~~~~
| scanf
|
s288509876 | p00615 | C++ | /* Traffic Analysis */
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#define STRNUM 4096
#define DELIM " "
#define CMAX 10000
void main( int argc, char *argv[] )
{
// ?????¨?????°??????
char wStrA[STRNUM] = "";
char *tok;
char *ctx;
int n, m, tl, tr;
std::vector<int> wVec;
std::vector<int> rVec;
while( gets_s( wStrA, STRNUM ) != NULL ){
// ????????°??°?????????
tok = strtok_s( wStrA, DELIM, &ctx );
n = atoi( tok );
while( tok != NULL ){
m = atoi( tok );
tok = strtok_s( NULL, DELIM, &ctx );
}
// ????????°??°?????±???0????????????
if( n==0 && m==0 ){
break;
}
// ?????????????????????
if( n != 0 ){
// ?¬?????????????????????????
gets_s( wStrA, STRNUM );
tok = strtok_s( wStrA, DELIM, &ctx );
while( tok != NULL ){
tl = atoi( tok );
wVec.push_back( tl );
tok = strtok_s( NULL, DELIM, &ctx );
}
}
if( m != 0 ){
// ?¬?????????????????????????
gets_s( wStrA, STRNUM );
tok = strtok_s( wStrA, DELIM, &ctx );
while( tok != NULL ){
tr = atoi( tok );
wVec.push_back( tr );
tok = strtok_s( NULL, DELIM, &ctx );
}
}
// ?????§??????????????????
if( wVec.size() == 1 ){
rVec.push_back( wVec[0] );
wVec.erase( wVec.begin(), wVec.end() );
continue;
}
std::sort( wVec.begin(), wVec.end() );
int rtmp = wVec[0];
for( int ii=0; ii<((int)wVec.size() - 1); ii++){
if( rtmp < (wVec[ii+1] - wVec[ii]) ){
rtmp = wVec[ii+1] - wVec[ii];
}
}
// ???????????????????????????????´?
rVec.push_back( rtmp );
wVec.erase( wVec.begin(), wVec.end() );
}
for( int ii=0; ii<(int)rVec.size(); ii++ ){
std::cout << rVec[ii] << std::endl;
}
return;
} | a.cc:15:1: error: '::main' must return 'int'
15 | void main( int argc, char *argv[] )
| ^~~~
a.cc: In function 'int main(int, char**)':
a.cc:27:16: error: 'gets_s' was not declared in this scope
27 | while( gets_s( wStrA, STRNUM ) != NULL ){
| ^~~~~~
a.cc:29:23: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
29 | tok = strtok_s( wStrA, DELIM, &ctx );
| ^~~~~~~~
| strtok_r
a.cc:81:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
81 | return;
| ^~~~~~
|
s724268065 | p00615 | C++ | /* Traffic Analysis */
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#define STRNUM 4096
#define DELIM " "
#define CMAX 10000
int main( int argc, char *argv[] )
{
// ?????¨?????°??????
char wStrA[STRNUM] = "";
char *tok;
char *ctx;
int n, m, tl, tr;
std::vector<int> wVec;
std::vector<int> rVec;
while( gets_s( wStrA, STRNUM ) != NULL ){
// ????????°??°?????????
tok = strtok_s( wStrA, DELIM, &ctx );
n = atoi( tok );
while( tok != NULL ){
m = atoi( tok );
tok = strtok_s( NULL, DELIM, &ctx );
}
// ????????°??°?????±???0????????????
if( n==0 && m==0 ){
break;
}
// ?????????????????????
if( n != 0 ){
// ?¬?????????????????????????
gets_s( wStrA, STRNUM );
tok = strtok_s( wStrA, DELIM, &ctx );
while( tok != NULL ){
tl = atoi( tok );
wVec.push_back( tl );
tok = strtok_s( NULL, DELIM, &ctx );
}
}
if( m != 0 ){
// ?¬?????????????????????????
gets_s( wStrA, STRNUM );
tok = strtok_s( wStrA, DELIM, &ctx );
while( tok != NULL ){
tr = atoi( tok );
wVec.push_back( tr );
tok = strtok_s( NULL, DELIM, &ctx );
}
}
// ?????§??????????????????
if( wVec.size() == 1 ){
rVec.push_back( wVec[0] );
wVec.erase( wVec.begin(), wVec.end() );
continue;
}
std::sort( wVec.begin(), wVec.end() );
int rtmp = wVec[0];
for( int ii=0; ii<((int)wVec.size() - 1); ii++){
if( rtmp < (wVec[ii+1] - wVec[ii]) ){
rtmp = wVec[ii+1] - wVec[ii];
}
}
// ???????????????????????????????´?
rVec.push_back( rtmp );
wVec.erase( wVec.begin(), wVec.end() );
}
for( int ii=0; ii<(int)rVec.size(); ii++ ){
std::cout << rVec[ii] << std::endl;
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:27:16: error: 'gets_s' was not declared in this scope
27 | while( gets_s( wStrA, STRNUM ) != NULL ){
| ^~~~~~
a.cc:29:23: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
29 | tok = strtok_s( wStrA, DELIM, &ctx );
| ^~~~~~~~
| strtok_r
|
s466795566 | p00615 | C++ | /* Traffic Analysis */
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#define STRNUM 4096
#define DELIM " "
#define CMAX 10000
int main( int argc, char **argv )
{
// ?????¨?????°??????
char wStrA[STRNUM] = "";
char *tok;
char *ctx;
int n, m, tl, tr;
std::vector<int> wVec;
std::vector<int> rVec;
while( gets( wStrA, STRNUM ) != NULL ){
// ????????°??°?????????
tok = strtok( wStrA, DELIM );
n = atoi( tok );
while( tok != NULL ){
m = atoi( tok );
tok = strtok( NULL, DELIM );
}
// ????????°??°?????±???0????????????
if( n==0 && m==0 ){
break;
}
// ?????????????????????
if( n != 0 ){
// ?¬?????????????????????????
gets( wStrA, STRNUM );
tok = strtok( wStrA, DELIM );
while( tok != NULL ){
tl = atoi( tok );
wVec.push_back( tl );
tok = strtok( NULL, DELIM );
}
}
if( m != 0 ){
// ?¬?????????????????????????
gets( wStrA, STRNUM );
tok = strtok( wStrA, DELIM );
while( tok != NULL ){
tr = atoi( tok );
wVec.push_back( tr );
tok = strtok( NULL, DELIM );
}
}
// ?????§??????????????????
if( wVec.size() == 1 ){
rVec.push_back( wVec[0] );
wVec.erase( wVec.begin(), wVec.end() );
continue;
}
std::sort( wVec.begin(), wVec.end() );
int rtmp = wVec[0];
for( int ii=0; ii<((int)wVec.size() - 1); ii++){
if( rtmp < (wVec[ii+1] - wVec[ii]) ){
rtmp = wVec[ii+1] - wVec[ii];
}
}
// ???????????????????????????????´?
rVec.push_back( rtmp );
wVec.erase( wVec.begin(), wVec.end() );
}
for( int ii=0; ii<(int)rVec.size(); ii++ ){
std::cout << rVec[ii] << std::endl;
}
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:27:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
27 | while( gets( wStrA, STRNUM ) != NULL ){
| ^~~~
| getw
|
s061817964 | p00615 | C++ | using namespace std;
#define MAX 10001
main(){
int n, m, L[MAX], R[MAX], C[MAX*2], i, j, k;
while( cin >> n >> m ){
if ( n == 0 && m == 0 ) break;
for ( i = 0; i < n; i++ ) cin >> L[i];
for ( i = 0; i < m; i++ ) cin >> R[i];
L[n] = R[m] = 1000001;
i = j = k = 0;
while( k < n + m ) {
C[k++] = (L[i] <= R[j]) ? L[i++] : R[j++];
}
int maxv = C[0];
for ( int i = 1; i < n+m; i++ ){
maxv = max( maxv, C[i] - C[i-1] );
}
cout << maxv << endl;
}
} | a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:7:12: error: 'cin' was not declared in this scope
7 | while( cin >> n >> m ){
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:18:20: error: 'max' was not declared in this scope; did you mean 'maxv'?
18 | maxv = max( maxv, C[i] - C[i-1] );
| ^~~
| maxv
a.cc:20:9: error: 'cout' was not declared in this scope
20 | cout << maxv << endl;
| ^~~~
a.cc:20:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:25: error: 'endl' was not declared in this scope
20 | cout << maxv << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s221310502 | p00615 | C++ | #include<set>
#include<iostream>
int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}} | a.cc: In function 'int main()':
a.cc:3:60: error: 'set' was not declared in this scope
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^~~
a.cc:3:60: note: suggested alternatives:
In file included from /usr/include/c++/14/set:63,
from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:96:11: note: 'std::set'
96 | class set
| ^~~
/usr/include/c++/14/set:87:13: note: 'std::pmr::set'
87 | using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>;
| ^~~
a.cc:3:64: error: expected primary-expression before 'int'
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^~~
a.cc:3:77: error: 'p' was not declared in this scope
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^
a.cc:3:133: error: expected primary-expression before 'int'
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^~~
a.cc:3:154: error: 'a' was not declared in this scope
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);set<int>::iterator a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^
|
s770493926 | p00615 | C++ | #include<set>
#include<iostream>
int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;std::set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);std::set<int>::iteratorツ a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}} | a.cc:3:149: error: extended character is not valid in an identifier
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;std::set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);std::set<int>::iteratorツ a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^
a.cc: In function 'int main()':
a.cc:3:149: error: 'iterator\U000030c4\U00003000a' is not a member of 'std::set<int>'
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;std::set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);std::set<int>::iteratorツ a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^~~~~~~~~~~~~
a.cc:3:167: error: 'a' was not declared in this scope
3 | int main(){int l,r;for(;;){std::cin>>l>>r;if(!(l+=r))break;std::set<int> p;int m;p.insert(0);for(r=0;r<l;r++)std::cin>>m,p.insert(m);std::set<int>::iteratorツ a;for(a=p.begin(),m=0;a!=--p.end();++a)if(*(++a)-*(--a)>m)m=*(++a)-*(--a);std::cout<<m<<"\n";}}
| ^
|
s778426670 | p00615 | C++ | #include<iostream>
using namespace std;
int main(void){
int n,m,max,i,x;
while(1){
cin >> n >> m;
for(i=0;i<n+m;i++){
cin >> x;
max= (i==0)?x:(max<x-max)?x-max:;
}
cout << max << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:39: error: expected primary-expression before ';' token
12 | max= (i==0)?x:(max<x-max)?x-max:;
| ^
|
s202760599 | p00615 | C++ | #include <iostream>
using namespace std;
int max(int a, int b)
{
if( a > b )
return a;
else
return b;
}
int main()
{
int n, m, i, j, k;
int out;
int tl[100];
int tr[100];
int tmerge[200];
while( cin >> n >> m , (n||m) )
{
memset( tl, 0, sizeof(tl));
memset( tr, 0, sizeof(tr));
memset( tmerge, 0, sizeof(tmerge));
out = 0;
for( i = 1; i <= n; i++)
{
cin >> tl[i];
}
for( j = 1; j <= m; j++)
{
cin >> tr[j];
}
i = 1; j = 1; k = 2;
tmerge[1] = 0;
while( k <= n+m+1 )
{
if( tl[i] < tr[j] && i <= n )
{
tmerge[k] = tl[i];
i++;
}
else
{
tmerge[k] = tr[j];
j++;
}
k++;
}
for( i = 1; i <= n+m+1; i++)
{
cout << tmerge[i] << endl;
}
for( i = 1; i <= m+n+1; i++)
{
tmerge[i] = tmerge[i+1] - tmerge[i];
}
for( i = 1; i <= m+n+1; i++)
{
out = max(out, tmerge[i]);
}
cout << out <<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:17: error: 'memset' was not declared in this scope
23 | memset( tl, 0, sizeof(tl));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s010452948 | p00615 | C++ | #include <iostream>
using namespace std;
int max(int a, int b)
{
if( a > b )
return a;
else
return b;
}
int main()
{
int n, m, i, j, k;
int out;
int tl[10000];
int tr[10000];
int tmerge[20000];
while( cin >> n >> m , (n||m) )
{
memset( tl, 0, sizeof(tl));
memset( tr, 0, sizeof(tr));
memset( tmerge, 0, sizeof(tmerge));
out = 0;
for( i = 1; i <= n; i++)
{
cin >> tl[i];
}
for( j = 1; j <= m; j++)
{
cin >> tr[j];
}
i = 1; j = 1; k = 2;
tmerge[1] = 0;
while( k <= n+m+1 )
{
if( tl[i] < tr[j] && i <= n )
{
tmerge[k] = tl[i];
i++;
}
else
{
tmerge[k] = tr[j];
j++;
}
k++;
}
/*
for( i = 1; i <= n+m+1; i++)
{
cout << tmerge[i] << endl;
}
*/
for( i = 1; i <= m+n+1; i++)
{
tmerge[i] = tmerge[i+1] - tmerge[i];
}
for( i = 1; i <= m+n+1; i++)
{
out = max(out, tmerge[i]);
}
cout << out <<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:17: error: 'memset' was not declared in this scope
23 | memset( tl, 0, sizeof(tl));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s836257872 | p00615 | C++ | #import<cstdio>
#import<algorithm>
int main(){
for(int n,m,f,i;scanf("%d%d",&n,&m),n|m;printf("%d\n",f)){
int a[200010]={0};
for(i=0;i<n+m;i++)
scanf("%d"a+i);
std::sort(a,a+n+m+1);
f=0;
for(i=1;i<n+m+1;i++)
f=max(f,a[i]+a[i-1]);
}
} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
2 | #import<algorithm>
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:31: error: unable to find string literal operator 'operator""a' with 'const char [3]', 'long unsigned int' arguments
7 | scanf("%d"a+i);
| ^~~~~
a.cc:11:27: error: 'max' was not declared in this scope; did you mean 'std::max'?
11 | f=max(f,a[i]+a[i-1]);
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s165703231 | p00615 | C++ | #import<cstdio>
#import<algorithm>
int main(){
for(int n,m,f,i;scanf("%d%d",&n,&m),n|m;printf("%d\n",f)){
int a[200010]={0};
for(i=0;i<n+m;i++)
scanf("%d"a+i);
std::sort(a,a+n+m+1);
f=0;
for(i=1;i<n+m+1;i++)
f=std::max(f,a[i]+a[i-1]);
}
} | a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
1 | #import<cstdio>
| ^~~~~~
a.cc:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
2 | #import<algorithm>
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:31: error: unable to find string literal operator 'operator""a' with 'const char [3]', 'long unsigned int' arguments
7 | scanf("%d"a+i);
| ^~~~~
|
s536748205 | p00615 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
while(scanf("%d%d",&n, &m, (n | m)){
int N = n+m, arr[N];
for(int i = 0 ; i < N ; i++){
scanf("%d" ,arr+i);
}
sort(arr, arr+N);
int max = arr[0];
for(int i = 0 ; i < N ; i++){
max = std::max(max, arr[i] - arr[i-1]);
}
printf("%d\n" ,max);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:38: error: expected ')' before '{' token
8 | while(scanf("%d%d",&n, &m, (n | m)){
| ~ ^
| )
|
s711413369 | p00616 | Java | gimport java.io.*;
import java.util.*;
class Cube {
int x, y, z;
Cube(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj) {
Cube o = (Cube)obj;
return x == o.x && y == o.y && z == o.z;
}
@Override
public int hashCode() {
return x * 503 * 503 + y * 503 + z;
}
@Override
public String toString() {
return String.valueOf(x) + "," + String.valueOf(y) + "," + String.valueOf(z);
}
}
public class Main {
int n, h;
int cube;
Scanner sc;
Set<Cube> hole;
enum C {XY, XZ, YZ;}
Main() {
sc = new Scanner(System.in);
}
public static void main(String[] args) {
new Main().run();
}
boolean init() {
n = sc.nextInt();
h = sc.nextInt();
if (n == 0 && h == 0) return false;
hole = new HashSet<Cube>();
for (int _h = 0; _h < h; _h++) {
String c; int a, b;
c = sc.next();
a = sc.nextInt()-1;
b = sc.nextInt()-1;
switch (C.valueOf(c.toUpperCase())) {
case XY:
for (int i = 0; i < n; i++) hole.add(new Cube(a, b, i));
break;
case XZ:
for (int i = 0; i < n; i++) hole.add(new Cube(a, i, b));
break;
case YZ:
for (int i = 0; i < n; i++) hole.add(new Cube(i, a, b));
break;
}
}
return true;
}
void run() {
while (init()) {
System.out.println(n*n*n - hole.size());
}
}
} | Main.java:1: error: class, interface, enum, or record expected
gimport java.io.*;
^
Main.java:2: error: class, interface, enum, or record expected
import java.util.*;
^
2 errors
|
s754659522 | p00616 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
public static void main(String args[]){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while(true){
String strs[] = br.readLine().split(" ");
int n = Integer.parseInt(strs[0]);
int h = Integer.parseInt(strs[1]);
if(n == 0) return;
boolean ana[][][] = new boolean[n][n][n];
for(int i = 0; i < h; i++){
strs = br.readLine().split(" ");
int arg1 = Integer.parseInt(strs[1]) - 1;
int arg2 = Integer.parseInt(strs[2]) - 1;
if(strs[0].equals("xy")){
// xy
for(int j = 0; j < n; j++)
ana[arg1][arg2][j] = true;
}else if(strs[0].equals("xz")){
// xz
for(int j = 0; j < n; j++)
ana[arg1][j][arg2] = true;
}else{
// yz
for(int j = 0; j < n; j++)
ana[j][arg1][arg2] = true;
}
}
int answer = n * n * n;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
for(int k = 0; k < n; k++)
if(ana[i][j][k]) answer--;
System.out.println(answer);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | Main.java:47: error: reached end of file while parsing
}
^
1 error
|
s304444833 | p00616 | Java | import java.io.*;
import java.util.*;
public class p1030yet {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String line;
/* input */
while(true){
line = br.readLine();
int n = Integer.parseInt(line.split(" ")[0]), h = Integer.parseInt(line.split(" ")[1]);
if(n==0&&h==0) return;
Set<Integer> s = new HashSet<Integer>();
for(int i=0;i<h;i++){
line = br.readLine();
String[] str = line.split(" ");
String p = str[0];
int a = Integer.parseInt(str[1])-1, b = Integer.parseInt(str[2])-1;
if(p.equals("xy")){
for(int j=0;j<n;j++){
s.add(1000000*a+1000*b+j);
}
} else if(p.equals("yz")){
for(int j=0;j<n;j++){
s.add(1000000*j+1000*a+b);
}
} else {
for(int j=0;j<n;j++){
s.add(1000000*a+1000*j+b);
}
}
}
System.out.println(n*n*n-s.size());
}
} catch (IOException e) {
e.printStackTrace();
}
}
} | Main.java:4: error: class p1030yet is public, should be declared in a file named p1030yet.java
public class p1030yet {
^
1 error
|
s560871496 | p00616 | C | #include <stdio.h>
#include <string.h>
int main(void)[
while(1){
int n, h, a, b, i, j, k;
int cube[500][500][500] = {0};
char c[3];
long count = 0;
scanf("%d %d", &n, &h);
if(n==0 && h==0) break;
for(i=0; i<h; i++) {
scanf(" %s %d %d", c, &a, &b);
if(strcmp(c, "xy")==0){
for(i=0; i<n; i++)
cube[a][b][i]=1;
}
else if(strcmp(c, "xz")==0){
for(i=0; i<n; i++)
cube[a][i][b]=1;
}
else if(strcmp(c, "yz")==0){
for(i=0; i<n; i++)
cube[i][a][b]=1;
}
}
for(i=0; i<n; i++){
for(j=0; j<n; j++){
for(k=0; k<n; k++){
if(a[i][j][k]==0) count++;
}
}
}
printf("%ld\n", count);
}
return 0;
} | main.c:6:9: error: expected expression before 'while'
6 | while(1){
| ^~~~~
|
s710479707 | p00616 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<unordered_map>
using namespace std;
bool a[500][500][500];
signed main() {
memset(a, -1, sizeof(a));
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(a, -1, sizeof(a));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include<unordered_map>
+++ |+#include <cstring>
9 | using namespace std;
|
s111376360 | p00616 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
bool cube[500][500][500];
int main()
{
int N, H;
while (cin >> N >> H) {
memset(cube, false, sizeof cube);
if (N == 0 && H == 0) {break;}
for (int i = 0; i < H; i++) {
string s;
int x, y;
cin >> s >> x >> y;
x--, y--;
if (s == "xy") {
for (int j = 0; j < N; j++) {
cube[x][y][j] = true;
}
}
if (s == "xz") {
for (int j = 0; j < N; j++) {
cube[j][x][y] = true;
}
}
if (s == "yz") {
for (int j = 0; j < N; j++) {
cube[y][j][x] = true;
}
}
}
int c = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int k = 0; k < N; k++) {
if (!cube[i][j][k]) c++;
}
}
}
cout << c-1 << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'memset' was not declared in this scope
12 | memset(cube, false, sizeof cube);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cstdio>
+++ |+#include <cstring>
3 |
|
s358292957 | p00616 | C++ | #include <iostream>
#include <string>
using namespace std;
void check(int a,int b,int c,int hole[], int& count)
{
bool f=false;
point = a*1000000 + b *1000 + c;
for(int i=0; i < count; i++){
if(hole[i] == point){
f=true;
break;
}
}
if(!f){
hole[count++] = point;
}
}
int main(void){
int n,h;
while(cin >> n >> h){
if (!n) break;
int count = 0;
int hole[100000]={0};
while(h--){
int a,b;
string c;
cin >> c >> a >> b;
for(int i=0;i<n;i++){
if(c == "xy") check(a-1,b-1,i,hole,count);
else if(c == "xz") check(a-1,i,b-1,hole,count);
else check(i,a-1,b-1,hole,count);
}
}
cout << n*n*n - count << endl;
}
return (0);
} | a.cc: In function 'void check(int, int, int, int*, int&)':
a.cc:7:9: error: 'point' was not declared in this scope
7 | point = a*1000000 + b *1000 + c;
| ^~~~~
|
s108153209 | p00616 | C++ | #include <iostream>
#include <set>
#include <string>
using namespace std;
struct P{
int x,y,z;
};
int main(){
int n,h,a,b;
string str;
while( cin >> n >> h , n||h ){
set<struct P> s;
for(int i= 0 ;i < h ; i++ ){
cin >> str >> a >> b;
if( str == "xy" ){
for(int z=0 ; z < n ; z++ ){
struct P p;
p.x = a;
p.y = b;
p.z = z;
s.insert( p );
}
}else if( str == "xz" ){
for(int y=0 ; y < n ; y++ ){
/*struct P p;
p.x = a;
p.y = y;
p.z = b;
s.insert( p );*/
}
}else if( str == "yz" ){
for(int x=0 ; x < n ; x++ ){
/*struct P p;
p.x = x;
p.y = a;
p.z = b;
s.insert( p );*/
}
}
}
int ans = n*n*n - s.size();
cout << ans << endl;
}
} | In file included from /usr/include/c++/14/string:49,
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_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = P]':
/usr/include/c++/14/bits/stl_tree.h:2116:35: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = P; _Val = P; _KeyOfValue = std::_Identity<P>; _Compare = std::less<P>; _Alloc = std::allocator<P>; key_type = P]'
2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x));
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const P&; _Key = P; _Val = P; _KeyOfValue = std::_Identity<P>; _Compare = std::less<P>; _Alloc = std::allocator<P>]'
2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v));
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:514:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = P; _Compare = std::less<P>; _Alloc = std::allocator<P>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<P, P, std::_Identity<P>, std::less<P>, std::allocator<P> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<P>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<P>, P>::rebind<P>; typename _Alloc::value_type = P; value_type = P]'
514 | _M_t._M_insert_unique(__x);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:25:14: required from here
25 | s.insert( p );
| ~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const P' and 'const P')
405 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const P' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const P' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const P' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const P' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
|
s696166766 | p00616 | C++ | #include <iostream>
#include <string>
#include <set>
using namespace std;
typedef struct xyz
{
int x;
int y;
int z;
}pos;
int main ()
{
int n, h, a, b;
string c;
set<pos> s;
pos p;
while( cin >> n >> h, (n||h) )
{
for( int i = 0; i < h; i++)
{
cin >> c;
cin >> a;
cin >> b;
if( c == "xy" )
for(int j = 0; j < n; j++)
{
p.x = a;
p.y = b;
p.z = j;
}
else if( c == "xz" )
for(int j = 0; j < n; j++)
{
p.x = a;
p.y = j;
p.z = b;
}
else if( c == "yz" )
for(int j = 0; j < n; j++)
{
p.x = j;
p.y = a;
p.z = b;
}
s.insert(p);
}
cout << n*n*n - s.size() << endl;
}
return 0;
} | In file included from /usr/include/c++/14/string:49,
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_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = xyz]':
/usr/include/c++/14/bits/stl_tree.h:2116:35: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = xyz; _Val = xyz; _KeyOfValue = std::_Identity<xyz>; _Compare = std::less<xyz>; _Alloc = std::allocator<xyz>; key_type = xyz]'
2116 | __comp = _M_impl._M_key_compare(__k, _S_key(__x));
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tree.h:2169:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = const xyz&; _Key = xyz; _Val = xyz; _KeyOfValue = std::_Identity<xyz>; _Compare = std::less<xyz>; _Alloc = std::allocator<xyz>]'
2169 | = _M_get_insert_unique_pos(_KeyOfValue()(__v));
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_set.h:514:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = xyz; _Compare = std::less<xyz>; _Alloc = std::allocator<xyz>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<xyz, xyz, std::_Identity<xyz>, std::less<xyz>, std::allocator<xyz> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<xyz>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<xyz>, xyz>::rebind<xyz>; typename _Alloc::value_type = xyz; value_type = xyz]'
514 | _M_t._M_insert_unique(__x);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:54:12: required from here
54 | s.insert(p);
| ~~~~~~~~^~~
/usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const xyz' and 'const xyz')
405 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const xyz' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const xyz' is not derived from 'const std::reverse_iterator<_Iterator>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const xyz' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_function.h:405:20: note: 'const xyz' is not derived from 'const std::move_iterator<_IteratorL>'
405 | { return __x < __y; }
| ~~~~^~~~~
|
s699128942 | p00616 | C++ | #include <iostream>
#include <stdio.h>
const int nmax = 500;
const int hmax = 200;
using namespace std;
int main(void){
int n,h;
/*
bool*** box = new bool**[nmax];
for(int i=0;i<nmax;++i){
box[i] = new bool*[nmax];
for(int j=0;j<nmax;++j){
box[i][j] = new bool[nmax];
}
}
*/
while(cin >> n >> h){
//cout << n << " " << h << endl;
if(n == 0 && h == 0){
//cout << "finish!" << endl;
break;
}
int*** box = new int**[n];
for(int i=0;i<n;++i){
box[i] = new int*[n];
for(int j=0;j<n;++j){
box[i][j] = new int[n];
}
}
char plane[h][2];
int pos1[h],pos2[h];
for(int i=0;i<h;++i){
scanf("%s",plane[i]);
cin >> pos1[i] >> pos2[i];
pos1[i]--; pos2[i]--;
//cout << plane[i][0] << " " << plane[i][1] << " " << pos1[i] << " " << pos2[i] << endl;
}
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
for(int k=0;k<n;++k){
box[i][j][k] = 0;
}
}
}
for(int i=0;i<h;++i){
if(plane[i][0] == 'y'){
for(int index=0;index<n;++index){
box[index][pos1[i]][pos2[i]] = 0;
}
}
else if(plane[i][1] == 'z'){
for(int index=0;index<n;++index){
box[pos1[i]][index][pos2[i]] = 0;
}
}
else{
for(int index=0;index<n;++index){
box[pos1[i]][pos2[i]][index] = 0;
}
}
}
int count = 0;
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
for(int k=0;k<n;++k){
cout += box[i][j][k];
}
}
}
}
cout << count << endl;
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
delete[] box[i][j];
}
delete[] box[i];
}
delete[] box;
}
/*
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
delete[] box[i][j];
}
delete[] box[i];
}
delete[] box;
*/
} | a.cc: In function 'int main()':
a.cc:75:46: error: no match for 'operator+=' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
75 | cout += box[i][j][k];
| ~~~~~^~~~~~~~~~~~~~~
a.cc:80:25: error: 'count' was not declared in this scope
80 | cout << count << endl;
| ^~~~~
a.cc:85:42: error: 'box' was not declared in this scope
85 | delete[] box[i][j];
| ^~~
a.cc:87:34: error: 'box' was not declared in this scope
87 | delete[] box[i];
| ^~~
a.cc:89:26: error: 'box' was not declared in this scope
89 | delete[] box;
| ^~~
a.cc: At global scope:
a.cc:102:1: error: expected declaration before '}' token
102 | }
| ^
|
s029422002 | p00616 | C++ | #include <iostream>
#include <stdio.h>
const int nmax = 500;
const int hmax = 200;
using namespace std;
int main(void){
int n,h;
/*
bool*** box = new bool**[nmax];
for(int i=0;i<nmax;++i){
box[i] = new bool*[nmax];
for(int j=0;j<nmax;++j){
box[i][j] = new bool[nmax];
}
}
*/
while(cin >> n >> h){
//cout << n << " " << h << endl;
if(n == 0 && h == 0){
//cout << "finish!" << endl;
break;
}
int*** box = new int**[n];
for(int i=0;i<n;++i){
box[i] = new int*[n];
for(int j=0;j<n;++j){
box[i][j] = new int[n];
}
}
char plane[h][2];
int pos1[h],pos2[h];
for(int i=0;i<h;++i){
scanf("%s",plane[i]);
cin >> pos1[i] >> pos2[i];
pos1[i]--; pos2[i]--;
//cout << plane[i][0] << " " << plane[i][1] << " " << pos1[i] << " " << pos2[i] << endl;
}
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
for(int k=0;k<n;++k){
box[i][j][k] = 0;
}
}
}
for(int i=0;i<h;++i){
if(plane[i][0] == 'y'){
for(int index=0;index<n;++index){
box[index][pos1[i]][pos2[i]] = 0;
}
}
else if(plane[i][1] == 'z'){
for(int index=0;index<n;++index){
box[pos1[i]][index][pos2[i]] = 0;
}
}
else{
for(int index=0;index<n;++index){
box[pos1[i]][pos2[i]][index] = 0;
}
}
}
int count = 0;
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
for(int k=0;k<n;++k){
cout += box[i][j][k];
}
}
}
cout << count << endl;
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
delete[] box[i][j];
}
delete[] box[i];
}
delete[] box;
}
/*
for(int i=0;i<n;++i){
for(int j=0;j<n;++j){
delete[] box[i][j];
}
delete[] box[i];
}
delete[] box;
*/
} | a.cc: In function 'int main()':
a.cc:75:46: error: no match for 'operator+=' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
75 | cout += box[i][j][k];
| ~~~~~^~~~~~~~~~~~~~~
|
s405687206 | p00617 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Stack;
public class Main {
static Main main = new P1031();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (!(line = br.readLine()).equals("0")) {
int n = Integer.parseInt(line);
Panel parent, child;
parent = parse(br.readLine());
for (int i = 0; i < n; i++) {
line = br.readLine();
int p[] = new int[2];
p[0] = Integer.parseInt(line.split(" ")[0]);
p[1] = Integer.parseInt(line.split(" ")[1]);
child = parent.touched(main.new Point(p[0], p[1]));
if (child == null) {
System.out.println("OUT OF MAIN PANEL 1");
} else {
System.out
.println(child.name + " " + child.children.size());
}
}
}
}
// タグ文字列のパース
public static Panel parse(String struct) {
Stack<Panel> stack = new Stack<P1031.Panel>();
Panel result = null;
char c;
StringBuilder name, points;
name = points = null;
for (int i = 0; i < struct.length(); i++) {
c = struct.charAt(i);
// 名前の読み取り
if (c == '<') {
i++;
c = struct.charAt(i);
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
name = new StringBuilder();
while (c != '>') {
name.append(c);
i++;
c = struct.charAt(i);
}
} else if (c == '/') {
stack.pop();
while (c != '>') {
i++;
c = struct.charAt(i);
}
}
}
// 座標の読み取り
if ((c >= '0' && c <= '9') || c == ',') {
points = new StringBuilder();
points.append(c);
while (struct.charAt(i + 1) != '<') {
i++;
points.append(struct.charAt(i));
}
}
// 新しいパネル
if (name != null && points != null) {
int[] p = new int[4];
p[0] = Integer.parseInt(points.toString().split(",")[0]);
p[1] = Integer.parseInt(points.toString().split(",")[1]);
p[2] = Integer.parseInt(points.toString().split(",")[2]);
p[3] = Integer.parseInt(points.toString().split(",")[3]);
Point top, buttom;
Panel panel;
top = main.new Point(p[0], p[1]);
buttom = main.new Point(p[2], p[3]);
panel = main.new Panel(name.toString(), top, buttom);
if (stack.size() > 0) {
stack.peek().children.add(panel);
stack.push(panel);
} else {
stack.push(main.new Panel(name.toString(), top, buttom));
result = stack.firstElement();
}
name = points = null;
}
}
return result;
}
// ポイント
public class Point {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
// パネル
public class Panel {
String name;
Point top, buttom;
ArrayList<Panel> children;
public Panel(String name, Point top, Point buttom) {
this.name = name;
this.top = top;
this.buttom = buttom;
children = new ArrayList<Panel>();
}
public ArrayList<Panel> add(Panel panel) {
if (children.add(panel))
return children;
else
return null;
}
private boolean isIntercect(Point touch) {
if (touch.x >= top.x && touch.y >= top.y)
if (touch.x <= buttom.x && touch.y <= buttom.y)
return true;
return false;
}
public Panel touchedChild(Point touch) {
for (Panel child : children) {
if (child.isIntercect(touch))
return child;
}
return this;
}
public Panel touched(Point touch) {
Panel result = null;
if (this.isIntercect(touch)) {
Panel parent, child;
parent = this;
child = parent.touchedChild(touch);
while (!child.equals(parent)) {
parent = child;
child = parent.touchedChild(touch);
}
result = child;
}
return result;
}
}
} | Main.java:10: error: cannot find symbol
static Main main = new P1031();
^
symbol: class P1031
location: class Main
Main.java:39: error: package P1031 does not exist
Stack<Panel> stack = new Stack<P1031.Panel>();
^
2 errors
|
s598107057 | p00617 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Stack;
public class Main {
static Main main = new Main();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (!(line = br.readLine()).equals("0")) {
int n = Integer.parseInt(line);
Panel parent, child;
parent = parse(br.readLine());
for (int i = 0; i < n; i++) {
line = br.readLine();
int p[] = new int[2];
p[0] = Integer.parseInt(line.split(" ")[0]);
p[1] = Integer.parseInt(line.split(" ")[1]);
child = parent.touched(main.new Point(p[0], p[1]));
if (child == null) {
System.out.println("OUT OF MAIN PANEL 1");
} else {
System.out
.println(child.name + " " + child.children.size());
}
}
}
}
// タグ文字列のパース
public static Panel parse(String struct) {
Stack<Panel> stack = new Stack<P1031.Panel>();
Panel result = null;
char c;
StringBuilder name, points;
name = points = null;
for (int i = 0; i < struct.length(); i++) {
c = struct.charAt(i);
// 名前の読み取り
if (c == '<') {
i++;
c = struct.charAt(i);
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
name = new StringBuilder();
while (c != '>') {
name.append(c);
i++;
c = struct.charAt(i);
}
} else if (c == '/') {
stack.pop();
while (c != '>') {
i++;
c = struct.charAt(i);
}
}
}
// 座標の読み取り
if ((c >= '0' && c <= '9') || c == ',') {
points = new StringBuilder();
points.append(c);
while (struct.charAt(i + 1) != '<') {
i++;
points.append(struct.charAt(i));
}
}
// 新しいパネル
if (name != null && points != null) {
int[] p = new int[4];
p[0] = Integer.parseInt(points.toString().split(",")[0]);
p[1] = Integer.parseInt(points.toString().split(",")[1]);
p[2] = Integer.parseInt(points.toString().split(",")[2]);
p[3] = Integer.parseInt(points.toString().split(",")[3]);
Point top, buttom;
Panel panel;
top = main.new Point(p[0], p[1]);
buttom = main.new Point(p[2], p[3]);
panel = main.new Panel(name.toString(), top, buttom);
if (stack.size() > 0) {
stack.peek().children.add(panel);
stack.push(panel);
} else {
stack.push(main.new Panel(name.toString(), top, buttom));
result = stack.firstElement();
}
name = points = null;
}
}
return result;
}
// ポイント
public class Point {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
// パネル
public class Panel {
String name;
Point top, buttom;
ArrayList<Panel> children;
public Panel(String name, Point top, Point buttom) {
this.name = name;
this.top = top;
this.buttom = buttom;
children = new ArrayList<Panel>();
}
public ArrayList<Panel> add(Panel panel) {
if (children.add(panel))
return children;
else
return null;
}
private boolean isIntercect(Point touch) {
if (touch.x >= top.x && touch.y >= top.y)
if (touch.x <= buttom.x && touch.y <= buttom.y)
return true;
return false;
}
public Panel touchedChild(Point touch) {
for (Panel child : children) {
if (child.isIntercect(touch))
return child;
}
return this;
}
public Panel touched(Point touch) {
Panel result = null;
if (this.isIntercect(touch)) {
Panel parent, child;
parent = this;
child = parent.touchedChild(touch);
while (!child.equals(parent)) {
parent = child;
child = parent.touchedChild(touch);
}
result = child;
}
return result;
}
}
} | Main.java:39: error: package P1031 does not exist
Stack<Panel> stack = new Stack<P1031.Panel>();
^
1 error
|
s787708241 | p00617 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef string::const_iterator Cursol;
typedef pair< int, int > Pi;
typedef pair< Pi, Pi > Piii;
struct Data{
string name;
Piii p;
vector< Data > foo;
};
bool inPosition(const int& x, const int& y, const Data& data){
Piii p = data.p;
return (p.first.first <= x && x <= p.second.first &&
p.first.second <= y && y <= p.second.second);
}
int rec(Data now, const Data& panel){
int ret = 0;
for(int i = 0; i < now.foo.size(); i++){
ret += rec( now.foo[i], panel) + 1;
}
return ret;
}
pair< string , int > solve(const int x,const int y, const Data& panel){
Data now = panel;
int cnt = 0;
if(!inPosition(x, y, now)){
return make_pair( "OUT OF MAIN PANEL", 1);
}
/*
bool flag = true;
while(flag){ //ここでREしてるよふえぇ*/
flag = false;
for(int i = 0; i < now.foo.size(); i++){
if(inPosition( x, y, now.foo[i])){
now = now.foo[i];
flag = true;
break;
}
}
}
*/
return make_pair( now.name, rec(now, panel));
}
string getString(Cursol& pos)
{
Cursol prev = pos;
while(*pos != '>'){
pos++;
}
return string(prev,pos);
}
Piii getPosision(Cursol& pos)
{
Piii p;
Cursol prev = pos;
while(*pos != '<'){
pos++;
}
sscanf( string( prev, pos).c_str(), "%d,%d,%d,%d",
&p.first.first, &p.first.second, &p.second.first, &p.second.second);
return p;
}
void Check( Cursol& pos, Data& ret)
{
ret = (Data){ getString(++pos), getPosision(++pos), vector< Data >(0)};
while(*(pos + 1) != '/'){ //終了タグ
ret.foo.resize(ret.foo.size() + 1);
Check( pos, ret.foo[ret.foo.size() - 1]);
}
getString(++pos);
++pos;
}
int main(){
int n;
string tag;
Data Main;
Cursol crl;
while(cin >> n, n){
cin >> tag;
Check( crl = tag.begin(), Main); //こうぶんかいせき!!
while(n--){
int x, y;
cin >> x >> y;
pair< string , int > ans = solve( x, y, Main);
cout << ans.first << " " << ans.second << endl;
}
}
return(0);
} | a.cc: In function 'std::pair<std::__cxx11::basic_string<char>, int> solve(int, int, const Data&)':
a.cc:42:5: error: 'flag' was not declared in this scope
42 | flag = false;
| ^~~~
a.cc: At global scope:
a.cc:51:2: error: expected unqualified-id before '/' token
51 | */
| ^
a.cc:53:1: error: expected declaration before '}' token
53 | }
| ^
a.cc: In function 'std::pair<std::__cxx11::basic_string<char>, int> solve(int, int, const Data&)':
a.cc:50:3: warning: control reaches end of non-void function [-Wreturn-type]
50 | }
| ^
|
s803125873 | p00617 | C++ | #include <iostream>
#include <string>
#include <utility>
using namespace std;
typedef tuple<int,int,int,int> T;
typedef pair<string,T> P;
string str;
int p;
P TagStruct();
string OpenTag();
string CloseTag();
string TagName();
T TagValue();
P TagStruct() {
string op = OpenTag();
T t = TagValue();
while (str[p] == '<' and str[p+1] != '/') {
:w | a.cc: In function 'P TagStruct()':
a.cc:21:5: error: expected primary-expression before ':' token
21 | :w
| ^
a.cc:21:7: error: expected '}' at end of input
21 | :w
| ^
a.cc:20:45: note: to match this '{'
20 | while (str[p] == '<' and str[p+1] != '/') {
| ^
a.cc:21:7: error: expected '}' at end of input
21 | :w
| ^
a.cc:17:15: note: to match this '{'
17 | P TagStruct() {
| ^
a.cc:21:7: warning: no return statement in function returning non-void [-Wreturn-type]
21 | :w
| ^
|
s149079897 | p00617 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>
using namespace std;
struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> ostream& operator << (ostream& ost, vector<T> const& v) { ost << "["; rep(i, v.size()) { if(i) ost << ", "; ost << v[i]; } ost << "]"; return ost; }
namespace parser {
typedef string::const_iterator Iter;
Iter __begin, __end;
Iter __it;
void remain_dump() {
cout << "Remain: '" << string(__it, __end) << "'" << endl;
}
void init_iterator(Iter begin, Iter end) {
__begin = begin;
__end = end;
__it = begin;
}
void consume(char expected) {
assert(__end != __it);
if(*__it != expected) {
remain_dump();
assert(false);
}
__it ++;
}
bool consume_if(char expected) {
if(*__it != expected) return false;
consume(expected);
return true;
}
void unread() {
assert(__it != __begin);
__it --;
}
bool eof() {
return __it == __end;
}
void append(int& tar, char add) { tar *= 10; tar += add - '0'; }
void append(string& tar, char add) { tar += add; }
enum readable { alphabetical = 1<<0, integer = 1<<1 };
enum class lexstat { no_stat = -1, read_eof, success };
lexstat lstat = lexstat::no_stat;
template<class return_type>
return_type lex(readable rd, vector<char> const& skipper = {}, vector<char> const& excepts = {}) {
auto can_go = [&](char c) {
if(find(skipper.begin(), skipper.end(), c) != skipper.end()) return false;
if(find(excepts.begin(), excepts.end(), c) != excepts.end()) return true;
if((rd & alphabetical) && isalpha(c)) return true;
if((rd & integer) && isdigit(c)) return true;
return false;
};
if(!can_go(*__it)) {
lstat = lexstat::read_eof;
return return_type{};
}
return_type ret{};
while(can_go(*__it))
append(ret, *__it), consume(*__it);
lstat = lexstat::success;
return ret;
}
void lex_f(string const& force) {
for(auto c: force)
consume(c);
}
void lex_f(int force) {
lex_f(to_string(force));
}
template<class return_type>
vector<return_type> lex_stream(readable rd, vector<char> const& skipper, vector<char> const& excepts = {}) {
vector<return_type> ret;
while(1) {
auto r = lex<return_type>(rd, skipper, excepts);
if(lstat == lexstat::read_eof) break;
ret.push_back(r);
if(find(skipper.begin(), skipper.end(), *__it) != skipper.end()) {
consume(*__it);
}
}
return ret;
}
bool look_ahead(string const& expected) {
int n = expected.size();
int i = 0;
while(i < n) {
if(!consume_if(expected[i])) break;
i ++;
}
if(i == n) {
while(i--) unread();
return true;
}
while(i--) unread();
return false;
}
}
using namespace parser;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef long long ll;
int const inf = 1<<29;
struct xml {
string tag;
vector<int> prop;
vector<shared_ptr<xml>> children;
};
shared_ptr<xml> parse(shared_ptr<xml>& p) {
while(!eof()) {
if(look_ahead("</")) {
lex_f("</" + p->tag + ">");
return p;
} else if(look_ahead("<")) {
auto c = make_shared<xml>();
c->tag = lex<string>(alphabetical, {}, {'<','>'});
c->tag = c->tag.substr(1, c->tag.size()-2);
c->prop = lex_stream<int>(integer, {','});
p->children.push_back(c);
parse(c);
}
}
return p;
}
shared_ptr<const xml> parse(Iter begin, Iter end) {
init_iterator(begin, end);
auto p = make_shared<xml>();
p->tag = "OUT OF MAIN PANEL";
return parse(p);
}
pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
for(auto && c: p->children)
if(c->prop[0] <= x && c->prop[1] <= y && x <= c->prop[2] && y <= c->prop[3])
return dfs(c, x, y);
return {p->tag, p->children.size()};
}
int main() {
for(int T; cin >> T;) {
string xml_str; cin >> xml_str;
auto root = parse(xml_str.begin(), xml_str.end());
while(T--) {
int x, y; cin >> x >> y;
auto r = dfs(root, x, y);
cout << r.first << " " << r.second << endl;
}
}
return 0;
} | a.cc:160:10: error: 'shared_ptr' was not declared in this scope
160 | vector<shared_ptr<xml>> children;
| ^~~~~~~~~~
a.cc:22:1: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
21 | #include <fstream>
+++ |+#include <memory>
22 |
a.cc:160:21: error: template argument 1 is invalid
160 | vector<shared_ptr<xml>> children;
| ^~~
a.cc:160:21: error: template argument 2 is invalid
a.cc:160:24: error: expected unqualified-id before '>' token
160 | vector<shared_ptr<xml>> children;
| ^~
a.cc:163:1: error: 'shared_ptr' does not name a type
163 | shared_ptr<xml> parse(shared_ptr<xml>& p) {
| ^~~~~~~~~~
a.cc:180:1: error: 'shared_ptr' does not name a type
180 | shared_ptr<const xml> parse(Iter begin, Iter end) {
| ^~~~~~~~~~
a.cc:187:23: error: 'shared_ptr' was not declared in this scope
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~~~~~~~~
a.cc:187:23: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
a.cc:187:34: error: expected primary-expression before 'const'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~~~
a.cc:187:55: error: expected primary-expression before 'int'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~
a.cc:187:62: error: expected primary-expression before 'int'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~
a.cc:187:69: error: expected ',' or ';' before '{' token
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^
a.cc: In function 'int main()':
a.cc:199:17: error: 'parse' was not declared in this scope; did you mean 'parser'?
199 | auto root = parse(xml_str.begin(), xml_str.end());
| ^~~~~
| parser
|
s661873697 | p00617 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>
using namespace std;
struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> ostream& operator << (ostream& ost, vector<T> const& v) { ost << "["; rep(i, v.size()) { if(i) ost << ", "; ost << v[i]; } ost << "]"; return ost; }
namespace parser {
typedef string::const_iterator Iter;
Iter __begin, __end;
Iter __it;
void remain_dump() {
cout << "Remain: '" << string(__it, __end) << "'" << endl;
}
void init_iterator(Iter begin, Iter end) {
__begin = begin;
__end = end;
__it = begin;
}
void consume(char expected) {
assert(__end != __it);
if(*__it != expected) {
remain_dump();
assert(false);
}
__it ++;
}
bool consume_if(char expected) {
if(*__it != expected) return false;
consume(expected);
return true;
}
void unread() {
assert(__it != __begin);
__it --;
}
bool eof() {
return __it == __end;
}
void append(int& tar, char add) { tar *= 10; tar += add - '0'; }
void append(string& tar, char add) { tar += add; }
enum readable { alphabetical = 1<<0, integer = 1<<1 };
enum class lexstat { no_stat = -1, read_eof, success };
lexstat lstat = lexstat::no_stat;
template<class return_type>
return_type lex(readable rd, vector<char> const& skipper = {}, vector<char> const& excepts = {}) {
auto can_go = [&](char c) {
if(find(skipper.begin(), skipper.end(), c) != skipper.end()) return false;
if(find(excepts.begin(), excepts.end(), c) != excepts.end()) return true;
if((rd & alphabetical) && isalpha(c)) return true;
if((rd & integer) && isdigit(c)) return true;
return false;
};
if(!can_go(*__it)) {
lstat = lexstat::read_eof;
return return_type{};
}
return_type ret{};
while(can_go(*__it))
append(ret, *__it), consume(*__it);
lstat = lexstat::success;
return ret;
}
void lex_f(string const& force) {
for(auto c: force)
consume(c);
}
void lex_f(int force) {
lex_f(to_string(force));
}
template<class return_type>
vector<return_type> lex_stream(readable rd, vector<char> const& skipper, vector<char> const& excepts = {}) {
vector<return_type> ret;
while(1) {
auto r = lex<return_type>(rd, skipper, excepts);
if(lstat == lexstat::read_eof) break;
ret.push_back(r);
if(find(skipper.begin(), skipper.end(), *__it) != skipper.end()) {
consume(*__it);
}
}
return ret;
}
bool look_ahead(string const& expected) {
int n = expected.size();
int i = 0;
while(i < n) {
if(!consume_if(expected[i])) break;
i ++;
}
if(i == n) {
while(i--) unread();
return true;
}
while(i--) unread();
return false;
}
}
using namespace parser;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef long long ll;
int const inf = 1<<29;
struct xml {
string tag;
vector<int> prop;
vector<shared_ptr<xml>> children;
};
shared_ptr<xml> parse(shared_ptr<xml>& p) {
while(!eof()) {
if(look_ahead("</")) {
lex_f("</" + p->tag + ">");
return p;
} else if(look_ahead("<")) {
auto c = make_shared<xml>();
c->tag = lex<string>(alphabetical, {}, {'<','>'});
c->tag = c->tag.substr(1, c->tag.size()-2);
c->prop = lex_stream<int>(integer, {','});
p->children.push_back(c);
parse(c);
}
}
return p;
}
shared_ptr<const xml> parse(Iter begin, Iter end) {
init_iterator(begin, end);
auto p = make_shared<xml>();
p->tag = "OUT OF MAIN PANEL";
return parse(p);
}
pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
for(auto && c: p->children)
if(c->prop[0] <= x && c->prop[1] <= y && x <= c->prop[2] && y <= c->prop[3])
return dfs(c, x, y);
return make_pair(p->tag, p->children.size());
}
int main() {
for(int T; cin >> T;) {
string xml_str; cin >> xml_str;
auto root = parse(xml_str.begin(), xml_str.end());
while(T--) {
int x, y; cin >> x >> y;
auto r = dfs(root, x, y);
cout << r.first << " " << r.second << endl;
}
}
return 0;
} | a.cc:160:10: error: 'shared_ptr' was not declared in this scope
160 | vector<shared_ptr<xml>> children;
| ^~~~~~~~~~
a.cc:22:1: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
21 | #include <fstream>
+++ |+#include <memory>
22 |
a.cc:160:21: error: template argument 1 is invalid
160 | vector<shared_ptr<xml>> children;
| ^~~
a.cc:160:21: error: template argument 2 is invalid
a.cc:160:24: error: expected unqualified-id before '>' token
160 | vector<shared_ptr<xml>> children;
| ^~
a.cc:163:1: error: 'shared_ptr' does not name a type
163 | shared_ptr<xml> parse(shared_ptr<xml>& p) {
| ^~~~~~~~~~
a.cc:180:1: error: 'shared_ptr' does not name a type
180 | shared_ptr<const xml> parse(Iter begin, Iter end) {
| ^~~~~~~~~~
a.cc:187:23: error: 'shared_ptr' was not declared in this scope
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~~~~~~~~
a.cc:187:23: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
a.cc:187:34: error: expected primary-expression before 'const'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~~~
a.cc:187:55: error: expected primary-expression before 'int'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~
a.cc:187:62: error: expected primary-expression before 'int'
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^~~
a.cc:187:69: error: expected ',' or ';' before '{' token
187 | pair<string, int> dfs(shared_ptr<const xml> const& p, int x, int y) {
| ^
a.cc: In function 'int main()':
a.cc:199:17: error: 'parse' was not declared in this scope; did you mean 'parser'?
199 | auto root = parse(xml_str.begin(), xml_str.end());
| ^~~~~
| parser
|
s436044914 | p00617 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>
using namespace std;
struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> ostream& operator << (ostream& ost, vector<T> const& v) { ost << "["; rep(i, v.size()) { if(i) ost << ", "; ost << v[i]; } ost << "]"; return ost; }
namespace parser {
typedef string::const_iterator Iter;
Iter __begin, __end;
Iter __it;
void remain_dump() {
cout << "Remain: '" << string(__it, __end) << "'" << endl;
}
void init_iterator(Iter begin, Iter end) {
__begin = begin;
__end = end;
__it = begin;
}
void consume(char expected) {
assert(__end != __it);
if(*__it != expected) {
remain_dump();
assert(false);
}
__it ++;
}
bool consume_if(char expected) {
if(*__it != expected) return false;
consume(expected);
return true;
}
void unread() {
assert(__it != __begin);
__it --;
}
bool eof() {
return __it == __end;
}
void append(int& tar, char add) { tar *= 10; tar += add - '0'; }
void append(string& tar, char add) { tar += add; }
enum readable { alphabetical = 1<<0, integer = 1<<1 };
enum class lexstat { no_stat = -1, read_eof, success };
lexstat lstat = lexstat::no_stat;
template<class return_type>
return_type lex(readable rd, vector<char> const& skipper = {}, vector<char> const& excepts = {}) {
auto can_go = [&](char c) {
if(find(skipper.begin(), skipper.end(), c) != skipper.end()) return false;
if(find(excepts.begin(), excepts.end(), c) != excepts.end()) return true;
if((rd & alphabetical) && isalpha(c)) return true;
if((rd & integer) && isdigit(c)) return true;
return false;
};
if(!can_go(*__it)) {
lstat = lexstat::read_eof;
return return_type{};
}
return_type ret{};
while(can_go(*__it))
append(ret, *__it), consume(*__it);
lstat = lexstat::success;
return ret;
}
void lex_f(string const& force) {
for(auto c: force)
consume(c);
}
void lex_f(int force) {
lex_f(to_string(force));
}
template<class return_type>
vector<return_type> lex_stream(readable rd, vector<char> const& skipper, vector<char> const& excepts = {}) {
vector<return_type> ret;
while(1) {
auto r = lex<return_type>(rd, skipper, excepts);
if(lstat == lexstat::read_eof) break;
ret.push_back(r);
if(find(skipper.begin(), skipper.end(), *__it) != skipper.end()) {
consume(*__it);
}
}
return ret;
}
bool look_ahead(string const& expected) {
int n = expected.size();
int i = 0;
while(i < n) {
if(!consume_if(expected[i])) break;
i ++;
}
if(i == n) {
while(i--) unread();
return true;
}
while(i--) unread();
return false;
}
}
using namespace parser;
#define DEF_PARSER(ast, property_definitions, root_settings) \
struct ast { \
property_definitions; \
vector<shared_ptr<ast>> children; \
}; \
shared_ptr<ast> parse_ ## ast(shared_ptr<ast>& p); \
shared_ptr<const ast> parse_ ## ast(Iter begin, Iter end) { \
init_iterator(begin, end); \
auto p = make_shared<xml>(); \
root_settings; \
return parse_ ## ast(p); \
}
#define PARSE(ast, tar) \
parse_ ## ast(begin(tar), end(tar))
#define PARSER_IMPL(ast, start_cond) \
shared_ptr<ast> parse_ ## ast(shared_ptr<ast>& p) { \
while(!eof()) { \
if (start_cond) {
#define HEAD(str) look_ahead(str)
#define CHANCE(cond) \
return p; \
} else if(cond) {
#define END_PARSER_IMPL \
}} \
return p; \
}
#define prop(pr) p->pr
#define cprop(pr) c->pr
#define RECUR(ast, property_settings) \
auto c = make_shared<ast>(); \
property_settings; \
p->children.push_back(c); \
parse_ ## ast(p);
#define ast_ref(const_ast) shared_ptr<const const_ast> const& __ast_ref_p
#define enumerate_children(c) \
for(auto && c: __ast_ref_p->children)
#define ref_prop(pr) __ast_ref_p->pr
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
DEF_PARSER(xml,
string tag;
vector<int> nums;
,
prop(tag) = "OUT OF MAIN PANEL"
)
PARSER_IMPL(xml,
HEAD("</"))
lex_f("</" + p->tag + ">"); CHANCE(
HEAD("<"))
RECUR(xml,
cprop(tag) = lex<string>(alphabetical, {}, {'<','>'});
cprop(tag) = c->tag.substr(1, c->tag.size()-2);
cprop(nums) = lex_stream<int>(integer, {','});
)
END_PARSER_IMPL
pair<string, int> dfs(ast_ref(xml), int x, int y) {
enumerate_children(c)
if(c->nums[0] <= x && c->nums[1] <= y && x <= c->nums[2] && y <= c->nums[3])
return dfs(c, x, y);
return {ref_prop(tag), ref_prop(children.size())};
}
int main() {
for(int T; cin >> T;) {
string str; cin >> str;
auto root = PARSE(xml, str);
while(T--) {
int x, y; cin >> x >> y;
auto r = dfs(root, x, y);
cout << r.first << " " << r.second << endl;
}
}
return 0;
} | a.cc:155:10: error: 'shared_ptr' was not declared in this scope
155 | vector<shared_ptr<ast>> children; \
| ^~~~~~~~~~
a.cc:199:1: note: in expansion of macro 'DEF_PARSER'
199 | DEF_PARSER(xml,
| ^~~~~~~~~~
a.cc:22:1: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
21 | #include <fstream>
+++ |+#include <memory>
22 |
a.cc:199:12: error: template argument 1 is invalid
199 | DEF_PARSER(xml,
| ^~~
a.cc:155:21: note: in definition of macro 'DEF_PARSER'
155 | vector<shared_ptr<ast>> children; \
| ^~~
a.cc:199:12: error: template argument 2 is invalid
199 | DEF_PARSER(xml,
| ^~~
a.cc:155:21: note: in definition of macro 'DEF_PARSER'
155 | vector<shared_ptr<ast>> children; \
| ^~~
a.cc:155:24: error: expected unqualified-id before '>' token
155 | vector<shared_ptr<ast>> children; \
| ^~
a.cc:199:1: note: in expansion of macro 'DEF_PARSER'
199 | DEF_PARSER(xml,
| ^~~~~~~~~~
a.cc:157:1: error: 'shared_ptr' does not name a type
157 | shared_ptr<ast> parse_ ## ast(shared_ptr<ast>& p); \
| ^~~~~~~~~~
a.cc:199:1: note: in expansion of macro 'DEF_PARSER'
199 | DEF_PARSER(xml,
| ^~~~~~~~~~
a.cc:158:1: error: 'shared_ptr' does not name a type
158 | shared_ptr<const ast> parse_ ## ast(Iter begin, Iter end) { \
| ^~~~~~~~~~
a.cc:199:1: note: in expansion of macro 'DEF_PARSER'
199 | DEF_PARSER(xml,
| ^~~~~~~~~~
a.cc:169:1: error: 'shared_ptr' does not name a type
169 | shared_ptr<ast> parse_ ## ast(shared_ptr<ast>& p) { \
| ^~~~~~~~~~
a.cc:206:1: note: in expansion of macro 'PARSER_IMPL'
206 | PARSER_IMPL(xml,
| ^~~~~~~~~~~
a.cc:191:28: error: 'shared_ptr' was not declared in this scope
191 | #define ast_ref(const_ast) shared_ptr<const const_ast> const& __ast_ref_p
| ^~~~~~~~~~
a.cc:218:23: note: in expansion of macro 'ast_ref'
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^~~~~~~
a.cc:191:28: note: 'std::shared_ptr' is defined in header '<memory>'; this is probably fixable by adding '#include <memory>'
191 | #define ast_ref(const_ast) shared_ptr<const const_ast> const& __ast_ref_p
| ^~~~~~~~~~
a.cc:218:23: note: in expansion of macro 'ast_ref'
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^~~~~~~
a.cc:191:39: error: expected primary-expression before 'const'
191 | #define ast_ref(const_ast) shared_ptr<const const_ast> const& __ast_ref_p
| ^~~~~
a.cc:218:23: note: in expansion of macro 'ast_ref'
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^~~~~~~
a.cc:218:37: error: expected primary-expression before 'int'
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^~~
a.cc:218:44: error: expected primary-expression before 'int'
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^~~
a.cc:218:51: error: expected ',' or ';' before '{' token
218 | pair<string, int> dfs(ast_ref(xml), int x, int y) {
| ^
a.cc: In function 'int main()':
a.cc:166:3: error: 'parse_xml' was not declared in this scope
166 | parse_ ## ast(begin(tar), end(tar))
| ^~~~~~
a.cc:230:17: note: in expansion of macro 'PARSE'
230 | auto root = PARSE(xml, str);
| ^~~~~
|
s417579231 | p00617 | C++ | #include <stdio.h>
#include <list>
using namespace std;
class Window{
public:
~Window()
{
list<class Window*>::iterator it;
for (it = child.begin(); it != child.end(); it++){
delete (*it);
}
}
Window* Click(int x, int y)
{
Window *ret;
list<class Window*>::iterator it;
ret = this;
if (isClick(x, y) == true){
for (it = child.begin(); it != child.end(); it++){
if ((*it)->Click(x, y) != NULL) ret = *it;
}
}
else {
return (NULL);
}
return (ret);
}
bool isClick(int x, int y)
{
return (sx <= x && ex >= x && sy <= y && ey >= y);
}
char name[100];
int sx, sy;
int ex, ey;
list<class Window*> child;
};
Window* input(char tag[])
{
int i;
Window *Parent;
Parent = new Window;
while (*tag != '<') tag++;
tag++;
i = 0;
while (*tag != '>'){
Parent->name[i++] = *tag++;
}
Parent->name[i] = '\0';
while (!isdigit(*tag)) tag++;
Parent->sx = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->sy = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->ex = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->ey = atoi(tag);
while (*tag != '\0'){
while (*tag != '<'){
tag++;
}
if (*(tag + 1) == '/'){
return (Parent);
}
else {
Parent->child.push_back(input(tag));
while (*tag != '/') tag++;
}
}
return (Parent);
}
int main(void)
{
Window *Main;
char tag[1001];
int n;
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
scanf("%s", tag);
Main = input(tag);
for (int i = 0; i < n; i++){
int x, y;
Window* output;
scanf("%d%d", &x, &y);
output = Main->Click(x, y);
if (output == NULL){
printf("OUT OF MAIN PANEL 1\n");
}
else {
printf("%s %d\n", output->name, output->child.size());
}
}
delete Main;
}
return (0);
} | a.cc: In function 'Window* input(char*)':
a.cc:58:17: error: 'isdigit' was not declared in this scope
58 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:59:22: error: 'atoi' was not declared in this scope
59 | Parent->sx = atoi(tag);
| ^~~~
a.cc:60:16: error: 'isdigit' was not declared in this scope
60 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:61:17: error: 'isdigit' was not declared in this scope
61 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:63:16: error: 'isdigit' was not declared in this scope
63 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:64:17: error: 'isdigit' was not declared in this scope
64 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:66:16: error: 'isdigit' was not declared in this scope
66 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:67:17: error: 'isdigit' was not declared in this scope
67 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
|
s919684662 | p00617 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <list>
using namespace std;
class Window{
public:
~Window()
{
list<class Window*>::iterator it;
for (it = child.begin(); it != child.end(); it++){
delete (*it);
}
}
Window* Click(int x, int y)
{
Window *ret;
list<class Window*>::iterator it;
ret = this;
if (isClick(x, y) == true){
for (it = child.begin(); it != child.end(); it++){
if ((*it)->Click(x, y) != NULL) ret = *it;
}
}
else {
return (NULL);
}
return (ret);
}
bool isClick(int x, int y)
{
return (sx <= x && ex >= x && sy <= y && ey >= y);
}
char name[100];
int sx, sy;
int ex, ey;
list<class Window*> child;
};
Window* input(char tag[])
{
int i;
Window *Parent;
Parent = new Window;
while (*tag != '<') tag++;
tag++;
i = 0;
while (*tag != '>'){
Parent->name[i++] = *tag++;
}
Parent->name[i] = '\0';
while (!isdigit(*tag)) tag++;
Parent->sx = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->sy = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->ex = atoi(tag);
while (isdigit(*tag)) tag++;
while (!isdigit(*tag)) tag++;
Parent->ey = atoi(tag);
while (*tag != '\0'){
while (*tag != '<'){
tag++;
}
if (*(tag + 1) == '/'){
return (Parent);
}
else {
Parent->child.push_back(input(tag));
while (*tag != '/') tag++;
}
}
return (Parent);
}
int main(void)
{
Window *Main;
char tag[1001];
int n;
while (1){
scanf("%d", &n);
if (n == 0){
break;
}
scanf("%s", tag);
Main = input(tag);
for (int i = 0; i < n; i++){
int x, y;
Window* output;
scanf("%d%d", &x, &y);
output = Main->Click(x, y);
if (output == NULL){
printf("OUT OF MAIN PANEL 1\n");
}
else {
printf("%s %d\n", output->name, output->child.size());
}
}
delete Main;
}
return (0);
} | a.cc: In function 'Window* input(char*)':
a.cc:59:17: error: 'isdigit' was not declared in this scope
59 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:61:16: error: 'isdigit' was not declared in this scope
61 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:62:17: error: 'isdigit' was not declared in this scope
62 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:64:16: error: 'isdigit' was not declared in this scope
64 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:65:17: error: 'isdigit' was not declared in this scope
65 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:67:16: error: 'isdigit' was not declared in this scope
67 | while (isdigit(*tag)) tag++;
| ^~~~~~~
a.cc:68:17: error: 'isdigit' was not declared in this scope
68 | while (!isdigit(*tag)) tag++;
| ^~~~~~~
|
s005957303 | p00617 | C++ | #define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <map>
#include <set>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 28;
const double EPS = 1E-10;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
string tag;
size_t cur;
map<int, string> tag_name;
vector<int> ch[200];
int x1[200];
int y1[200];
int x2[200];
int y2[200];
int res;
string get_name(){
string res;
while(tag[cur] != '>'){
res.push_back(tag[cur++]);
}
return res;
}
int get_num(){
int res = 0;
while(isdigit(tag[cur])){
res = res * 10 + tag[cur++] - '0';
}
return 0;
}
void get_size(int id){
x1[id] = get_num();
assert(tag[cur++] == ',');
y1[id] = get_num();
assert(tag[cur++] == ',');
x2[id] = get_num();
assert(tag[cur++] == ',');
y2[id] = get_num();
}
void tag_con(int &id){
int num = id;
assert(tag[cur++] == '<');
tag_name[id] = get_name();
assert(tag[cur++] == '>');
get_size(id);
while(true){
assert(tag[cur] == '<');
char c = tag[cur+1];
if(c == '/') break;
ch[num].push_back(++id);
tag_con(id);
}
while(tag[cur] != '>') cur++;
cur++;
}
void get_tag(int x, int y, int id){
if(x1[id] <= x && x <= x2[id] && y1[id] <= y && y <= y2[id]){
res = id;
}
for(int i = 0; i < (int)ch[id].size(); i++){
get_tag(x, y, ch[id][i]);
}
}
int main(){
int n, x, y;
int cnt = 0;
while(cin >> n && n){
tag_name.clear();
tag_name[120] = "OUT OF MAIN PANEL";
ch[120].push_back(120);
rep(i, 200) ch[i].clear();
cur = 0;
cnt = 0;
getline(cin, tag);
tag_con(cnt);
cout << cnt << endl;
rep(i, n){
res = 120;
cin >> x >> y;
get_tag(x, y, 0);
cout << tag_name[res] << " "<< ch[res].size() << endl;
}
}
return 0;
} | a.cc:46:11: error: 'int y1 [200]' redeclared as different kind of entity
46 | int y1[200];
| ^
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/bits/requires_hosted.h:31,
from /usr/include/c++/14/iostream:38,
from a.cc:2:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'void get_size(int)':
a.cc:71:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
71 | y1[id] = get_num();
| ^
a.cc:71:16: error: assignment of read-only location '*(y1 + ((sizetype)id))'
71 | y1[id] = get_num();
| ~~~~~~~^~~~~~~~~~~
a.cc: In function 'void get_tag(int, int, int)':
a.cc:97:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
97 | if(x1[id] <= x && x <= x2[id] && y1[id] <= y && y <= y2[id]){
| ^
a.cc:97:49: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
97 | if(x1[id] <= x && x <= x2[id] && y1[id] <= y && y <= y2[id]){
| ~~~~~~~^~~~
|
s261289294 | p00618 | C | #include<stdio.h>
int cnt(int n){
int ret = 0;
while(n){
ret++;
n ^= (n & (-n));
}
return ret;
}
int main(){
int c[20],k[20],r[20][20];
int n,u;
int i,j,l;
while(scanf("%d%d",&n,&u), n+u){
int ans = n;
for(i=0; i<n; i++){
scanf("%d%d",&c[i],&k[i]);
for(j=0; j<k[i]; j++)
scanf("%d",&r[i][j]);
}
for(i=0; i<(1<<n); i++){
int tni = 0;
int ok = 1;
int cc = cnt(i);
for(j=0; ok && j<n; j++)
if(i & (1<<j)){
tni += c[j];
for(l=0; ok && l<k[j]; l++)
if(!(i & (1<<r[j][l])))
ok = 0;
}
if(ok && tni >= u && ans > cc)
ans = cc;
}
printf("%d\n",ans);
}
}
#include<stdio.h>
int cnt(int n){
int ret = 0;
while(n){
ret++;
n ^= (n & (-n));
}
return ret;
}
int main(){
int c[20],k[20],r[20][20];
int n,u;
int i,j,l;
while(scanf("%d%d",&n,&u), n+u){
int ans = n;
for(i=0; i<n; i++){
scanf("%d%d",&c[i],&k[i]);
for(j=0; j<k[i]; j++)
scanf("%d",&r[i][j]);
}
for(i=0; i<(1<<n); i++){
int tni = 0;
int ok = 1;
int cc = cnt(i);
for(j=0; ok && j<n; j++)
if(i & (1<<j)){
tni += c[j];
for(l=0; ok && l<k[j]; l++)
if(!(i & (1<<r[j][l])))
ok = 0;
}
if(ok && tni >= u && ans > cc)
ans = cc;
}
printf("%d\n",ans);
}
} | main.c:43:5: error: redefinition of 'cnt'
43 | int cnt(int n){
| ^~~
main.c:3:5: note: previous definition of 'cnt' with type 'int(int)'
3 | int cnt(int n){
| ^~~
main.c:52:5: error: redefinition of 'main'
52 | int main(){
| ^~~~
main.c:12:5: note: previous definition of 'main' with type 'int()'
12 | int main(){
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.