submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s204236214 | p00713 | C++ |
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
while(true){
final int n = sc.nextInt();
if(n == 0){
break;
}
Point2D[] points = new Point2D[n];
for(int i = 0; i < n; i++){
points[i] = new Point2D(sc.nextDouble(), sc.nextDouble());
}
int max = 0;
for(int fst = 0; fst < n; fst++){
for(int snd = 0; snd < n; snd++){
Point2D[] cross = Point2D.cross_ss(points[fst], 1, points[snd], 1);
for(Point2D cross_c : cross){
int count = 0;
for(int i = 0; i < n; i++){
if(cross_c.dist(points[i]) <= 1.0 + Point2D.EPS){
count++;
}
}
max = Math.max(max, count);
}
}
}
System.out.println(max);
}
}
}
class Point2D {
public double x;
public double y;
public static final double EPS = 1e-4;
public Point2D(double x, double y) {
this.x = x;
this.y = y;
}
public Point2D(Point2D point) {
this.x = point.x;
this.y = point.y;
}
public String toString() {
return x + "," + y;
}
@Override
public boolean equals(Object o) {
if (o instanceof Point2D) {
Point2D another = (Point2D) o;
if (this.x - EPS < another.x && this.x + EPS > another.x
&& this.y - EPS < another.y && this.y + EPS > another.y) {
return true;
}
return false;
// return this.x == another.x && this.y == another.y;
}
return false;
}
public Point2D add(double x, double y) {
return new Point2D(this.x + x, this.y + y);
}
public Point2D sub(double x, double y) {
return add(-x, -y);
}
public Point2D add(Point2D another) {
return add(another.x, another.y);
}
public Point2D sub(Point2D another) {
return sub(another.x, another.y);
}
public Point2D mul(double d) {
return new Point2D(this.x * d, this.y * d);
}
public Point2D div(double d) {
return new Point2D(this.x / d, this.y / d);
}
public double dot(double x, double y) {
return this.x * x + this.y * y;
}
public double dot(Point2D another) {
return dot(another.x, another.y);
}
public double cross(double x, double y) {
return this.x * y - this.y * x;
}
public double cross(Point2D another) {
return cross(another.x, another.y);
}
public double dist(double x, double y) {
return Math.sqrt((this.x - x) * (this.x - x) + (this.y - y)
* (this.y - y));
}
public double dist(Point2D another) {
return dist(another.x, another.y);
}
public double dist_o() {
return dist(0, 0);
}
public Point2D unit() {
return div(dist_o());
}
public boolean pol(Point2D start, Point2D end) {
return end.sub(start).cross(this.sub(start)) < EPS;
}
public boolean pos(Point2D start, Point2D end) {
return (start.dist(this) + this.dist(end) < start.dist(end) + EPS);
}
public double pld(Point2D start, Point2D end) {
return Math.abs((end.sub(start).cross(this.sub(start)))
/ end.sub(start).dist_o());
}
public double psd(Point2D start, Point2D end) {
if (end.sub(start).dot(this.sub(start)) < EPS) {
return this.dist(start);
} else if (start.sub(end).dot(this.sub(end)) < EPS) {
return this.dist(end);
} else {
return end.sub(start).cross(this.sub(start)) / end.dist(start);
}
}
public static boolean intersect_s(Point2D a1, Point2D a2, Point2D b1,
Point2D b2) {
return (a2.sub(a1).cross(b1.sub(a1)) * a2.sub(a1).cross(b2.sub(a1)) < EPS)
&& (b2.sub(b1).cross(a1.sub(b1)) * b2.sub(b1).cross(a2.sub(b1)) < EPS);
}
public static boolean insersect_l(Point2D a1, Point2D a2, Point2D b1,
Point2D b2) {
return a1.sub(a2).cross(b1.sub(b2)) < EPS;
}
public static Point2D interpoint_s(Point2D a1, Point2D a2, Point2D b1,
Point2D b2) {
Point2D b = b2.sub(b1);
double d1 = Math.abs(b.cross(a1.sub(b1)));
double d2 = Math.abs(b.cross(a2.sub(b1)));
double t = d1 / (d1 + d2);
Point2D a = a2.sub(a1), v = a.mul(t);
return a1.add(v);
}
public static Point2D interpoint_l(Point2D a1, Point2D a2, Point2D b1,
Point2D b2) {
Point2D a = a2.sub(a1);
Point2D b = b2.sub(b1);
double t = b.cross(b1.sub(a1)) / b.cross(a);
Point2D v = a.mul(t);
return a1.add(v);
}
public static Point2D[] cross_ss(Point2D p1, double r1, Point2D p2,
double r2) {
double dis = p1.dist(p2);
if (r1 + EPS > r2 && r1 - EPS < r2 && dis < EPS) {
return new Point2D[0]; // same
}
if (dis - EPS < r1 + r2 && dis + EPS > r1 + r2) {
Point2D tmp = p2.sub(p1);
tmp = tmp.mul(r1 / tmp.dist_o());
Point2D ret[] = new Point2D[1];
ret[0] = p1.add(tmp);
return ret;
} else if (dis + EPS > r1 + r2) {
return new Point2D[0]; // out
}
double dis_m = Math.abs(r1 - r2);
if (dis_m + EPS > dis && dis_m - EPS < dis) {
Point2D tmp = null;
if (r1 > r2) {
tmp = p2.sub(p1);
} else {
tmp = p1.sub(p2);
}
double min = Math.min(r1, r2);
tmp = tmp.mul((min + tmp.dist_o()) / tmp.dist_o());
Point2D ret[] = new Point2D[1];
ret[0] = p1.add(tmp);
return ret;
} else if (dis_m + EPS > dis) {
return new Point2D[0]; // inner
} else {
Point2D ret[] = new Point2D[2];
double theta = Math.acos((dis * dis + r1 * r1 - r2 * r2)
/ (2 * dis * r1));
double a = Math.atan2(p2.y - p1.y, p2.x - p1.x);
ret[0] = new Point2D(r1 * Math.cos(a + theta) + p1.x, r1
* Math.sin(a + theta) + p1.y);
ret[1] = new Point2D(r1 * Math.cos(a - theta) + p1.x, r1
* Math.sin(a - theta) + p1.y);
return ret;
}
}
public void interpoint_lc(Point2D start, Point2D end, Point2D c, double r,
Point2D ans[]) {
if (c.pld(start, end) > r + EPS)
return;
Point2D v = end.sub(start).unit();
double delta = v.dot(start.sub(c)) * v.dot(start.sub(c))
- start.dist(c) * start.dist(c) + r * r;
double t = -v.dot(start.sub(c));
double s = Math.sqrt(delta);
ans[0] = start.add(v.mul(t + s));
ans[1] = start.add(v.mul(t + s));
}
public Point2D normal_vector(Point2D p, Point2D a, Point2D b) {
Point2D v = b.sub(a).unit();
v = v.cross(p.sub(a)) > 0 ? new Point2D(v.y, (-1) * v.x) : new Point2D(
(-1) * v.y, v.x);
return v.mul(p.pld(a, b));
}
public double area(Point2D a, Point2D b, Point2D c) {
return Math.abs((c.sub(a).cross(b.sub(a))) * 0.5);
}
} | a.cc:76:5: error: stray '@' in program
76 | @Override
| ^
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
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.util.HashMap;
| ^~~~~~
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.util.LinkedList;
| ^~~~~~
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.PriorityQueue;
| ^~~~~~
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.Scanner;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: expected unqualified-id before 'public'
9 | public class Main {
| ^~~~~~
a.cc:57:11: error: expected ':' before 'double'
57 | public double x;
| ^~~~~~~
| :
a.cc:58:11: error: expected ':' before 'double'
58 | public double y;
| ^~~~~~~
| :
a.cc:60:11: error: expected ':' before 'static'
60 | public static final double EPS = 1e-4;
| ^~~~~~~
| :
a.cc:60:19: error: 'final' does not name a type
60 | public static final double EPS = 1e-4;
| ^~~~~
a.cc:62:11: error: expected ':' before 'Point2D'
62 | public Point2D(double x, double y) {
| ^~~~~~~~
| :
a.cc:67:11: error: expected ':' before 'Point2D'
67 | public Point2D(Point2D point) {
| ^~~~~~~~
| :
a.cc:67:12: error: invalid constructor; you probably meant 'Point2D (const Point2D&)'
67 | public Point2D(Point2D point) {
| ^~~~~~~
a.cc:72:11: error: expected ':' before 'String'
72 | public String toString() {
| ^~~~~~~
| :
a.cc:72:12: error: 'String' does not name a type
72 | public String toString() {
| ^~~~~~
a.cc:76:6: error: 'Override' does not name a type
76 | @Override
| ^~~~~~~~
a.cc:92:11: error: expected ':' before 'Point2D'
92 | public Point2D add(double x, double y) {
| ^~~~~~~~
| :
a.cc:96:11: error: expected ':' before 'Point2D'
96 | public Point2D sub(double x, double y) {
| ^~~~~~~~
| :
a.cc:100:11: error: expected ':' before 'Point2D'
100 | public Point2D add(Point2D another) {
| ^~~~~~~~
| :
a.cc:104:11: error: expected ':' before 'Point2D'
104 | public Point2D sub(Point2D another) {
| ^~~~~~~~
| :
a.cc:108:11: error: expected ':' before 'Point2D'
108 | public Point2D mul(double d) {
| ^~~~~~~~
| :
a.cc:112:11: error: expected ':' before 'Point2D'
112 | public Point2D div(double d) {
| ^~~~~~~~
| :
a.cc:116:11: error: expected ':' before 'double'
116 | public double dot(double x, double y) {
| ^~~~~~~
| :
a.cc:120:11: error: expected ':' before 'double'
120 | public double dot(Point2D another) {
| ^~~~~~~
| :
a.cc:124:11: error: expected ':' before 'double'
124 | public double cross(double x, double y) {
| ^~~~~~~
| :
a.cc:128:11: error: expected ':' before 'double'
128 | public double cross(Point2D another) {
| ^~~~~~~
| :
a.cc:132:11: error: expected ':' before 'double'
132 | public double dist(double x, double y) {
| ^~~~~~~
| :
a.cc:137:11: error: expected ':' before 'double'
137 | public double dist(Point2D another) {
| ^~~~~~~
| :
a.cc:141:11: error: expected ':' before 'double'
141 | public double dist_o() {
| ^~~~~~~
| :
a.cc:145:11: error: expected ':' before 'Point2D'
145 | public Point2D unit() {
| ^~~~~~~~
| :
a.cc:149:11: error: expected ':' before 'boolean'
149 | public boolean pol(Point2D start, Point2D end) {
| ^~~~~~~~
| :
a.cc:149:12: error: 'boolean' does not name a type; did you mean 'bool'?
149 | public boolean pol(Point2D start, Point2D end) {
| ^~~~~~~
| bool
a.cc:153:11: error: expected ':' before 'boolean'
153 | public boolean pos(Point2D start, Point2D end) {
| ^~~~~~~~
| :
a.cc:153:12: error: 'boolean' does not name a type; did you mean 'bool'?
153 | public boolean pos(Point2D start, Point2D end) {
| ^~~~~~~
| bool
a.cc:157:11: error: expected ':' before 'double'
157 | public double pld(Point2D start, Point2D end) {
| ^~~~~~~
| :
a.cc:162:11: error: expected ':' before 'double'
162 | public double psd(Point2D start, Point2D end) {
| ^~~~~~~
| :
a.cc:172:11: error: expected ':' before 'static'
172 | public static boolean intersect_s(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| :
a.cc:172:19: error: 'boolean' does not name a type; did you mean 'bool'?
172 | public static boolean intersect_s(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| bool
a.cc:178:11: error: expected ':' before 'static'
178 | public static boolean insersect_l(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| :
a.cc:178:19: error: 'boolean' does not name a type; did you mean 'bool'?
178 | public static boolean insersect_l(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| bool
a.cc:183:11: error: expected ':' before 'static'
183 | public static Point2D interpoint_s(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| :
a.cc:193:11: error: expected ':' before 'static'
193 | public static Point2D interpoint_l(Point2D a1, Point2D a2, Point2D b1,
| ^~~~~~~
| :
a.cc:202:11: error: expected ':' before 'static'
202 | public static Point2D[] cross_ss(Point2D p1, double r1, Point2D p2,
| ^~~~~~~
| :
a.cc:202:26: error: expected unqualified-id before '[' token
202 | public static Point2D[] cross_ss(Point2D p1, double r1, Point2D p2,
| ^
a.cc:254:11: error: expected ':' before 'void'
254 | public void interpoint_lc(Point2D start, Point2D end, Point2D c, double r,
| ^~~~~
| :
a.cc:267:11: error: expected ':' before 'Point2D'
267 | public Point2D normal_vector(Point2D p, Point2D a, Point2D b) {
| ^~~~~~~~
| :
a.cc:274:11: error: expected ':' before 'double'
274 | public double area(Point2D a, Point2D b, Point2D c) {
| ^~~~~~~
| :
a.cc:278:2: error: expected ';' after class definition
278 | }
| ^
| ;
a.cc: In constructor 'Point2D::Point2D(double, double)':
a.cc:63:14: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
63 | this.x = x;
| ^
a.cc:64:14: error: request for member 'y' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
64 | this.y = y;
| ^
a.cc: In member function 'Point2D Point2D::add(double, double)':
a.cc:93:33: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
93 | return new Point2D(this.x + x, this.y + y);
| ^
a.cc:93:45: error: request for member 'y' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
93 | return new Point2D(this.x + x, this.y + y);
| ^
a.cc: In member function 'Point2D Point2D::mul(double)':
a.cc:109:33: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
109 | return new Point2D(this.x * d, this.y * d);
| ^
a.cc:109:45: error: request for member 'y' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
109 | return new Point2D(this.x * d, this.y * d);
| ^
a.cc: In member function 'Point2D Point2D::div(double)':
a.cc:113:33: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
113 | return new Point2D(this.x / d, this.y / d);
| ^
a.cc:113:45: error: request for member 'y' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
113 | return new Point2D(this.x / d, this.y / d);
| ^
a.cc: In member function 'double Point2D::dot(double, double)':
a.cc:117:21: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
117 | return this.x * x + this.y * y;
| ^
a.cc:117:34: error: request for member 'y' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
117 | return this.x * x + this.y * y;
| ^
a.cc: In member function 'double Point2D::cross(double, double)':
a.cc:125:21: error: request for member 'x' in '(Point2D*)this', which is of pointer type 'Point2D*' (maybe you meant to use '->' ?)
125 | return this.x * y - this.y * x;
| ^
a.cc:125:34: erro |
s330396152 | p00713 | C++ | #include<cstdio>
#include<iostream>
#include<vector>
#include<complex>
#include<algorithm>
#include<math>
using namespace std;
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
typedef complex<double> Point;
const double EPS = 0.000001;
int main(){
A:;
int n;
cin>>n;
if(n==0)return 0;
vector<Point> point;
rep(i,n){
double a,b;
cin>>a>>b;
point.push_back(Point(a,b));
}
int ans = 1;
rep(i,n){
rep(j,n){
if(i==j)continue;
Point p1 = point[j];
Point p0 = point[i];
Point diff = p1-p0;
Point d2 = diff/Point(2,0);
double dlen = abs(d2);
if(dlen>1.0)continue;
double clen = sqrt(1-dlen*dlen);
Point e = d2*Point(0,1);
e = e/Point(abs(e),0)*Point(clen,0);
Point t = p0 + d2 + e;
int count = 0;
rep(k,n){
if(abs(t-point[k])<=1.0+EPS)count++;
}
ans = max(ans,count);
}
}
printf("%d\n",ans);
goto A;
}
/*
3
6.47634 7.69628
5.16828 4.79915
6.69533 6.20378
2
0 0
0.8 0
2
0 0
0.5 0.5
2
0 0
0 2
6
7.15296 4.08328
6.50827 2.69466
5.91219 3.86661
5.29853 4.16097
6.10838 3.46039
6.34060 2.41599
*/ | a.cc:6:9: fatal error: math: No such file or directory
6 | #include<math>
| ^~~~~~
compilation terminated.
|
s722413241 | p00713 | C++ | # 1 "1132.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 175 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "1132.cpp" 2
#include <bits/stdc++.h>
using namespace std;
# 1 "./../geometory.cpp" 1
# 1 "geometry.h"
# 1 "<command-line>"
# 1 "geometry.h"
using namespace std;
# 1 "point.cpp" 1
typedef complex<double> Point;
const double EPS = 1e-8;
int sign(double a){
if(a > EPS) return +1;
if(a < -EPS) return -1;
return 0;
}
namespace std{
bool operator < (const Point& a, const Point& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
}
double dot(Point a, Point b){
return real(conj(a) * b);
}
double cross(Point a, Point b){
return imag(conj(a) * b);
}
double angle(Point a, Point b){
return arg(conj(a) * b);
}
Point rotate(Point a, double b, Point c = Point()){
return (a - c) * polar(1.0, b) + c;
}
int ccw(Point a, Point b, Point c) {
b -= a; c -= a;
if (cross(b, c) > +EPS) return +1;
if (cross(b, c) < -EPS) return -1;
if (dot(b, c) < 0) return +2;
if (norm(b) < norm(c)) return -2;
return 0;
}
# 4 "geometry.h" 2
# 1 "line.cpp" 1
struct Line : public vector<Point> {
Line(const Point& a, const Point& b) {
push_back(a); push_back(b);
}
Point vector() const {
return back() - front();
}
};
bool paralell(Line l, Line m){
return sign(cross(l.vector(), m.vector())) == 0;
}
bool equalLL(Line l, Line m){
return sign(cross(l.vector(), m[0] - l[0])) == 0;
}
bool iLP(Line l, Point p) {
return sign(cross(l.vector(), p - l[0])) == 0;
}
bool iSP(Line s, Point p) {
return ccw(s[0], s[1], p) == 0;
}
bool iLS(Line l, Line s) {
return sign(cross(l.vector(), s[0] - l[0]) * cross(l.vector(), s[1] - l[0])) <= 0;
}
bool iSS(Line s, Line t) {
return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 &&
ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}
Point proj(Line l, Point p){
double t = dot(p - l[0], l.vector()) / norm(l.vector());
return l[0] + t * l.vector();
}
Point refl(Line l, Point p){
return 2.0 * proj(l, p) - p;
}
double dLP(Line l, Point p){
return abs(cross(l.vector(), p - l[0])) / abs(l.vector());
}
double dSP(Line s, Point p){
if(sign(dot(s.vector(), p - s[0])) <= 0) return abs(p - s[0]);
if(sign(dot(-s.vector(), p - s[1])) <= 0) return abs(p - s[1]);
return dLP(s, p);
}
double dLL(Line l, Line m){
return paralell(l, m) ? dLP(l, m[0]) : 0;
}
double dLS(Line l, Line s){
if(iLS(l, s)) return 0;
return min(dLP(l, s[0]), dLP(l, s[1]));
}
double dSS(Line s, Line t){
if(iSS(s, t)) return 0;
return min({dSP(s, t[0]), dSP(s, t[1]), dSP(t, s[0]), dSP(t, s[1])});
}
Point pLL(Line l, Line m){
double A = cross(l.vector(), m.vector());
double B = cross(l.vector(), l[1] - m[0]);
if(sign(A) == 0 && sign(B) == 0) return m[0];
if(sign(A) == 0) assert(false);
return m[0] + m.vector() * B / A;
}
# 5 "geometry.h" 2
# 1 "polygon.cpp" 1
typedef vector<Point> Polygon;
Point curr(const Polygon& a, int x){ return a[x]; }
Point next(const Polygon& a, int x){ return a[(x + 1) % a.size()]; }
Point prev(const Polygon& a, int x){ return a[(x - 1 + a.size()) % a.size()]; }
enum { OUT, ON, IN };
int contains(const Polygon& P, const Point& p){
bool in = false;
for(int i = 0; i < P.size(); i++){
Point a = curr(P, i) - p;
Point b = next(P, i) - p;
if(a.imag() > b.imag()) swap(a, b);
if(a.imag() <= 0 && 0 < b.imag() && cross(a, b) < 0){
in = !in;
}
if(sign(cross(a, b)) == 0 && sign(dot(a, b)) <= 0) return ON;
}
return in ? IN : OUT;
}
double area(const Polygon& P) {
double A = 0;
for(int i = 0; i < P.size(); i++){
A += cross(curr(P, i), next(P, i));
}
return abs(A) / 2.0;
}
# 6 "geometry.h" 2
# 1 "convex.cpp" 1
Polygon convex_hull(vector<Point> ps) {
int n = ps.size(), k = 0;
sort(ps.begin(), ps.end());
vector<Point> ch(2*n);
for (int i = 0; i < n; ch[k++] = ps[i++]){
while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
}
for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]){
while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
}
ch.resize(k-1);
return ch;
}
bool is_convex(const Polygon& P){
for(int i = 0; i < P.size(); i++){
if(ccw(prev(P, i), curr(P, i), next(P, i)) > 0) return false;
}
return true;
}
Polygon convex_cut(const Polygon& P, Line l){
Polygon Q;
for(int i = 0; i < P.size(); i++){
Point A = curr(P, i), B = next(P, i);
if(ccw(l[0], l[1], A) != -1) Q.push_back(A);
if(ccw(l[0], l[1], A) * ccw(l[0], l[1], B) < 0)
Q.push_back(pLL(l, Line(A, B)));
}
return Q;
}
Line bisector(Point a, Point b){
Point mid = (a + b) / 2.0;
Point vec = (mid - a) * Point(0.0, 1.0);
return Line(mid, mid + vec);
}
Polygon voronoi_cell(Polygon P, const vector<Point>& ps, int s){
for(int i = 0; i < ps.size(); i++){
if(i != s) P = convex_cut(P, bisector(ps[s], ps[i]));
}
return P;
}
# 7 "geometry.h" 2
# 1 "circle.cpp" 1
struct Circle {
Point p;
double r;
Circle() {}
Circle(Point p, double r) : p(p), r(r) { }
};
enum{ OUT, ON, IN };
int contains(const Circle& C, const Point& p){
double d = abs(C.p - p);
if(sign(d - C.r) > 0) return OUT;
if(sign(d - C.r) == 0) return ON;
return IN;
}
bool iCS(const Circle& C, const Line& l){
int c1 = contains(C, l[0]);
int c2 = contains(C, l[1]);
if(c1 > c2) swap(c1, c2);
if(c1 == OUT && c2 == IN) return true;
if(c1 == IN && c2 == IN) return false;
if(c1 == ON) return true;
double d = dSP(l, C.p);
if(sign(d - C.r) < 0) return true;
if(sign(d - C.r) == 0) return true;
if(sign(d - C.r) > 0) return false;
}
bool iCC(const Circle& C, const Circle& D){
double e = abs(C.p - D.p);
return sign(e - (C.r + D.r)) <= 0 && sign(e - abs(C.r - D.r)) >= 0;
}
vector<Point> pLC(const Line &l, const Circle &c) {
vector<Point> res;
Point center = proj(l, c.p);
double d = abs(center - c.p);
double tt = c.r * c.r - d * d;
if(tt < 0 && tt > -EPS) tt = 0;
if(tt < 0) return res;
double t = sqrt(tt);
Point vect = l.vector();
vect /= abs(vect);
res.push_back(center - vect * t);
if (t > EPS) {
res.push_back(center + vect * t);
}
return res;
}
vector<Point> pSC(const Line &s, const Circle &c) {
vector<Point> ret;
vector<Point> nret = pLC(s, c);
for (int i = 0; i < nret.size(); i++) {
if (iSP(s, nret[i])) ret.push_back(nret[i]);
}
return ret;
}
vector<Point> pCC(Circle a, Circle b){
vector<Point> res;
double l = abs(b.p - a.p);
if(sign(l) == 0 && sign(a.r - b.r) == 0) assert(false);
if(sign(l - abs(a.r - b.r)) < 0 || sign(l - (a.r + b.r)) > 0) return res;
double th1 = arg(b.p - a.p);
if(sign(l - abs(a.r - b.r)) == 0 || sign(l - (a.r + b.r)) == 0){
res.push_back(a.p + polar(a.r, th1));
}else {
double th2 = acos( (a.r * a.r - b.r * b.r + l * l) / (2 * a.r * l) );
res.push_back(a.p + polar(a.r, th1 - th2));
res.push_back(a.p + polar(a.r, th1 + th2));
}
return res;
}
vector<Point> touching_circle2(Point a, Point b, double r){
vector<Point> res;
double d = abs(b - a);
if(d > 2 * r) return res;
Point mid = 0.5 * (a + b);
Point dir = polar(sqrt(r * r - d * d / 4), arg(b - a) + M_PI / 2);
res.push_back(mid + dir);
res.push_back(mid - dir);
return res;
}
Circle touching_circle3(Point a, Point b, Point c){
Point mid_ab = (a + b) / 2.0;
Line bis_ab(mid_ab, (mid_ab - a) * Point(0.0, 1.0));
Point mid_bc = (b + c) / 2.0;
Line bis_bc(mid_bc, (mid_bc - b) * Point(0.0, 1.0));
assert(!paralell(bis_ab, bis_bc));
Point center = pLL(bis_ab, bis_bc);
return Circle(center, abs(a - center));
}
double cc_area(const Circle& c1, const Circle& c2) {
double d = abs(c1.p - c2.p);
if (c1.r + c2.r < d + EPS) {
return 0.0;
} else if (d < abs(c1.r - c2.r) + EPS) {
double r = min(c1.r, c2.r);
return r * r * M_PI;
} else {
double rc = (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d);
double theta = acos(rc / c1.r);
double phi = acos((d - rc) / c2.r);
return c1.r*c1.r*theta + c2.r*c2.r*phi - d*c1.r*sin(theta);
}
}
# 8 "geometry.h" 2
# 1 "circle_tangent.cpp" 1
Line circle_tangent(const Circle& C, double th){
Point p0 = C.p + polar(C.r, th);
Point p1 = p0 + polar(1.0, th + M_PI / 2);
return Line(p0, p1);
}
vector<double> common_tangents(const Circle& C, const Circle& D){
vector<double> res;
Point v = D.p - C.p;
double l = abs(v);
double a = arg(v);
if(sign(l - abs(C.r - D.r)) > 0){
double a1 = acos((C.r - D.r) / l);
res.push_back(a + a1);
res.push_back(a - a1);
if(sign(l - (C.r + D.r)) > 0){
double a2 = acos((C.r + D.r) / l);
res.push_back(a + a2);
res.push_back(a - a2);
}
}
if((sign(l - abs(C.r - D.r)) == 0 || sign(l - (C.r + D.r)) == 0) && sign(l) != 0){
res.push_back(a);
}
return res;
}
vector<Line> tangents_through_point(const Circle& C, const Point& p){
vector<Line> tangents;
double d = abs(C.p - p);
double e = sqrt(d * d - C.r * C.r);
double th = asin(C.r / d);
Point q1 = p + (C.p - p) * polar(1.0, +th) * e / d;
Point q2 = p + (C.p - p) * polar(1.0, -th) * e / d;
tangents.push_back(Line(p, q1));
tangents.push_back(Line(p, q2));
return tangents;
}
# 8 "geometry.h" 2
# 7 "1132.cpp" 2
int main(){
int N;
while(cin >> N && N > 0) {
vector<Point> ps(N);
for(int i=0; i<(int)(N); ++i) {
double x, y;
cin >> x >> y;
ps[i] = Point(x, y);
}
int ans = 1;
for(int i=0; i<(int)(N); ++i) for(int j=0; j<(int)(N); ++j) if(i != j) {
vector<Point> cv = touching_circle2(ps[i], ps[j], 1.0);
for(auto c : cv) {
int sum = 0;
for(int k=0; k<(int)(N); ++k) {
if(sign(abs(c - ps[k]) - 1.0) <= 0) {
sum++;
}
}
ans = max(ans, sum);
}
}
cout << ans << endl;
}
return 0;
} | In file included from geometry.h:7,
from 1132.cpp:7:
circle.cpp:9:7: error: 'OUT' conflicts with a previous declaration
In file included from geometry.h:5:
polygon.cpp:10:8: note: previous declaration '<unnamed enum> OUT'
circle.cpp:9:12: error: 'ON' conflicts with a previous declaration
polygon.cpp:10:13: note: previous declaration '<unnamed enum> ON'
circle.cpp:9:16: error: 'IN' conflicts with a previous declaration
polygon.cpp:10:17: note: previous declaration '<unnamed enum> IN'
circle.cpp: In function 'bool iCS(const Circle&, const Line&)':
circle.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
|
s478889950 | p00713 | C++ | #include <bits/stdc++.h>
using namespace std;
double Dis(double x1, double y1, double x2, double y2);
int main(void){
while(1){
int n;
int ans = 1;
vector< pair<double, double> > p;
cin >> n;
if(n == 0) break;
for(int i=0; i<n; i++){
pair<double, double> t;
cin >> t.first >> t.second;
p.push_back(t);
}
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
//中点
double mpx = (p[i].first + p[j].first) / 2.0;
double mpy = (p[i].second + p[j].second) / 2.0;
//2点間の距離
double d1 = Dis(p[i].first, p[i].second, p[j].first, p[j].second);
//p[i]からp[j]へ向かうベクトル
double v1x = (p[i].first - p[j].first) / d1;
double v1y = (p[i].second - p[j].second) / d1;
//中点から円の中心へ向かう単位ベクトル
double v2x = -v1y;
double v2y = v1x;
//中心から円の中心へ向かうベクトルの長さ
double d2 = sqrt(1.0 - (d1*d1/4.0)));
//円の中心の座標
double cx = mpx + v2x * d2;
double cy = mpy + v2y * d2;
int cnt = 0;
for(int k=0; k<n; k++){
if(k == i || k == j || Dis(cx, cy, p[k].first, p[k].second) <= 1.0) cnt++;
}
if(cnt > ans){
ans = cnt;
}
cx = mpx - v2x * d2;
cy = mpy - v2y * d2;
cnt = 0;
for(int k=0; k<n; k++){
if(Dis(cx, cy, p[k].first, p[k].second) <= 1.0) cnt++;
}
if(cnt > ans){
ans = cnt;
}
}
}
cout << ans << endl;
}
return 0;
}
double Dis(double x1, double y1, double x2, double y2){
return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
} | a.cc: In function 'int main()':
a.cc:34:68: error: expected ',' or ';' before ')' token
34 | double d2 = sqrt(1.0 - (d1*d1/4.0)));
| ^
|
s264299576 | p00713 | C++ | #include <bits/stdc++.h>
using namespace std;
double Dis(double x1, double y1, double x2, double y2);
int main(void){
while(1){
int n;
int ans = 1;
vector< pair<double, double> > p;
cin >> n;
if(n == 0) break;
for(int i=0; i<n; i++){
pair<double, double> t;
cin >> t.first >> t.second;
p.push_back(t);
}
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
//中点
double mpx = (p[i].first + p[j].first) / 2.0;
double mpy = (p[i].second + p[j].second) / 2.0;
//2点間の距離
double d1 = Dis(p[i].first, p[i].second, p[j].first, p[j].second);
//p[i]からp[j]へ向かうベクトル
double v1x = (p[j].first - p[i].first) / d1;
double v1y = (p[j].second - p[i].second) / d1;
//中点から円の中心へ向かう単位ベクトル
double v2x = -v1y;
double v2y = v1x;
//中心から円の中心へ向かうベクトルの長さ
double d2 = sqrt(1.0 - (d1*d1/4.0));
//円の中心の座標
double cx = mpx + v2x * d2;
double cy = mpy + v2y * d2;
int cnt = 0;
for(int k=0; k<n; k++){
if(k == i || k == j || (cx-p[k].first)*(cx-p[k].first) + (cy-p[k].second)*(cy-p[k].second) <= 1.0) cnt++;
}
if(cnt > ans){
ans = cnt;
}
cx = mpx - v2x * d2;
cy = mpy - v2y * d2;
cnt = 0;
for(int k=0; k<n; k++){
}
if(cnt > ans){
if(k == i || k == j || (cx-p[k].first)*(cx-p[k].first) + (cy-p[k].second)*(cy-p[k].second) <= 1.0) cnt++;
ans = cnt;
}
}
}
cout << ans << endl;
}
return 0;
}
double Dis(double x1, double y1, double x2, double y2){
return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
} | a.cc: In function 'int main()':
a.cc:55:44: error: 'k' was not declared in this scope
55 | if(k == i || k == j || (cx-p[k].first)*(cx-p[k].first) + (cy-p[k].second)*(cy-p[k].second) <= 1.0) cnt++;
| ^
|
s864150787 | p00714 | Java | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class Main{
Scanner sc=new Scanner(System.in);
int INF=1<<28;
double EPS=1e-6;
int d;
int n;
int[] x, h;
int m;
int[] f, dv;
int l;
int[] p, t;
void run(){
d=sc.nextInt();
for(int k=0; k<d; k++){
n=sc.nextInt()+1;
x=new int[n+1];
h=new int[n+1];
x[0]=0;
x[n]=100;
h[0]=h[n]=50;
for(int i=1; i<n; i++){
x[i]=sc.nextInt();
h[i]=sc.nextInt();
}
m=sc.nextInt();
f=new int[m];
dv=new int[m];
for(int i=0; i<m; i++){
f[i]=sc.nextInt();
dv[i]=sc.nextInt();
}
l=sc.nextInt();
p=new int[l];
t=new int[l];
for(int i=0; i<l; i++){
p[i]=sc.nextInt();
t[i]=sc.nextInt();
}
solve();
}
}
double[] y, a;
double time;
void solve(){
y=new double[n];
a=new double[n];
for(int j=0; j<m; j++){
for(int i=0; i<n; i++){
if(x[i]<f[j]&&f[j]<x[i+1]){
a[i]+=dv[j]/30.0;
}
}
}
debug("y", y);
debug("a", a);
debug("x", x);
debug("h", h);
debug();
// Visualizer v=new Visualizer();
double[] ans=new double[l];
fill(ans,-1);
for(time=0;;){
double min=INF;
for(int i=0; i<n; i++){
if(a[i]>EPS){
if(y[i]+EPS<h[i]){
min=min(min, (h[i]-y[i])*(x[i+1]-x[i])/a[i]);
}
if(y[i]+EPS<h[i+1]){
min=min(min, (h[i+1]-y[i])*(x[i+1]-x[i])/a[i]);
}
}
}
for(int j=0;j<l;j++){
if(time<t[j]+EPS&&t[j]+EPS<time+min){
for(int i=0;i<n;i++){
if(x[i]<p[j]&&p[j]<x[i+1]){
ans[j]=min(y[i]+(t[j]-time)*a[i]/(x[i+1]-x[i]),50);
}
}
}
}
boolean all50=true;
time+=min;
for(int i=0; i<n; i++){
y[i]+=min*a[i]/(x[i+1]-x[i]);
all50&=abs(y[i]-50)<EPS;
}
if(all50){
break;
}
double[] a2=new double[n];
debug("y", y);
debug("a", a);
debug("x", x);
debug("h", h);
for(int j=0; j<n; j++){
boolean[] bottom=new boolean[n];
int left, right;
for(left=j; left>=1&&y[left]+EPS>h[left]; left--);
for(right=j; right<n-1&&y[right]+EPS>h[right+1]; right++);
if(y[left]+EPS<y[j]){
for(int i=left; i<n&&abs(y[i]-y[left])<EPS; i++){
bottom[i]=true;
}
}
if(y[right]+EPS<y[j]){
for(int i=right; i>=0&&abs(y[i]-y[right])<EPS; i--){
bottom[i]=true;
}
}
if(abs(y[left]-y[j])<EPS&&abs(y[right]-y[j])<EPS){
for(int i=left; i<=right; i++){
bottom[i]=true;
}
}
int sum=0;
for(int i=0; i<n; i++){
if(bottom[i]){
sum+=x[i+1]-x[i];
}
}
for(int i=0; i<n; i++){
if(bottom[i]){
a2[i]+=a[j]/sum*(x[i+1]-x[i]);
}
}
if(a[j]>0){
// debug(j, bottom);
}
}
a=a2.clone();
debug("time", time);
debug("y", y);
debug("a", a);
v.repaint();
sleep(4000);
}
for(int i=0;i<l;i++){
println(ans[i]>0?ans[i]+"":"50.0");
}
}
void sleep(long millis){
try{
Thread.sleep(millis);
}catch(InterruptedException e){
e.printStackTrace();
}
}
void debug(Object... os){
System.err.println(Arrays.deepToString(os));
}
void print(String s){
System.out.print(s);
}
void println(String s){
System.out.println(s);
}
public static void main(String[] args){
// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
new Main().run();
}
public class Visualizer extends JFrame{
Visualizer(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
getContentPane().add(new MainPanel(), BorderLayout.CENTER);
pack();
}
class MainPanel extends JPanel{
MainPanel(){
setPreferredSize(new Dimension(512, 512));
}
public void paintComponent(Graphics g){
int width=getWidth();
int height=getHeight();
for(int i=0; i<n; i++){
g.setColor(Color.BLUE);
g.fillRect(x[i]*4, height-(int)(y[i]*4), (x[i+1]-x[i])*4,
(int)(y[i]*4));
g.drawString(String.format("%.4f", a[i]), x[i]*4, height/2);
}
for(int i=0; i<=n; i++){
g.setColor(Color.RED);
g.drawLine(x[i]*4, height-h[i]*4, x[i]*4, height);
}
g.setColor(Color.BLACK);
g.drawString(""+time, 100, 100);
}
}
}
} | Main.java:160: error: cannot find symbol
v.repaint();
^
symbol: variable v
location: class Main
1 error
|
s355902565 | p00714 | C++ | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
void Fill(int l,int r,int in,int &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_h = min((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
water -= (int)(add_h * s); //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
int water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
printf("%.4lf\n",ht[p] / 30.0);
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, int&)':
a.cc:39:38: error: 'max_h' was not declared in this scope
39 | double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
| ^~~~~
|
s929850506 | p00714 | C++ | #include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
void Fill(int l,int r,int in,int &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_h = min((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
water -= (int)(add_h * s); //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
int water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
printf("%.4lf\n",ht[p] / 30.0);
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, int&)':
a.cc:39:38: error: 'max_h' was not declared in this scope
39 | double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
| ^~~~~
|
s005124846 | p00714 | C++ | #include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
void Fill(int l,int r,int in,int &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_h = min((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
water -= (int)(add_h * s); //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
int water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
printf("%.4lf\n",ht[p] / 30.0);
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, int&)':
a.cc:40:38: error: 'max_h' was not declared in this scope
40 | double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
| ^~~~~
|
s846965531 | p00714 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
void Fill(int l,int r,int in,double &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_h = min<double>((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
water -= add_h * s; //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
double water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
cout << ht[p] / 30.0 << endl;
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, double&)':
a.cc:38:38: error: 'max_h' was not declared in this scope
38 | double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
| ^~~~~
|
s220729990 | p00714 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
double min(double a,double b)
{
return (a > b) ? b : a;
}
void Fill(int l,int r,int in,double &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_h = min((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
water -= add_h * s; //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
double water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
cout << ht[p] / 30.0 << endl;
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, double&)':
a.cc:43:38: error: 'max_h' was not declared in this scope
43 | double add_h = (water > s * (max_h - h)) ? (max_h - h) : (water / (double)s);
| ^~~~~
|
s295812044 | p00714 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int N,M,L;
int B[10],H[10],P[10],T[10];
int flow[11]; //BÌÉ]¤
Ê B,F,AÉ˶A±êÈ~FAÍgíêÈ¢
double ht[11]; //tbãÌAæØçê½
̳h
double min(double a,double b)
{
return (a > b) ? b : a;
}
void Fill(int l,int r,int in,double &water)
{
if(water == 0) return ; //
ªÈ¢
if(l != r){
int ci = l,ch = 0; //ÌCfbNXƳ
for(int i = l; i < r; i++){
if(ch < H[i]){
ci = i; ch = H[i];
}
}
if(ci >= in){
Fill(l,ci,in,water);
Fill(ci+1,r,in,water);
} else {
Fill(ci+1,r,in,water);
Fill(l,ci,in,water);
}
}
int s = ((r == N) ? 100 : B[r]) - ((l == 0) ? 0 : B[l - 1]); //êÊÏ
double h = ht[l]; //³
//if(h >= 50.0) return ; //±êÈ~ÇÁÍsÂ\
double max_high = min((r == N) ? 50 * 30 : H[r],(l == 0) ? 50 * 30 : H[l - 1]);
////ÇÁ³êé³
double add_h = (water > s * (max_high - h)) ? (max_high - h) : (water / (double)s);
water -= add_h * s; //
ð¸çµ
for(int i = l; i <= r; i++) ht[i] += add_h; //
Êðã°é
}
void solve()
{
cin >> N;
flow[0] = 0;
for(int i = 0; i < N; i++){
cin >> B[i] >> H[i];
H[i] *= 30;
flow[i+1] = 0;
}
int F[10],A[10];
cin >> M;
for(int i = 0; i < M; i++){
cin >> F[i] >> A[i];
for(int j = 0; j <= N; j++){
if(j == N || F[i] < B[j]){
flow[j] += A[i];
break;
}
}
}
cin >> L;
for(int i = 0; i < L; i++)
cin >> P[i] >> T[i];
for(int i = 0; i < L; i++){
for(int j = 0; j <= N; j++){
ht[j] = 0.0; // ³NA
}
//
Ìã©ç
Ÿ
for(int j = 0; j <= N; j++){
if(flow[j] == 0) continue; //¬üȵ
double water = flow[j]*T[i];
Fill(0,N,j,water);
}
int p = 0;
while(p < N && P[i] > B[p]) p++;
//ÅãÉ30ÅÁijðàÆÉß·
cout << ht[p] / 30.0 << endl;
}
}
int main()
{
int D;
cin >> D;
for(int i = 0; i < D; i++)
{
solve();
}
return 0;
} | a.cc: In function 'void Fill(int, int, int, double&)':
a.cc:43:38: error: 'max_high' was not declared in this scope
43 | double add_h = (water > s * (max_high - h)) ? (max_high - h) : (water / (double)s);
| ^~~~~~~~
|
s115971877 | p00714 | C++ | #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct Tank{
int lx, rx;
int lh, rh;
double h;
Tank() {}
};
struct Event{
double t;
int type;
bool operator < (const Event& e) const {
return t > e.t;
}
Event() {}
Event(double t, int type) : t(t), type(type) {}
};
int main(){
int D;
cin >> D;
while(D--){
int N;
cin >> N;
vector<int> B(N + 2);
vector<int> H(N + 2);
REP(i, N) cin >> B[i + 1] >> H[i + 1];
B[0] = 0, B[N + 1] = 100;
H[0] = INT_MAX/4, H[N + 1] = INT_MAX/4;
int M;
cin >> M;
vector<int> F(M), A(M);
REP(i, M) cin >> F[i] >> A[i];
int L;
cin >> L;
vector<int> P(L), T(L);
REP(i, L) cin >> P[i] >> T[i];
vector<Tank> tank(N + 1);
REP(i, N + 1){
tank[i].lx = B[i];
tank[i].rx = B[i + 1];
tank[i].lh = H[i];
tank[i].rh = H[i + 1];
tank[i].h = 0;
}
priority_queue<Event> que;
REP(i, L){
que.push(Event(T[i], i));
}
que.push(Event(0, -1));
vector<double> ans(L);
while(!que.empty()){
// queue process
double t = que.top().t;
/*
printf("time = %lf\n", t);
REP(i, tank.size()){
printf("tank[%d]: lx = %d rx = %d lh = %d rh = %d h = %lf\n", i, tank[i].lx, tank[i].rx, tank[i].lh, tank[i].rh, tank[i].h);
}
*/
// if type >= 0 then output height;
if(que.top().type >= 0){
int idx = que.top().type;
REP(i, tank.size()){
if(tank[i].lx < P[idx] && P[idx] < tank[i].rx){
ans[idx] = min(tank[i].h, 50.0);
L--;
}
}
}
if(L == 0) break;
que.pop();
// push next event times
vector<double> w_fall(tank.size(), 0);
REP(i, M){
REP(j, tank.size()) if(tank[j].lx < F[i] && F[i] < tank[j].rx) w_fall[j] += A[i];
}
REP(iter, tank.size()){
REP(i, tank.size()) if(tank[i].h > 0) {
if(tank[i].lh == tank[i].h && tank[i].rh == tank[i].h){
w_fall[i - 1] += w_fall[i] / 2;
w_fall[i + 1] += w_fall[i] / 2;
w_fall[i] = 0;
}else if(tank[i].lh == tank[i].h){
w_fall[i - 1] += w_fall[i];
w_fall[i] = 0;
}else if(tank[i].rh == tank[i].h){
w_fall[i + 1] += w_fall[i];
w_fall[i] = 0;
}
}
}
// calc the time that some tanks are full.
double min_time = que.top().t;
REP(i, tank.size()) if(w_fall[i] > 0){
double dt = 30.0 * (tank[i].rx - tank[i].lx) * (min(tank[i].lh, tank[i].rh) - tank[i].h) / w_fall[i];
// printf("tank[%d] : fall = %lf dt = %lf\n", i, w_fall[i], dt);
assert(dt > 0);
min_time = min(min_time, t + dt);
}
if(min_time < que.top().t){
que.push(Event(min_time, -1));
}
// update water heights
double next_time = que.top().t;
REP(i, tank.size()) if(w_fall[i] > 0){
tank[i].h += w_fall[i] * (next_time - t) / (30.0 * (tank[i].rx - tank[i].lx));
if(abs(tank[i].h - min(tank[i].lh, tank[i].rh)) < EPS) tank[i].h = min(tank[i].lh, tank[i].rh); // OK ???
}
/*
printf("next_time = %lf\n", next_time);
REP(i, tank.size()){
printf("tank[%d]: lx = %d rx = %d lh = %d rh = %d h = %lf\n", i, tank[i].lx, tank[i].rx, tank[i].lh, tank[i].rh, tank[i].h);
}
*/
// merge segments
vector<Tank> n_tank;
REP(i, tank.size()){
int j = i;
while(j + 1 < tank.size() && tank[j].h == tank[j + 1].h && tank[j].h == tank[j].rh) j++;
tank[i].rx = tank[j].rx;
tank[i].rh = tank[j].rh;
n_tank.push_back(tank[i]);
i = j;
}
tank = n_tank;
}
REP(i, ans.size()) printf("%.16f\n", ans[i]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:56:12: error: 'INT_MAX' was not declared in this scope
56 | H[0] = INT_MAX/4, H[N + 1] = INT_MAX/4;
| ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
14 | #include <cassert>
+++ |+#include <climits>
15 |
|
s536454542 | p00714 | C++ | #include <iostream>
using namespace std;
int full( int height_max, int space, int water );
int main(){
int N, B[100], H[100]; // the number of boards , x position, the height of the board
int M, F[100], A[100]; // the number of faucets , x position, the amount of water flow
int L, P[100], T[10]; // the number of observation time, x position, the observation time in seconds
int block_height[100] = {0};
int space, water, f;
//recieve*******************/
cin >> N;
for ( int i = 0; i < N; i++ ){
cin >> B[i] >> H[i];
}
cin >> M;
for ( int j = 0; j < M; j++ ){
cin >> F[j] >> A[j];
}
cin >> L;
for ( int k = 0; k < L; k++ ){
cin >> P[k] >> T[k];
}
/***************************/
for ( k = 0; k < L; k++ ){
for ( j = 0; j < M; j++ ){
for ( i = 0; B[i] < F[j]; i++ ){
}
space = 30 * B[i] - B[i-1];
if ( H[i] < H[i-1] ){
height_max = H[i];
}
water = T[k] * A[j];
f = block_height[i-1] = full( height_max, space, water );
if ( f = 0 ){
space += 30 * B[i] - B[i+1];
}
}
int full( int height_max, int space, int water){
if ( water <= height_max * space ){
return height_max * space - water;
}else{
return 0;
}
} | a.cc: In function 'int main()':
a.cc:27:9: error: 'k' was not declared in this scope
27 | for ( k = 0; k < L; k++ ){
| ^
a.cc:28:11: error: 'j' was not declared in this scope
28 | for ( j = 0; j < M; j++ ){
| ^
a.cc:29:13: error: 'i' was not declared in this scope
29 | for ( i = 0; B[i] < F[j]; i++ ){
| ^
a.cc:31:22: error: 'i' was not declared in this scope
31 | space = 30 * B[i] - B[i-1];
| ^
a.cc:33:9: error: 'height_max' was not declared in this scope
33 | height_max = H[i];
| ^~~~~~~~~~
a.cc:36:37: error: 'height_max' was not declared in this scope
36 | f = block_height[i-1] = full( height_max, space, water );
| ^~~~~~~~~~
a.cc:43:48: error: a function-definition is not allowed here before '{' token
43 | int full( int height_max, int space, int water){
| ^
a.cc:49:2: error: expected '}' at end of input
49 | }
| ^
a.cc:27:28: note: to match this '{'
27 | for ( k = 0; k < L; k++ ){
| ^
a.cc:49:2: error: expected '}' at end of input
49 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s932423386 | p00715 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
int matrix[200][200] = { { 0 } };
int main(){
while(true){
int N;
cin >> N;
if(N == 0){ break; }
for(int i = 0; i < 200; ++i){
for(int j = 0; j < 200; ++j){ matrix[i][j] = 1000; }
}
map<string, int> names;
while(N--){
string line;
cin >> line;
int delimiter = line.find_first_of('-');
string a = line.substr(0, delimiter), b = line.substr(delimiter + 1);
if(names.find(a) == names.end()){
names.insert(make_pair(a, static_cast<int>(names.size())));
}
if(names.find(b) == names.end()){
names.insert(make_pair(b, static_cast<int>(names.size())));
}
int ai = names[a], bi = names[b];
matrix[ai][bi] = 1;
}
for(int k = 0; k < names.size(); ++k){
for(int i = 0; i < names.size(); ++i){
for(int j = 0; j < names.size(); ++j){
if(matrix[i][j] > matrix[i][k] + matrix[k][j]){
matrix[i][j] = matrix[i][k] + matrix[k][j];
}
}
}
}
for(int i = 0; i < names.size(); ++i){
for(int j = 0; j < names.size(); ++j){
if(matrix[i][j] <= 2 || matrix[j][i] <= 2){ continue; }
for(int k = 0; k < names.size(); ++k){
if(matrix[i][k] == 1 && matrix[j][k] == 1){
matrix[i][j] = matrix[j][i] = 0;
modified = true;
break;
}
if(matrix[k][i] == 1 && matrix[k][j] == 1){
matrix[i][j] = matrix[j][i] = 0;
modified = true;
break;
}
}
}
}
for(int k = 0; k < names.size(); ++k){
for(int i = 0; i < names.size(); ++i){
for(int j = 0; j < names.size(); ++j){
if(matrix[i][j] > matrix[i][k] + matrix[k][j]){
matrix[i][j] = matrix[i][k] + matrix[k][j];
}
}
}
}
int M;
cin >> M;
while(M--){
string line;
cin >> line;
int delimiter = line.find_first_of('-');
string a = line.substr(0, delimiter), b = line.substr(delimiter + 1);
if(names.find(a) == names.end() || names.find(b) == names.end()){
cout << "NO" << endl;
continue;
}
int ai = names[a], bi = names[b];
if(matrix[ai][bi] < 1000){
cout << (matrix[ai][bi] % 2 == 1 ? "YES" : "NO") << endl;
continue;
}
cout << "NO" << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:48:49: error: 'modified' was not declared in this scope
48 | modified = true;
| ^~~~~~~~
a.cc:53:49: error: 'modified' was not declared in this scope
53 | modified = true;
| ^~~~~~~~
|
s866237495 | p00716 | Java | import java.util.Scanner;
public class Fortune{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int data = sc.nextInt();
for(int j=0; j<data; j++){
int max = 0;
int before = sc.nextInt();
int year = sc.nextInt();
int type_num = sc.nextInt();
for(int i=0; i<type_num; i++){
int type = sc.nextInt();
double rate = sc.nextDouble();
int fee = sc.nextInt();
int after = 0;
switch(type){
case 0:
after = Simple_interest(before, year, rate, fee);
break;
case 1:
after = Compound_interest(before, year, rate, fee);
break;
}
if(max < after) max = after;
}
System.out.println(max);
}
}
public static int Simple_interest(int before, int year, double rate, int fee){
int fortune = before, interest = 0;
for(int i=0; i<year; i++){
interest += fortune*rate;
fortune -= fee;
}
return fortune+interest;
}
public static int Compound_interest(int before, int year, double rate, int fee){
int fortune = before, interest = 0;
for(int i=0; i<year; i++){
interest += fortune*rate;
fortune = fortune + interest - fee;
interest = 0;
}
return fortune;
}
} | Main.java:3: error: class Fortune is public, should be declared in a file named Fortune.java
public class Fortune{
^
1 error
|
s146058861 | p00716 | Java |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
// System.out.println("START");
Scanner scan = new Scanner(System.in);
int dataSetNum = scan.nextInt();
// List<DataSet> dataSets = new ArrayList<DataSet>();
for(int i = 0; i < dataSetNum; i++)
{
// dataSets.add(new DataSet());
}
for(int i = 0; i < dataSetNum; i++)
{
// System.out.println(dataSets.get(i).getAnswer());
}
}
| Main.java:28: error: reached end of file while parsing
}
^
1 error
|
s456141452 | p00716 | Java |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
// System.out.println("START");
Scanner scan = new Scanner(System.in);
int dataSetNum = scan.nextInt();
List<DataSet> dataSets = new ArrayList<DataSet>();
for(int i = 0; i < dataSetNum; i++)
{
dataSets.add(new DataSet(scan));
}
for(int i = 0; i < dataSetNum; i++)
{
System.out.println(dataSets.get(i).getAnswer());
}
}
static class DataSet
{
Scanner scan;
int startingMoney;
int years;
// List<Method> methods = new ArrayList<Method>();
int numOfMethods;
int answer;
public int getAnswer()
{
return answer;
}
void takeIn()
{
nextInt();
}
public DataSet(Scanner scanny)
{
scan = scanny;
takeIn();
//constructor
}
}
}
| Main.java:47: error: cannot find symbol
nextInt();
^
symbol: method nextInt()
location: class DataSet
1 error
|
s395039544 | p00716 | Java | package exercise2;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
// System.out.println("START");
int dataSetNum = 4;
List<DataSet> dataSets = new ArrayList<DataSet>();
for(int i = 0; i < dataSetNum; i++)
{
dataSets.add(new DataSet(scan));
}
for(int i = 0; i < dataSetNum; i++)
{
System.out.println(dataSets.get(i).getAnswer());
}
}
static class DataSet
{
Scanner scan;
int startingMoney;
int years;
// List<Method> methods = new ArrayList<Method>();
int numOfMethods;
int answer;
public int getAnswer()
{
return answer;
}
void takeIn()
{
scan.nextInt();
}
public DataSet(Scanner scanny)
{
scan = scanny;
takeIn();
//constructor
}
}
}
| Main.java:20: error: cannot find symbol
dataSets.add(new DataSet(scan));
^
symbol: variable scan
location: class Main
1 error
|
s810071392 | p00716 | Java |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
// System.out.println("START");
dataSets.add(new DataSet());
}
static class DataSet
{
Scanner scan = new Scanner(System.in);
int startingMoney;
int years;
// List<Method> methods = new ArrayList<Method>();
int numOfMethods;
int answer;
public int getAnswer()
{
return answer;
}
void takeIn()
{
scan.nextInt();
}
public DataSet()
{
takeIn();
//constructor
}
}
}
| Main.java:15: error: cannot find symbol
dataSets.add(new DataSet());
^
symbol: variable dataSets
location: class Main
1 error
|
s454517234 | p00716 | Java | import java.util.*;
public class P1135 {
Scanner sc ;
long si;
int y;
int t;
Str[] type;
void run() {
sc = new Scanner(System.in);
int n=sc.nextInt();
for (int i=0;i<n;i++) {
si = sc.nextLong();
y = sc.nextInt();
t = sc.nextInt();
type = new Str[t];
for (int j=0;j<t;j++)
type[j] = new Str(sc.nextInt(),sc.nextDouble(),sc.nextInt());
System.out.println(calc());
}
}
long calc() {
long sum;
long maxSum = 0;
long tmp;
for (int j=0;j<t;j++) {
sum = si;
tmp = 0;
for (int i=0;i<y;i++) {
if (type[j].type == 0){
tmp = (long) ( (sum) * type[j].r );
sum = sum + tmp -type[j].cost;
}else {
sum = (long) ( sum - type[j].cost ) ;
tmp += (long) ( (sum) * type[j].r);
}
// System.out.println(sum);
}
if (type[j].type == 1) sum = sum+tmp;
maxSum = (sum<maxSum)? maxSum:sum;
}
System.out.println();
return maxSum;
}
class Str {
int type;
double r;
int cost;
Str(int type, double r, int cost) {
this.type = type;
this.r = r;
this.cost = cost;
}
}
public static void main(String[] args) {
new P1135().run();
}
} | Main.java:2: error: class P1135 is public, should be declared in a file named P1135.java
public class P1135 {
^
1 error
|
s801013360 | p00716 | Java | import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
//dirichlet();
fortune();
}
public static void fortune(){
Scanner sc = new Scanner(System.in);
int numOfData = sc.nextInt();
for(int i = 0; i < numOfData; i++){
int ini = sc.nextInt();
int years = sc.nextInt();
int num = sc.nextInt();
int max = 0;
for(int j = 0; j < num; j++){
int isSev = sc.nextInt();
double per = sc.nextDouble();
int hand = sc.nextInt();
int sum = ini;
if(isSev == 1){
for(int k = 0; k < years; k++){
double plus = sum * per;
int add = (int)plus;
sum += add - hand;
}
}
else{
int save = 0;
for(int k = 0; k < years; k++){
//System.out.print(sum + " ");
double plus = sum * per;
int add = (int)plus;
//System.out.print(add + " ");
save += add;
sum -= hand;
//System.out.print(sum + " ");
//System.out.println(add + " ");
}
sum += save;
//System.out.println(sum);
}
if(max < sum){
max = sum;
}
}
System.out.println(max);
}
} | Main.java:61: error: reached end of file while parsing
}
^
1 error
|
s004312449 | p00716 | Java | import java.util.Scanner;
/**
* Created by Reopard on 2014/05/22.
*/
public class Main {
static Scanner sc = new Scanner(System.in);
int initial, year, janre;
OhgasFortune(int initial, int year, int janre){
this.initial = initial;
this.year = year;
this.janre = janre;
}
public static void main(String args[]){
int m, simpOrComp, commission, tmp, interest, max;
double rate;
OhgasFortune o;
m = sc.nextInt();
for(int i = 0; i < m; i++){
max = 0;
o = new OhgasFortune(sc.nextInt(), sc.nextInt(), sc.nextInt());
for(int j = 0; j < o.janre; j++){
tmp = o.initial;
simpOrComp = sc.nextInt();
rate = sc.nextDouble();
commission = sc.nextInt();
if(simpOrComp == 0){
interest = 0;
for(int k = 0; k < o.year; k++){
interest += tmp * rate;
tmp -= commission;
}
tmp += interest;
}else{
for(int k = 0; k < o.year; k++) tmp += tmp * rate - commission;
}
if(max < tmp) max = tmp;
}
System.out.println(max);
}
}
} | Main.java:10: error: invalid method declaration; return type required
OhgasFortune(int initial, int year, int janre){
^
1 error
|
s993350202 | p00716 | C | #include <stdio.h>
#include <stdlib.h>
float estimate_Tanri(float operatingfund,float rate_of_interest,int period,int fee);
float estimate_Fukuri(float operatingfund,float rate_of_interest,int period,int fee);
int main(void) {
int m;
scanf("%d",&m);
int i;
for(i=0;i<m;i++){
float operatingfund;
scanf("%f",&operatingfund);
int period;
scanf("%d",&period);
int n; //?????¨??????????¨??????°
scanf("%d",&n);
int result = 0;
int j;
for(j=0;j<n;j++){
int TorF;
float rate_of_interest;
int fee;
scanf("%d %f %d",&TorF,&rate_of_interest,&fee);
int tmp;
if(TorF == 0){
tmp = estimate_Tanri(operatingfund,rate_of_interest,period,fee);
}
else{
tmp = estimate_Fukuri(operatingfund,rate_of_interest,period,fee);
}
if(result[i]<=tmp){
result = tmp;
}
}
printf("%d\n",result);
}
return 0;
}
float estimate_Tanri(float operatingfund,float rate_of_interest,int period,int fee){
int i;
float total_interest = 0;
for(i=0;i<period;i++){
total_interest += (float)(int)(operatingfund * rate_of_interest);
operatingfund -= (float)fee;
}
return total_interest + operatingfund;
}
float estimate_Fukuri(float operatingfund,float rate_of_interest,int period,int fee){
int i;
for(i=0;i<period;i++){
operatingfund = operatingfund + (float)(int)(operatingfund * rate_of_interest) - (float)fee;
}
return operatingfund;
} | main.c: In function 'main':
main.c:35:34: error: subscripted value is neither array nor pointer nor vector
35 | if(result[i]<=tmp){
| ^
|
s644128537 | p00716 | C | #include <stdio.h>
int main(void){
int m,fund,year,way;
int select;
double rate;
int commission;
int interest;
int i,j,k;
int res;
scanf("%d",&m);
for(k=0;k<m;k++){
int max[101]={0};
scanf("%d",&fund);
scanf("%d",&year);
scanf("%d",&way);
for(i=0;i<way;i++){
int result[101]={0};
scanf("%d %lf %d",&select,&rate,&commission);
res=fund;
interest=0;
if(select==0){
for(j=0;j<year;j++){
interest+=(int)(res*rate);
res-=commission;
}
result[i]=res+interest;
}
else if(select==1){
for(j=0;j<year;j++){
interest=(int)(res*rate);
res=(res+interest)-commission;
}
result[i]=res;
}
}
for(i=0;i<way;i++){
if(result[i]>max[k]){
max[k]=result[i];
}
}
}
for(i=0;i<m;i++){
printf("%d\n",max[i]);
}
return 0;
} | main.c: In function 'main':
main.c:49:10: error: 'result' undeclared (first use in this function)
49 | if(result[i]>max[k]){
| ^~~~~~
main.c:49:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:57:19: error: 'max' undeclared (first use in this function)
57 | printf("%d\n",max[i]);
| ^~~
|
s515663675 | p00716 | C | #include <math.h>
int main(){
int N,m,y,n,i,R;
for(scanf("%d",&n);n--;printf("%d\n",R)){
for(scanf("%d%d%d",&m,&y,&n),r=m,i=0;i<n;i++){
int t, c, i, dm=0;
double r;
scanf("%d%lf%d",&t,&r,&c);
if(t){ //fukuri
for(i=0;i<y;i++){
dm=(int)floor(r*m);
m=m+dm-c;
}
}else{ //tanri
for(i=0;i<y;i++){
dm+=(int)floor(r*m);
m=m-c;
}
m+=dm;
}
if(m>R)R=m;
}
}
exit(0);} | main.c: In function 'main':
main.c:4:13: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
4 | for(scanf("%d",&n);n--;printf("%d\n",R)){
| ^~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
1 | #include <math.h>
+++ |+#include <stdio.h>
2 | int main(){
main.c:4:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
4 | for(scanf("%d",&n);n--;printf("%d\n",R)){
| ^~~~~
main.c:4:13: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:4:32: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
4 | for(scanf("%d",&n);n--;printf("%d\n",R)){
| ^~~~~~
main.c:4:32: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:32: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:4:32: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:5:46: error: 'r' undeclared (first use in this function)
5 | for(scanf("%d%d%d",&m,&y,&n),r=m,i=0;i<n;i++){
| ^
main.c:5:46: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
24 | exit(0);}
| ^~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
1 | #include <math.h>
+++ |+#include <stdlib.h>
2 | int main(){
main.c:24:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
24 | exit(0);}
| ^~~~
main.c:24:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
|
s884509369 | p00716 | C |
main(N,R,M,m,y,n,t,c,i,d){double r;
for(scanf("%d",&N);N--;printf("%d\n",R)){
for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){
if(m=M,d=0,scanf("%d%lf%d",&t,&r,&c),t){ //fukuri
for(i=0;i<y;i++){
dm=(int)floor(r*m);
m=m+dm-c;
}
}else{ //tanri
for(i=0;i<y;i++){
dm+=(int)floor(r*m);
m=m-c;
}
m+=dm;
}
}
}
exit(0);} | main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(N,R,M,m,y,n,t,c,i,d){double r;
| ^~~~
main.c: In function 'main':
main.c:2:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'R' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'M' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 't' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:2:1: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:3:13: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | for(scanf("%d",&N);N--;printf("%d\n",R)){
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 |
main.c:3:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | for(scanf("%d",&N);N--;printf("%d\n",R)){
| ^~~~~
main.c:3:13: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:3:32: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
3 | for(scanf("%d",&N);N--;printf("%d\n",R)){
| ^~~~~~
main.c:3:32: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:3:32: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:3:32: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:41: error: 'dm' undeclared (first use in this function); did you mean 'd'?
7 | dm=(int)floor(r*m);
| ^~
| d
main.c:7:41: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:49: error: implicit declaration of function 'floor' [-Wimplicit-function-declaration]
7 | dm=(int)floor(r*m);
| ^~~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'floor'
+++ |+#include <math.h>
1 |
main.c:7:49: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
7 | dm=(int)floor(r*m);
| ^~~~~
main.c:7:49: note: include '<math.h>' or provide a declaration of 'floor'
main.c:12:50: warning: incompatible implicit declaration of built-in function 'floor' [-Wbuiltin-declaration-mismatch]
12 | dm+=(int)floor(r*m);
| ^~~~~
main.c:12:50: note: include '<math.h>' or provide a declaration of 'floor'
main.c:19:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
19 | exit(0);}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 |
main.c:19:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
19 | exit(0);}
| ^~~~
main.c:19:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
|
s163865575 | p00716 | C | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c: In function 'main':
main.c:1:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'R' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'M' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 't' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:1:39: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
main.c:1:39: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~
main.c:1:39: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:58: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~~
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:58: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:195: error: expected '}' before 'else'
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:241: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
main.c:1:241: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:241: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:1:1: error: expected declaration or statement at end of input
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R){if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t){for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:1: error: expected declaration or statement at end of input
|
s845223907 | p00716 | C | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c: In function 'main':
main.c:1:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'R' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'M' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'y' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 't' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:1:39: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
main.c:1:39: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~
main.c:1:39: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:58: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~~~
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:58: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:239: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
main.c:1:239: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
main.c:1:239: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:1:1: error: expected declaration or statement at end of input
1 | main(N,R,M,m,y,n,t,c,i,d){float r;for(scanf("%d",&N);N--;printf("%d\n",R)){for(scanf("%d%d%d",&M,&y,&n),R=M;n--;R=m>R?m:R)if(m=M,d=0,scanf("%d%f%d",&t,&r,&c),t)for(i=0;i<y;i++)m+=(int)(r*m)-c;else{for(i=0;i<y;i++)d+=(int)(r*m),m-=c;m+=d;}exit(0);}
| ^~~~
|
s963029375 | p00716 | C | #include <stdio.h>
int main(void)
{
int m,n,money,year,system,cost,interest=0,total=0,last=0;
int interest2[10],intererst_total=0;
double rate;
int i,j,k;
scanf("%d",&m);
for(i=0;i<m;i++){
scanf("%d",&money);
scanf("%d",&year);
scanf("%d",&n);
total=money;
for(j=0;j<n;j++){
scanf("%d %lf %d",&system,&rate,&cost);
if(system==1){
interest=total*rate;
total=total+interest-cost;
}else if(system==0){
for(k=0;k<n;k++){
interest2[k]=total*rate;
total=total-cost;
interest_total=interest_total+interest[k];
}
}
}
printf("%d",total);
}
}
| main.c: In function 'main':
main.c:24:41: error: 'interest_total' undeclared (first use in this function); did you mean 'intererst_total'?
24 | interest_total=interest_total+interest[k];
| ^~~~~~~~~~~~~~
| intererst_total
main.c:24:41: note: each undeclared identifier is reported only once for each function it appears in
main.c:24:79: error: subscripted value is neither array nor pointer nor vector
24 | interest_total=interest_total+interest[k];
| ^
|
s913141686 | p00716 | C++ |
#include <bits/stdc++.h>
using namespace std;
typedef struct set {
int f;
double ir;
long int c, d;
long int out;
}set_t ;
int main() {
cout.setf(ios::fixed);
cout.precision(10);
int m;
long int init;
cin >> m;
long int out[m];
for(int i = 0; i < m; i++) {
cin >> init;
int y, n;
cin >> y;
#include <bits/stdc++.h>
using namespace std;
typedef struct set {
int f;
double ir;
long int c, d;
long int out;
}set_t ;
int main() {
cout.setf(ios::fixed);
cout.precision(10);
int m;
long int init;
cin >> m;
long int out[m];
for(int i = 0; i < m; i++) {
cin >> init;
int y, n;
cin >> y;
cin >> n;
out[m] = 0;
set_t s[n];
for(int j = 0; j < n; j++) {
cin >> s[j].f >> s[j].ir >> s[j].c;
s[j].d = 0;
s[j].out = init;
switch(s[j].f) {
case 1:
for(int k = 0; k < y; k++) {
s[j].out *= (1+s[j].ir);
s[j].out -= s[j].c;
}
break;
case 0:
for(int k = 0; k < y; k++) {
s[j].d += (s[j].out * s[j].ir);
s[j].out -= s[j].c;
}
s[j].out += s[j].d;
break;
}
}
for(int j = 0; j < n; j++) {
if(out[m] < s[j].out) out[m] = s[j].out;
}
cout << out[m] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
35 | int main() {
| ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
35 | int main() {
| ^~
| --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:12: error: a function-definition is not allowed here before '{' token
35 | int main() {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | }
| ^
a.cc:20:30: note: to match this '{'
20 | for(int i = 0; i < m; i++) {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | }
| ^
a.cc:12:12: note: to match this '{'
12 | int main() {
| ^
|
s026355357 | p00716 | C++ |
#include <bits/stdc++.h>
using namespace std;
typedef struct set {
int f;
double ir;
long int c, d;
long int out;
}set_t ;
int main() {
cout.setf(ios::fixed);
cout.precision(10);
int m;
long int init;
cin >> m;
long int out[m];
for(int i = 0; i < m; i++) {
cin >> init;
int y, n;
cin >> y;
#include <bits/stdc++.h>
using namespace std;
typedef struct set {
int f;
double ir;
long int c, d;
long int out;
}set_t ;
int main() {
cout.setf(ios::fixed);
cout.precision(10);
int m;
long int init;
cin >> m;
long int out[m];
for(int i = 0; i < m; i++) {
cin >> init;
int y, n;
cin >> y;
cin >> n;
out[m] = 0;
set_t s[n];
for(int j = 0; j < n; j++) {
cin >> s[j].f >> s[j].ir >> s[j].c;
s[j].d = 0;
s[j].out = init;
switch(s[j].f) {
case 1:
for(int k = 0; k < y; k++) {
s[j].out *= (1+s[j].ir);
s[j].out -= s[j].c;
}
break;
case 0:
for(int k = 0; k < y; k++) {
s[j].d += (s[j].out * s[j].ir);
s[j].out -= s[j].c;
}
s[j].out += s[j].d;
break;
}
}
for(int j = 0; j < n; j++) {
if(out[m] < s[j].out) out[m] = s[j].out;
}
cout << out[m] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
35 | int main() {
| ^~
a.cc:35:9: note: remove parentheses to default-initialize a variable
35 | int main() {
| ^~
| --
a.cc:35:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:35:12: error: a function-definition is not allowed here before '{' token
35 | int main() {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | }
| ^
a.cc:20:30: note: to match this '{'
20 | for(int i = 0; i < m; i++) {
| ^
a.cc:76:2: error: expected '}' at end of input
76 | }
| ^
a.cc:12:12: note: to match this '{'
12 | int main() {
| ^
|
s577512271 | p00716 | C++ |
loop{
line = gets
if line==nil or line =="\n" then
break
end
for i in 1..line.to_i() do
amount = gets.to_i()
year = gets.to_i()
num = gets.to_i()
max = 0
for j in 1..num.to_i() do
line = gets
sp = line.split(nil)
r = sp[1].to_f()
c = sp[2].to_f()
if sp[0] == "1" then
last = amount
r = r +1.0
for k in 1..year do
last = last * r - c
last = last.to_i()
end
else
last = amount
rishi = 0
for k in 1..year do
rishi = rishi + last * r
last = last - c
end
last = last + rishi
last = last.to_i()
end
if last > max then
max = last
end
end
print(max)
end
} | a.cc:8:18: error: too many decimal points in number
8 | for i in 1..line.to_i() do
| ^~~~~~~~~~~~
a.cc:13:26: error: too many decimal points in number
13 | for j in 1..num.to_i() do
| ^~~~~~~~~~~
a.cc:21:42: error: too many decimal points in number
21 | for k in 1..year do
| ^~~~~~~
a.cc:29:42: error: too many decimal points in number
29 | for k in 1..year do
| ^~~~~~~
a.cc:2:1: error: 'loop' does not name a type
2 | loop{
| ^~~~
|
s780671718 | p00717 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Polygonal_Line_Search {
static Scanner s = new Scanner(System.in);
static class Point {
int x=0;
int y=0;
Point(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void main(String[] args) {
while (true) {
int n = s.nextInt();
if(n==0) break;
int m = s.nextInt();
int count = 0;
Point[] p = new Point[m];
for (int j = 0; j < m; j++) {
int x = s.nextInt();
int y = s.nextInt();
p[j] = new Point(x,y);
}
for (int i = 0; i < n; i++) {
int m2 = s.nextInt();
Point[] p2 = new Point[m2];
for (int j = 0; j < m2; j++) {
int x = s.nextInt();
int y = s.nextInt();
p2[j]=new Point(x,y);
}
if (check(p, p2)) System.out.println(i+1);
else {
reverse(p2);
if (check(p, p2)) System.out.println(i+1);
}
}
System.out.println("+++++");
}
}
public static boolean check(Point[] p, Point[] p2){
int difx,dify;
boolean flag;
if(p.length!=p2.length) return false;
for(int i=1;i<p2.length;i++){
p[i].x-=p[0].x;
p[i].y-=p[0].y;
p2[i].x-=p2[0].x;
p2[i].y-=p2[0].y;
}
p[0].x=0;
p[0].y=0;
p2[0].x=0;
p2[0].y=0;
flag=turnCheck(p,p2,0);
return flag;
}
public static boolean turnCheck(Point[] p, Point[] p2,int num){
boolean flag;
if(num ==4) return false;
if(p[1].x==p2[1].x && p[1].y==p2[1].y){
for(int i=2;i<p.length;i++){
if(!(p[i].x==p2[i].x && p[i].y==p2[i].y)){
return false;
}
}
return true;
} else {
for (int i=1;i<p2.length;i++){
int tempx=p2[i].x;
int tempy=p2[i].y;
p2[i].x=-tempy;
p2[i].y=tempx;
}
flag=turnCheck(p,p2,num+1);
}
return flag;
}
public static final void reverse(Point[] arr) {
final int len = arr.length;
Point tmp;
for (int i = 0; i < len / 2; i++) {
tmp = arr[i];
arr[i] = arr[len - 1 - i];
arr[len - 1 - i] = tmp;
}
}
} | Main.java:5: error: class Polygonal_Line_Search is public, should be declared in a file named Polygonal_Line_Search.java
public class Polygonal_Line_Search {
^
1 error
|
s220477272 | p00717 | Java | import java.util.Scanner;
public class QbPolygonalLineSearch {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (run(sc)) {}
}
static boolean run(Scanner sc) {
int n = sc.nextInt();
if (n == 0) {
return false;
}
String k = "";
for (int i = 0; i < n + 1; i++) {
int m = sc.nextInt();
int[] x = new int [m];
int[] y = new int [m];
for (int j = 0; j < m; j++) {
x[j] = sc.nextInt();
y[j] = sc.nextInt();
}
String id = normalize2(x, y);
// System.out.println(i + " : " + id);
if (i == 0) {
k = id;
} else {
if (k.equals(id)) {
System.out.println(i);
}
}
}
System.out.println("+++++");
return true;
}
static String normalize2(int x[], int y[]) {
int l = x.length;
int[] ids1 = normalize(x, y);
int[] ids2 = new int[ids1.length];
for (int i = 0; i < ids1.length; i++) {
ids2[i] = ids1[ids1.length - i - 1];
}
for (int i = 1; i < ids2.length; i += 2) {
ids2[i] = ~ids2[i] + 2;
}
String id1 = "";
String id2 = "";
for (int i = 0; i < ids1.length; i += 2) {
id1 += ids1[i];
id2 += ids2[i];
if (i + 1 < ids1.length) {
id1 += "rl".charAt(ids1[i + 1]);
id2 += "rl".charAt(ids2[i + 1]);
}
}
return id1.compareTo(id2) > 0 ? id1 + id2 : id2 + id1;
}
static int[] normalize(int x[], int y[]) {
int d = dir(x[0], y[0], x[1], y[1]);
int l = Math.abs(x[0] - x[1]) + Math.abs(y[0] - y[1]);
int[] ids = new int[(x.length - 1) * 2 - 1];
ids[0] = l;
for (int i = 1; i + 1 < x.length; i++) {
int[] dx = dirx(x[i], y[i], x[i + 1], y[i + 1], d);
int d2 = dx[0];
d = dx[1];
int l2 = Math.abs(x[i] - x[i + 1]) + Math.abs(y[i] - y[i + 1]);
ids[i * 2 - 1] = d2;
ids[i * 2] = l2;
}
return ids;
}
static int D1 = 0;
static int D2 = 1;
static int D3 = 2;
static int D4 = 3;
static int[] dirx(int x1, int y1, int x2, int y2, int d) {
if (d == D1) {
return x1 < x2 ? new int[]{ 0, D2 } : new int[]{ 1, D4 };
} else if (d == D3) {
return x1 < x2 ? new int[]{ 1, D2 } : new int[]{ 0, D4 };
} else if (d == D2) {
return y1 < y2 ? new int[]{ 1, D1 } : new int[]{ 0, D3 };
} else {
return y1 < y2 ? new int[]{ 0, D1 } : new int[]{ 1, D3 };
}
}
static int dir(int x1, int y1, int x2, int y2) {
if (x1 == x2) {
return y1 < y2 ? D1 : D3;
}
return x1 < x2 ? D2 : D4;
}
} | Main.java:3: error: class QbPolygonalLineSearch is public, should be declared in a file named QbPolygonalLineSearch.java
public class QbPolygonalLineSearch {
^
1 error
|
s082178193 | p00717 | Java | import java.util.Scanner;
public class PolygonalLineSearch {
Scanner in = new Scanner(System.in);
int n, m;
int maxX, maxY, minX, minY;
int[][] x;
int[][] y;
public PolygonalLineSearch() {
while (true) {
n = in.nextInt();
if (n == 0) break;
x = new int[n+1][];
y = new int[n+1][];
for (int i = 0; i <= n; i++) {
m = in.nextInt();
x[i] = new int[m];
y[i] = new int[m];
maxX = Integer.MIN_VALUE;
maxY = Integer.MIN_VALUE;
minX = Integer.MAX_VALUE;
minY = Integer.MAX_VALUE;
for (int j = 0; j < m; j++) {
x[i][j] = in.nextInt() * 2;
y[i][j] = in.nextInt() * 2;
maxX = Math.max(maxX, x[i][j]);
maxY = Math.max(maxY, y[i][j]);
minX = Math.min(minX, x[i][j]);
minY = Math.min(minY, y[i][j]);
}
int gx = (maxX + minX) / 2;
int gy = (maxY + minY) / 2;
for (int j = 0; j < m; j++) {
x[i][j] -= gx;
y[i][j] -= gy;
}
}
for (int i = 1; i <= n; i++) {
if (x[0].length != x[i].length) continue;
else if (equalPolygon(i))
System.out.println(i);
}
System.out.println("+++++");
}
}
boolean equalPolygon(int tgt) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < m; j++) {
if ((x[0][j] == x[tgt][j] && y[0][j] == y[tgt][j]) ||
(x[0][j] == x[tgt][m-j-1]) && (y[0][j] == y[tgt][m-j-1])) {
if (j == m - 1) return true;
continue;
}
else break;
}
for (int j = 0; j < m; j++) {
int temp = x[tgt][j];
x[tgt][j] = y[tgt][j];
y[tgt][j] = -temp;
}
}
return false;
}
public static void main(String[] args) {
new PolygonalLineSearch();
}
} | Main.java:3: error: class PolygonalLineSearch is public, should be declared in a file named PolygonalLineSearch.java
public class PolygonalLineSearch {
^
1 error
|
s690829836 | p00717 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
static int points0[][];
public static void main(String args[]){
// 標準入力準備
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//Scanner sc = new Scanner(System.in);
//String str = new String();
try{
while(true){
// 折れ線の数
int n = Integer.parseInt(br.readLine());
if(n == 0) return;
// 最初のひとつ
points0 = input(br);
//printPoints(points0);
//比較
for(int i = 1; i <= n; i++){
int pointsi[][] = input(br);
//printPoints(points0);
if(compare(points0, pointsi)) System.out.println(i);
}
System.out.println("+++++");
}
}catch(Exception e){
System.err.println(e);
}
}
static boolean compare(int points1[][], int points2[][]){
return compareAsce(points1, points2); || compareDsce(points1, points2);
}
static boolean compareAsce(int points1[][], int points2[][]){
return compare0(points1, points2); || compare90(points1, points2) || compare180(points1, points2);
}
static boolean compareDsce(int points1[][], int points2[][]){
// 逆向きにする
int points2_reverse[][] = new int[points2.length][2];
int originx = points2[points2.length - 1][0];
int originy = points2[points2.length - 1][1];
points2_reverse[0][0] = 0;
points2_reverse[0][1] = 0;
for(int i = 1; i < points2.length; i++){
points2_reverse[i][0] = points2[points2.length - 1 - i][0] - originx;
points2_reverse[i][1] = points2[points2.length - 1 - i][1] - originy;
}
return compareAsce(points1, points2_reverse);
}
static boolean compare0(int points1[][], int points2[][]){
return true;
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != points2[i][0] || points1[i][1] != points2[i][1]) return false;
}
return true;
}
static boolean compare90(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != points2[i][1] || points1[i][1] != 0 - points2[i][0]) return false;
}
return true;
}
static boolean compare180(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != 0 - points2[i][0] || points1[i][1] != 0 - points2[i][1]) return false;
}
return true;
}
static boolean compare270(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != 0 - points2[i][1] || points1[i][1] != points2[i][0]) return false;
}
return true;
}
static int[][] input(BufferedReader br) throws Exception{
int m = Integer.parseInt(br.readLine());
int points[][] = new int[m][2];
// 原点を0に
String strs[] = br.readLine().split(" ");
int originx = Integer.parseInt(strs[0]);
int originy = Integer.parseInt(strs[1]);
//System.out.println("原点: (" + originx + ", " + originy + ")");
points[0][0] = 0;
points[0][1] = 0;
for(int i = 1; i < m; i++){
strs = br.readLine().split(" ");
points[i][0] = Integer.parseInt(strs[0]) - originx;
points[i][1] = Integer.parseInt(strs[1]) - originy;
}
return points;
}
static void printPoints(int points[][]){
for(int i = 0; i < points.length; i++){
System.out.print("(" + points[i][0] + ", " + points[i][1] + ")\t");
}
System.out.println();
}
} | Main.java:38: error: illegal start of expression
return compareAsce(points1, points2); || compareDsce(points1, points2);
^
Main.java:42: error: illegal start of expression
return compare0(points1, points2); || compare90(points1, points2) || compare180(points1, points2);
^
Main.java:42: error: not a statement
return compare0(points1, points2); || compare90(points1, points2) || compare180(points1, points2);
^
3 errors
|
s238742017 | p00717 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
static int points0[][];
public static void main(String args[]){
// 標準入力準備
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//Scanner sc = new Scanner(System.in);
//String str = new String();
try{
while(true){
// 折れ線の数
int n = Integer.parseInt(br.readLine());
if(n == 0) return;
// 最初のひとつ
points0 = input(br);
//printPoints(points0);
//比較
for(int i = 1; i <= n; i++){
int pointsi[][] = input(br);
//printPoints(points0);
if(compare(points0, pointsi)) System.out.println(i);
}
System.out.println("+++++");
}
}catch(Exception e){
System.err.println(e);
}
}
static boolean compare(int points1[][], int points2[][]){
return compareAsce(points1, points2) || compareDsce(points1, points2);
}
static boolean compareAsce(int points1[][], int points2[][]){
return compare0(points1, points2) || compare90(points1, points2) || compare180(points1, points2);
}
static boolean compareDsce(int points1[][], int points2[][]){
// 逆向きにする
int points2_reverse[][] = new int[points2.length][2];
int originx = points2[points2.length - 1][0];
int originy = points2[points2.length - 1][1];
points2_reverse[0][0] = 0;
points2_reverse[0][1] = 0;
for(int i = 1; i < points2.length; i++){
points2_reverse[i][0] = points2[points2.length - 1 - i][0] - originx;
points2_reverse[i][1] = points2[points2.length - 1 - i][1] - originy;
}
return compareAsce(points1, points2_reverse);
}
static boolean compare0(int points1[][], int points2[][]){
return true;
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != points2[i][0] || points1[i][1] != points2[i][1]) return false;
}
return true;
}
static boolean compare90(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != points2[i][1] || points1[i][1] != 0 - points2[i][0]) return false;
}
return true;
}
static boolean compare180(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != 0 - points2[i][0] || points1[i][1] != 0 - points2[i][1]) return false;
}
return true;
}
static boolean compare270(int points1[][], int points2[][]){
for(int i = 0; i < points1.length; i++){
if(points1[i][0] != 0 - points2[i][1] || points1[i][1] != points2[i][0]) return false;
}
return true;
}
static int[][] input(BufferedReader br) throws Exception{
int m = Integer.parseInt(br.readLine());
int points[][] = new int[m][2];
// 原点を0に
String strs[] = br.readLine().split(" ");
int originx = Integer.parseInt(strs[0]);
int originy = Integer.parseInt(strs[1]);
//System.out.println("原点: (" + originx + ", " + originy + ")");
points[0][0] = 0;
points[0][1] = 0;
for(int i = 1; i < m; i++){
strs = br.readLine().split(" ");
points[i][0] = Integer.parseInt(strs[0]) - originx;
points[i][1] = Integer.parseInt(strs[1]) - originy;
}
return points;
}
static void printPoints(int points[][]){
for(int i = 0; i < points.length; i++){
System.out.print("(" + points[i][0] + ", " + points[i][1] + ")\t");
}
System.out.println();
}
} | Main.java:61: error: unreachable statement
for(int i = 0; i < points1.length; i++){
^
1 error
|
s161826556 | p00717 | Java | import java.io.*;
import java.util.*;
public class p1136 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String line;
while(true){
/* input */
line = br.readLine();
int c = Integer.parseInt(line);
if(c==0) return;
Line[] d = new Line[c+1];
//line 0
int ln = Integer.parseInt(br.readLine());
ArrayList<Coordinate> cd = new ArrayList<Coordinate>();
for(int l=0;l<ln;l++){
cd.add(new Coordinate(br.readLine()));
}
d[0] = new Line(cd);
//line 1--c
for(int k=1;k<=c;k++){
ln = Integer.parseInt(br.readLine());
cd = new ArrayList<Coordinate>();
for(int l=0;l<ln;l++){
cd.add(new Coordinate(br.readLine()));
}
d[k] = new Line(cd);
}
/* processing */
//set the initial points to (0,0)
for(int a=0;a<=c;a++){
d[a] = d[a].setOrigin();
}
//find identical lines
ArrayList<Integer> ans = new ArrayList<Integer>();
for(int a=1;a<=c;a++){
if(compareLines(d[0],d[a])){
ans.add(a);
}
}
for(int i : ans){
System.out.println(i);
}
System.out.println("+++++");
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean compareLines(Line a, Line b){
if(compareLines_rec(a,b)){
return true;
} else {
return compareLines_rec(a,b.reverse());
}
}
public static boolean compareLines_rec(Line a, Line b){
if(a.points.size()!=b.points.size()) return false;
//compare the lengths
for(int i=0;i<a.points.size();i++){
for(int j=0;j<a.points.size()-1;j++){
if(a.lengths()[j]!=b.lengths()[j]){
return false;
}
}
}
a = a.setOrigin();
b = b.setOrigin();
int rotate = 0;
//check if it's rotated based on the first point
if(a.points.get(1).x!=0){
if(b.points.get(1).x==a.points.get(1).x){
rotate = 0;
} else if(b.points.get(1).y==-a.points.get(1).x){
rotate = 1;
} else if(b.points.get(1).x==-a.points.get(1).x){
rotate = 2;
} else if(b.points.get(1).y==a.points.get(1).x){
rotate = 3;
}
} else {
if(b.points.get(1).y==a.points.get(1).y){
rotate = 0;
} else if(b.points.get(1).x==-a.points.get(1).y){
rotate = 1;
} else if(b.points.get(1).y==-a.points.get(1).y){
rotate = 2;
} else if(b.points.get(1).x==a.points.get(1).y){
rotate = 3;
}
}
b = b.rotate(rotate);
//b.print();
for(int i=0;i<a.points.size();i++){
if(a.points.get(i).x!=b.points.get(i).x) return false;
if(a.points.get(i).y!=b.points.get(i).y) return false;
}
return true;
}
static class Coordinate{
public int x;
public int y;
public Coordinate(String str){
this.x = Integer.parseInt(str.split(" ")[0]);
this.y = Integer.parseInt(str.split(" ")[1]);
}
public Coordinate(int x, int y){
this.x = x;
this.y = y;
}
public void output(){
System.out.println(this.x + "," + this.y);
}
public void modify(int x, int y){
this.x = x;
this.y = y;
}
}
static class Line{
public ArrayList<Coordinate> points;
public Line(){
this.points = null;
}
public Line(ArrayList<Coordinate> c){
this.points = c;
}
public void print(){
for(Coordinate c : this.points){
System.out.println(c.x + "," + c.y);
}
}
public Line reverse(){
Collections.reverse(this.points);
return this;
}
public Line setOrigin(){
//set the initial points to (0,0)
int x0 = this.points.get(0).x;
int y0 = this.points.get(0).y;
if(x0==0&&y0==0){
return this;
}
for(int b=0;b<this.points.size();b++){
this.points.get(b).modify(this.points.get(b).x-x0,this.points.get(b).y-y0);
}
return this;
}
public int[] lengths(){
int[] lengths = new int[this.points.size()-1];
for(int i=0;i<this.points.size()-1;i++){
lengths[i] = Math.abs(this.points.get(i).x-this.points.get(i+1).x)+Math.abs(this.points.get(i).y-this.points.get(i+1).y);
}
return lengths;
}
public Line rotate(int r){
switch(r){
case 1:
for(int i=1;i<this.points.size();i++){
int x = this.points.get(i).x;
int y = this.points.get(i).y;
this.points.get(i).modify(-y,x);
}
break;
case 2:
for(int i=1;i<this.points.size();i++){
int x = this.points.get(i).x;
int y = this.points.get(i).y;
this.points.get(i).modify(-x,-y);
}
break;
case 3:
for(int i=1;i<this.points.size();i++){
int x = this.points.get(i).x;
int y = this.points.get(i).y;
this.points.get(i).modify(y,-x);
}
break;
default:
break;
}
return this;
}
}
} | Main.java:4: error: class p1136 is public, should be declared in a file named p1136.java
public class p1136 {
^
1 error
|
s721596658 | p00717 | C | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
// デバッグ出力
void debug(vector<P> v, int i){
cout << "Line " << i << endl;
for(int i=0 ; i < v.size() ; i++ ){
cout << "(" << v[i].first << "," << v[i].second << ")" << endl;
}
cout << endl;
}
int main(){
int n;
while( cin >> n , n ){
// 折れ線の集まり
vector< vector<P> > list(n+1);
// 答えの番号
vector<int> ans;
// n+1 の折れ線
for(int i=0 ; i <= n ; i++ ){
int m, sx, sy;
vector<P> v;
cin >> m;
// 1つの折れ線は m 個の頂点を持つ
for(int j = 0 ; j < m ; j++ ){
int x,y;
cin >> x >> y;
if( j == 0 ){
sx = x;
sy = y;
v.push_back( P(0,0) );
}else{
v.push_back( P(x-sx,y-sy) );
}
}
//debug( v , i );
list[i] = v;
}
// list[0]と同じものを探す
for(int i=1 ; i <= n ; i++ ){
// 頂点の数が同じかどうか
if( list[0].size() == list[i].size() ){
// 回転した4パターンを調べる
for(int k=0 ; k < 4 ; k++ ){
bool flag = true;
// 90度回転
for(int j=0 ; j < list[0].size() ; j++ ){
int x = list[i][j].first;
int y = list[i][j].second;
list[i][j].first = y ;
list[i][j].second = -x;
}
//cout << "90 turn!" << endl;
//debug( list[i] , i );
// 各点が同じかどうか調べる
for(int j=0 ; j < list[0].size() ; j++ ){
int x1 = list[0][j].first;
int y1 = list[0][j].second;
int x2 = list[i][j].first;
int y2 = list[i][j].second;
if( x1 != x2 || y1 != y2 ){
flag = false;
break;
}
}
if( flag ){
ans.push_back( i );
break;
}
// 逆から各点が同じかどうか調べる
flag = true;
vector<P> r_line = list[i];
reverse( r_line.begin() , r_line.end() );
int sx, sy;
for(int j=0 ; j < r_line.size() ; j++ ){
if( j == 0 ){
sx = r_line[j].first;
sy = r_line[j].second;
}
r_line[j].first -= sx;
r_line[j].second -= sy;
}
//cout << "90 turn. reverse!" << endl;
//debug( r_line , i );
for(int j=0 ; j < list[0].size() ; j++ ){
int x1 = list[0][j].first;
int y1 = list[0][j].second;
int x2 = r_line[j].first;
int y2 = r_line[j].second;
if( x1 != x2 || y1 != y2 ){
flag = false;
break;
}
}
if( flag ){
ans.push_back( i );
break;
}
}
}
}
// 解の出力
for(int i=0 ; i < ans.size() ; i++ ){
cout << ans[i] << endl;
}
cout << "+++++" << endl;
}
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s106015667 | p00717 | C++ | #include<iostream>
#include<vector>
using namespace std;
typedef pair<int,int> P;
int n;
vector<P> t;
P change(P p){
return P(-p.second,p.first);
}
vector<P> ro(vector<P> vec){
while(1){
if(vec[0].first==0&&vec[0].second>0)break;
for(int i=0;i<(int)vec.size();i++){
vec[i]=change(vec[i]);
}
}
return vec;
}
vector<P> input(){
vector<P> res;
int m,x[100],y[100];
cin>>m;
for(int i=0;i<m;i++){
cin>>x[i]>>y[i];
if(i==0)continue;
res.push_back(P(x[i]-x[i-1],y[i]-y[i-1]));
}
return ro(res);
}
int main(){
while(1){
cin>>n;
if(n==0)break;
t.clear();
t=input();
for(int i=0;i<n;i++){
vector<P> u=input();
vector<P> v=u;
reverse(v.begin(),v.end());
for(int i=0;i<(int)v.size();i++){
v[i].first*=-1; v[i].second*=-1;
}
v=ro(v);
if(t==u||t==v){
cout<<i+1<<endl;
}
}
cout<<"+++++"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:42:7: error: 'reverse' was not declared in this scope
42 | reverse(v.begin(),v.end());
| ^~~~~~~
|
s169389315 | p00717 | C++ | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;
#define EPS (1e-10) //?\??°???????
#define equals(a, b) ( fabs((a) - (b)) < EPS )
class Point{
public:
double x, y;
Point(double x = 0, double y = 0): x(x), y(y) {}
Point operator + (Point p) { return Point(x + p.x, y + p.y); }
Point operator - (Point p) { return Point(x - p.x, y - p.y); }
Point operator * (double a) { return Point(a * x, a * y); }
Point operator / (double a) { return Point(x / a, y / a); }
double abs() { return sqrt(norm());}
double norm() { return x * x + y * y; }
bool operator < (const Point &p) const {
return x != p.x ? x < p.x : y < p.y;
}
bool operator == (const Point &p) const {
return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
}
};
typedef Point Vector;
///////////////
double dot(Vector a, Vector b){ //????????????a??¨b?????????
return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){ //????????????a??¨b?????????
return a.x*b.y - a.y*b.x;
}
//????????????A???B???????????¢???
static const int COUNTER_CLOCKWISE = 1; //???????¨???????
static const int CLOCKWISE = -1; //????¨???????
static const int ONLINE_BACK = 2; //2,0,1?????????????????????
static const int ONLINE_FRONT = -2; //0,1,2?????????????????????
static const int ON_SEGMENT = 0; //??????0,1????????????
int ccw(Point p0, Point p1, Point p2){
Vector a = p1 - p0;
Vector b = p2 - p0;
if( cross(a, b) > EPS ) return COUNTER_CLOCKWISE;
if( cross(a, b) < -EPS ) return CLOCKWISE;
if( dot(a, b) < -EPS ) return ONLINE_BACK;
if( a.norm() < b.norm() ) return ONLINE_FRONT;
return ON_SEGMENT;
}
bool check(int l[55][10][2], int i, int m){
rep(j,m - 2){
if(l[0][j][0] != l[i][j][0]) return 1;
}
rep(j,m - 1){
if(l[0][j][1] != l[i][j][1]) return 1;
}
cout << i << endl;
return 0;
}
bool revCheck(int l[55][10][2], int i, int m){
rep(j,m - 2){
if(l[0][j][0] != -1 * l[i][m - j - 3][0]) return 1;
}
rep(j,m - 1){
if(l[0][j][1] != l[i][m - j - 2][1]) return 1;
}
cout << i << endl;
return 0;
}
void print(int n, int m, int line[55][10][2]){
rep(i,n){
rep(j,m - 2){
cout << line[i][j][0] <<' ';
}
rep(j,m - 1){
cout << line[i][j][1] << ' ';
}
cout << endl;
}
}
int main(){
int n;
while(cin >> n, n){
int line[55][15][2], m; //line[i][0] = ccw, line[i][1] = abs;
n++;
rep(i,n){
Point p[50];
cin >> m;
rep(j,m) cin >> p[j].x >> p[j].y;
range(j,2,m){
line[i][j - 2][0] = ccw(p[j - 2], p[j - 1], p[j]);
}
range(j,1,m){
Vector a = p[j - 1] - p[j];
line[i][j - 1][1] = a.abs();
}
}
range(j,1,n){
if(check(line, j, m)){
revCheck(line, j, m);
}
}
cout << "+++++" << endl;
}
} | a.cc: In function 'int main()':
a.cc:117:22: error: cannot convert 'int (*)[15][2]' to 'int (*)[10][2]'
117 | if(check(line, j, m)){
| ^~~~
| |
| int (*)[15][2]
a.cc:64:16: note: initializing argument 1 of 'bool check(int (*)[10][2], int, int)'
64 | bool check(int l[55][10][2], int i, int m){
| ~~~~^~~~~~~~~~~~
a.cc:118:26: error: cannot convert 'int (*)[15][2]' to 'int (*)[10][2]'
118 | revCheck(line, j, m);
| ^~~~
| |
| int (*)[15][2]
a.cc:75:19: note: initializing argument 1 of 'bool revCheck(int (*)[10][2], int, int)'
75 | bool revCheck(int l[55][10][2], int i, int m){
| ~~~~^~~~~~~~~~~~
|
s717945307 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
auto rotate = [](L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
auto move = [](L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
auto input = [] {
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
auto equal = [&](L& l1, L& l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | a.cc: In function 'int main()':
a.cc:74:34: error: no match for call to '(main()::<lambda(L&, L&)>) (L&, std::vector<std::complex<double> >)'
74 | if (equal(line, input())) {
| ~~~~~^~~~~~~~~~~~~~~
a.cc:63:30: note: candidate: 'main()::<lambda(L&, L&)>' (near match)
63 | auto equal = [&](L& l1, L& l2) {
| ^
a.cc:63:30: note: conversion of argument 2 would be ill-formed:
a.cc:74:46: error: cannot bind non-const lvalue reference of type 'L&' {aka 'std::vector<std::complex<double> >&'} to an rvalue of type 'std::vector<std::complex<double> >'
74 | if (equal(line, input())) {
| ~~~~~^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:47:24: required from here
47 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
|
s779668439 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
auto rotate = [](L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
auto move = [](L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
auto input = [] {
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
auto equal = [&](L& l1, L& l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | a.cc: In function 'int main()':
a.cc:74:34: error: no match for call to '(main()::<lambda(L&, L&)>) (L&, std::vector<std::complex<double> >)'
74 | if (equal(line, input())) {
| ~~~~~^~~~~~~~~~~~~~~
a.cc:63:30: note: candidate: 'main()::<lambda(L&, L&)>' (near match)
63 | auto equal = [&](L& l1, L& l2) {
| ^
a.cc:63:30: note: conversion of argument 2 would be ill-formed:
a.cc:74:46: error: cannot bind non-const lvalue reference of type 'L&' {aka 'std::vector<std::complex<double> >&'} to an rvalue of type 'std::vector<std::complex<double> >'
74 | if (equal(line, input())) {
| ~~~~~^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:47:24: required from here
47 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
|
s038256038 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L& l1, L& l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | a.cc: In function 'int main()':
a.cc:74:34: error: no matching function for call to 'equal(L&, L)'
74 | if (equal(line, input())) {
| ~~~~~^~~~~~~~~~~~~~~
a.cc:57:6: note: candidate: 'bool equal(L&, L&)' (near match)
57 | bool equal(L& l1, L& l2) {
| ^~~~~
a.cc:57:6: note: conversion of argument 2 would be ill-formed:
a.cc:74:46: error: cannot bind non-const lvalue reference of type 'L&' {aka 'std::vector<std::complex<double> >&'} to an rvalue of type 'L' {aka 'std::vector<std::complex<double> >'}
74 | if (equal(line, input())) {
| ~~~~~^~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1582:5: note: candidate: 'template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2)'
1582 | equal(_II1 __first1, _II1 __last1, _II2 __first2)
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1582:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1613:5: note: candidate: 'template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate)'
1613 | equal(_IIter1 __first1, _IIter1 __last1,
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1613:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1704:5: note: candidate: 'template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2, _II2)'
1704 | equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1704:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1737:5: note: candidate: 'template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _IIter2, _BinaryPredicate)'
1737 | equal(_IIter1 __first1, _IIter1 __last1,
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1737:5: note: candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:333:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate)'
333 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:333:1: note: candidate expects 5 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:338:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
338 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:338:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:342:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
342 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:342:1: note: candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:347:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
347 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:347:1: note: candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/bits/stl_algobase.h:71:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:41:22: required from here
41 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| |
s684314225 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L& l1, L& l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, move(input()))) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | a.cc: In function 'int main()':
a.cc:74:34: error: no matching function for call to 'equal(L&, L)'
74 | if (equal(line, move(input()))) {
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:57:6: note: candidate: 'bool equal(L&, L&)' (near match)
57 | bool equal(L& l1, L& l2) {
| ^~~~~
a.cc:57:6: note: conversion of argument 2 would be ill-formed:
a.cc:74:45: error: cannot bind non-const lvalue reference of type 'L&' {aka 'std::vector<std::complex<double> >&'} to an rvalue of type 'L' {aka 'std::vector<std::complex<double> >'}
74 | if (equal(line, move(input()))) {
| ~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1582:5: note: candidate: 'template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2)'
1582 | equal(_II1 __first1, _II1 __last1, _II2 __first2)
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1582:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1613:5: note: candidate: 'template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate)'
1613 | equal(_IIter1 __first1, _IIter1 __last1,
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1613:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1704:5: note: candidate: 'template<class _II1, class _II2> bool std::equal(_II1, _II1, _II2, _II2)'
1704 | equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1704:5: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/stl_algobase.h:1737:5: note: candidate: 'template<class _IIter1, class _IIter2, class _BinaryPredicate> bool std::equal(_IIter1, _IIter1, _IIter2, _IIter2, _BinaryPredicate)'
1737 | equal(_IIter1 __first1, _IIter1 __last1,
| ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:1737:5: note: candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:333:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate)'
333 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:333:1: note: candidate expects 5 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:338:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
338 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:338:1: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:342:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
342 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:342:1: note: candidate expects 6 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:347:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool> std::equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
347 | equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:347:1: note: candidate expects 5 arguments, 2 provided
In file included from /usr/include/c++/14/bits/stl_algobase.h:71:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:41:22: required from here
41 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 |
s367005069 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:41:22: required from here
41 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s149805990 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:41:22: required from here
41 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s490569215 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
//#define CHOOSE(a) CHOOSE2 a
//#define CHOOSE2(a0,a1,a2,a3,x,...) x
//#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
//#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
//#define REP3(i, n) REP2(i, 0, n)
//#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:43:22: required from here
43 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s808546559 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
//#define CHOOSE(a) CHOOSE2 a
//#define CHOOSE2(a0,a1,a2,a3,x,...) x
//#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
//#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
//#define REP3(i, n) REP2(i, 0, n)
//#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
bool operator == (const P& a, const P& b) {
return real(a) == real(b) && imag(a) == imag(b);
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:46:22: required from here
46 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s610632564 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
//#define CHOOSE(a) CHOOSE2 a
//#define CHOOSE2(a0,a1,a2,a3,x,...) x
//#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
//#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
//#define REP3(i, n) REP2(i, 0, n)
//#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
using VV = vector<vector<int>>;
using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
using P = complex<double>;
using L = vector<P>;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
bool operator == (const L& a, const L& b) {
if (a.size() != b.size()) return false;
rep(i, a.size()) if (a[i] != b[i]) return false;
return true;
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:48:22: required from here
48 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s676430396 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
//using VV = vector<vector<int>>;
//using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
typedef complex<double> P;
typedef vector<P> L;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
bool operator == (const L& a, const L& b) {
if (a.size() != b.size()) return false;
rep(i, a.size()) if (a[i] != b[i]) return false;
return true;
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | a.cc:13:9: warning: "rep" redefined
13 | #define rep(i, n) for(int i = 0; i < n; i++)
| ^~~
a.cc:11:9: note: this is the location of the previous definition
11 | #define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:48:22: required from here
48 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const st |
s996835051 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
//#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
//using VV = vector<vector<int>>;
//using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
typedef complex<double> P;
typedef vector<P> L;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
bool operator == (const L& a, const L& b) {
if (a.size() != b.size()) return false;
rep(i, a.size()) if (a[i] != b[i]) return false;
return true;
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:48:22: required from here
48 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s974915155 | p00717 | C++ | #include "bits/stdc++.h"
using namespace std;
//#define int int64_t
//#define CHOOSE(a) CHOOSE2 a
//#define CHOOSE2(a0,a1,a2,a3,x,...) x
//#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
//#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
//#define REP3(i, n) REP2(i, 0, n)
//#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))
#define breakif(cond) if(cond) break; else
template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }
//using VV = vector<vector<int>>;
//using V = vector<int>;
//using P = pair<int, int>;
//using IP = pair<int, P>;
typedef complex<double> P;
typedef vector<P> L;
bool operator < (const P& a, const P& b) {
return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
}
bool operator == (const L& a, const L& b) {
if (a.size() != b.size()) return false;
rep(i, a.size()) if (a[i] != b[i]) return false;
return true;
}
P rs[] = { P(1, 0), P(0, 1), P(-1, 0), P(0, -1) };
L rotate(L line, int idx) {
L ret = line;
for (auto& x : ret) {
x *= rs[idx];
}
return ret;
};
L move(L line) {
P sub = *min_element(all(line));
L ret = line;
for (auto& x : ret) {
x -= sub;
}
return ret;
};
L input(){
int m; cin >> m;
L l(m);
rep(i, m) {
int x, y; cin >> x >> y;
l[i] = P(y, x);
}
return l;
};
bool equal(L l1, L l2) {
L l22 = l2;
reverse(all(l22));
rep(i, 4) {
if (move(l1) == move(rotate(l2, i)) || move(l1) == move(rotate(l22, i))) return true;
}
return false;
};
signed main() {
int n;
while (cin >> n && n) {
vector<L> lines(n - 1);
L line;
line = input();
stringstream ss;
rep(i, n) {
if (equal(line, input())) {
ss << i + 1 << endl;
}
}
ss << "+++++" << endl;
cout << ss.str();
}
} | In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >; _Iterator2 = __gnu_cxx::__normal_iterator<std::complex<double>*, std::vector<std::complex<double> > >]':
/usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
5562 | if (__comp(__first, __result))
| ~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<complex<double>*, vector<complex<double> > >]'
5586 | return _GLIBCXX_STD_A::__min_element(__first, __last,
| ^
a.cc:48:22: required from here
48 | P sub = *min_element(all(line));
| ~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:23: error: no match for 'operator<' (operand types are 'std::complex<double>' and 'std::complex<double>')
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::pair<_T1, _T2>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::reverse_iterator<_Iterator>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/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/predefined_ops.h:45:23: note: 'std::complex<double>' is not derived from 'const std::move_iterator<_IteratorL>'
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, co |
s549504607 | p00717 | C++ | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
void solve( vector<pair<int, int>> &origin,
vector<vector<pair<int, int>>> &target,
vector<vector<int>> &results );
bool equal( vector<pair<int, int>> &origin, vector<pair<int, int>> &tmp );
int get_angle( pair<int, int> lhs, pair<int, int> rhs );
int get_turn( int n_angle, int o_angle );
int get_dist( pair<int, int> lhs, pair<int, int> rhs );
int main(int argc, char const *argv[]) {
int n, m, rhs, lhs, size, count;
vector<pair<int, int>> origin;
vector<pair<int, int>> tmp;
vector<vector<pair<int, int>>> target;
vector<vector<int>> results;
while(1){
cin>>n;
if( n == 0 ) break;
for (int i = 0; i <= n; i++) {
cin>>m;
for (int j = 0; j < m; j++) {
if( i == 0 ){
cin>>rhs>>lhs;
origin.push_back( pair<int, int> (rhs, lhs) );
}
else{
cin>>rhs>>lhs;
tmp.push_back( pair<int, int> (rhs, lhs) );
}
}
if( i != 0 ) target.push_back( tmp );
tmp.clear();
}
solve( origin, target, results );
}
for (int i = 0; i < results.size(); i++) {
for (int j = 0; j < results[i].size(); j++) {
cout<<results[i][j]<<endl;
}
cout<<"+++++"<<endl;
}
return 0;
}
void solve( vector<pair<int, int>> &origin,
vector<vector<pair<int, int>>> &target,
vector<vector<int>> &results ){
vector<pair<int, int>> tmp;
vector<int> count;
for (int i = 0; i < target.size(); i++) {
tmp = target[i];
if( equal( origin, tmp ) ) count.push_back( i+1 );
}
results.push_back( count );
}
bool equal( vector<pair<int, int>> &origin, vector<pair<int, int>> &tmp ){
int i, j, k, l, dist, x_diff, y_diff;
vector<int> ori_dist, tmp_dist, rev_dist;
vector<int> ori_angle, tmp_angle, rev_angle;
vector<int> ori_turn, tmp_turn, rev_turn;
for(int i = 1; i < origin.size(); i++){
ori_dist.push_back( get_dist( origin[i], origin[i-1] ) );
ori_angle.push_back( get_angle( origin[i], origin[i-1] ) );
tmp_dist.push_back( get_dist( tmp[i], tmp[i-1] ) );
tmp_angle.push_back( get_angle( tmp[i], tmp[i-1] ) );
}
reverse( tmp.begin(), tmp.end() );
for(int i = 1; i < tmp.size(); i++){
rev_dist.push_back( get_dist( tmp[i], tmp[i-1] ) );
rev_angle.push_back( get_angle( tmp[i], tmp[i-1] ) );
}
for(int i = 1; i < ori_angle.size(); i++){
ori_turn.push_back( get_turn( ori_angle[i], ori_angle[i-1] ) );
tmp_turn.push_back( get_turn( tmp_angle[i], tmp_angle[i-1] ) );
rev_turn.push_back( get_turn( rev_angle[i], rev_angle[i-1] ) );
}
for(i = 0; i < ori_dist.size(); i++){
if( ori_dist[i] != tmp_dist[i] ) break;
}
for(j = 0; j < ori_turn.size(); j++){
if( ori_turn[j] != tmp_turn[j] ) break;
}
for(k = 0; k < ori_dist.size(); k++){
if( ori_dist[k] != rev_dist[k] ) break;
}
for(l = 0; l < ori_turn.size(); l++){
if( ori_turn[l] != rev_turn[l] ) break;
}
if( ( i == ori_dist.size() && j == ori_turn.size() )
|| ( k == ori_dist.size() && l == ori_turn.size() ) ) return true;
return false;
}
int get_angle( pair<int, int> lhs, pair<int, int> rhs ){
int x_diff = lhs.first - rhs.first;
int y_diff = lhs.second - rhs.second;
if( x_diff > 0 ) return 1;
if( x_diff < 0 ) return 3;
if( y_diff > 0 ) return 2;
if( y_diff < 0 ) return 4;
}
// right 1, left -1
int get_turn( int n_angle, int o_angle ){
switch( o_angle ){
case(1):
if( n_angle == 4 ) return 1;
if( n_angle == 2 ) return -1;
case(2):
if( n_angle == 1 ) return 1;
if( n_angle == 3 ) return -1;
case(3):
if( n_angle == 2 ) return 1;
if( n_angle == 4 ) return -1;
case(4):
if( n_angle == 3 ) return 1;
if( n_angle == 1 ) return -1;
}
}
int get_dist( pair<int, int> lhs, pair<int, int> rhs ){
return abs( lhs.first - rhs.first ) + abs( lhs.second - rhs.second );
} | a.cc: In function 'bool equal(std::vector<std::pair<int, int> >&, std::vector<std::pair<int, int> >&)':
a.cc:81:5: error: 'reverse' was not declared in this scope
81 | reverse( tmp.begin(), tmp.end() );
| ^~~~~~~
a.cc: In function 'int get_angle(std::pair<int, int>, std::pair<int, int>)':
a.cc:123:1: warning: control reaches end of non-void function [-Wreturn-type]
123 | }
| ^
a.cc: In function 'int get_turn(int, int)':
a.cc:141:1: warning: control reaches end of non-void function [-Wreturn-type]
141 | }
| ^
|
s836996831 | p00717 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int m0;
cin >> m0;
vector<int> x0(m0);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
x0[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
for (int i = 0; i < n; i++) {
int m;
cin >> m;
vector<int> line(m);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
line[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
if (m0 == m) {
if (x0 == line) {
cout << i + 1 << endl;
}else if (reverse(line.begin, line.end),x0 == line) {
cout << i + 1 << endl;
}
}
}
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:50: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
39 | }else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:39:50: note: couldn't deduce template parameter '_BIter'
39 | }else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s088010243 | p00717 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int m0;
cin >> m0;
vector<int> x0(m0);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
x0[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
for (int i = 0; i < n; i++) {
int m;
cin >> m;
vector<int> line(m);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
line[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
if (m0 == m) {
if (x0 == line) {
cout << i + 1 << endl;
}else if (reverse(line.begin, line.end),x0 == line) {
cout << i + 1 << endl;
}
}
}
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:50: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
39 | }else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:39:50: note: couldn't deduce template parameter '_BIter'
39 | }else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s738045805 | p00717 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
while (cin >> n, n) {
int m0;
cin >> m0;
vector<int> x0(m0);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
x0[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
for (int i = 0; i < n; i++) {
int m;
cin >> m;
vector<int> line(m);
int x, y, X, Y;
for (int i = 0; i < m0; i++) {
cin >> X >> Y;
if (i > 0) {
line[i] = (x - X) + (y - Y);
}
x = X;
y = Y;
}
if (m0 == m) {
if (x0 == line) {
cout << i + 1 << endl;
} else if (reverse(line.begin, line.end),x0 == line) {
cout << i + 1 << endl;
}
}
}
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:39:51: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
39 | } else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:39:51: note: couldn't deduce template parameter '_BIter'
39 | } else if (reverse(line.begin, line.end),x0 == line) {
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s534111190 | p00717 | C++ | #include <iostream>
#include <cmath>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define EPS 1e-10
using namespace std;
int N, M[51], X[51][10], Y[51][10];
int len(int i, int j) {
return abs(X[i][j] - X[i][j + 1]) + abs(Y[i][j] - Y[i][j + 1]);
}
int dir(int i, int j) {
int x1 = X[i][j + 1] - X[i][j];
int y1 = Y[i][j + 1] - Y[i][j];
int x2 = X[i][j + 2] - X[i][j];
int y2 = Y[i][j + 2] - Y[i][j];
double r = atan2(x2, y2) - atan2(x1, y1);
if(r < M_PI) r += M_PI * 2;
if(r > M_PI) r -= M_PI * 2;
if(abs(r) < EPS) return 0;
return r > 0;
}
int main(void) {
while(cin >> N, N) {
REP(i, 0, N + 1) {
cin >> M[i];
REP(j, 0, M[i]) cin >> X[i][j] >> Y[i][j];
}
REP(i, 1, N + 1) {
if(M[0] != M[i]) continue;
bool f1 = true;
REP(j, 0, M[0] - 1) if(len(0, j) != len(i, j)) f1 = false;
REP(j, 0, M[0] - 2) if(dir(0, j) != dir(i, j)) f1 = false;
bool f2 = true;
reverse(X[i], X[i] + M[0]);
reverse(Y[i], Y[i] + M[0]);
REP(j, 0, M[0] - 1) if(len(0, j) != len(i, j)) f2 = false;
REP(j, 0, M[0] - 2) if(dir(0, j) != dir(i, j)) f2 = false;
if(f1 || f2) cout << i << endl;
}
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:38:7: error: 'reverse' was not declared in this scope
38 | reverse(X[i], X[i] + M[0]);
| ^~~~~~~
|
s078190969 | p00717 | C++ | #include<iostream>
#include<string>
using namespace std;
string encode() {
int m;
cin >> m;
int x, y;
cin >> x >> y;
string s = "";
int dirx = 0;
int diry = 0;
for (int i = 1; i < m; ++i) {
int dx, dy;
cin >> dx >> dy;
dx -= x;
dy -= y;
int dist = abs(dx + dy);
int ndirx = (dx > 0) - (dx < 0);
int ndiry = (dy > 0) - (dy < 0);
if (dirx == 1 && ndiry == -1) s += 'r';
else if (dirx == 1 && ndiry == 1) s += 'l';
else if (dirx == -1 && ndiry == -1) s += 'l';
else if (dirx == -1 && ndiry == 1) s += 'r';
else if (diry == 1 && ndirx == -1) s += 'l';
else if (diry == 1 && ndirx == 1) s += 'r';
else if (diry == -1 && ndirx == -1) s += 'r';
else if (diry == -1 && ndirx == 1) s += 'l';
dirx = ndirx;
diry = ndiry;
x += dx;
y += dy;
s += to_string(dist);
}
//cout << s << endl;
return s;
}
int main() {
while (1) {
int n;
cin >> n;
if (n == 0) break;
string code = encode();
string rev(code);
reverse(rev.begin(), rev.end());
for (int i = 0; i < rev.size(); ++i) {
if (rev[i] == 'r' || rev[i] == 'l') rev[i] = rev[i] == 'r' ? 'l' : 'r';
}
//cout << code << endl;
//cout << rev << endl << endl;
for (int i = 1; i <= n; ++i) {
string ancode = encode();
if(ancode == code || ancode == rev) cout << i << endl;
}
cout << "+++++" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:52:9: error: 'reverse' was not declared in this scope
52 | reverse(rev.begin(), rev.end());
| ^~~~~~~
|
s867610218 | p00717 | C++ | #pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include "bits/stdc++.h"
using namespace std;
using ll = long long int;
#define debug(v) {printf("L%d %s > ",__LINE__,#v);cout<<(v)<<endl;}
#define debugv(v) {printf("L%d %s > ",__LINE__,#v);for(auto e:(v)){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) {printf("L%d %s > ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;}
#define debugaa(m,h,w) {printf("L%d %s >\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[y][x]<<" ";}cout<<endl;}}
#define ALL(v) (v).begin(),(v).end()
#define repeat(cnt,l) for(remove_const<decltype(l)>::type cnt=0;(cnt)<(l);++(cnt))
#define rrepeat(cnt,l) for(auto cnt=(l)-1;0<=(cnt);--(cnt))
#define iterate(cnt,b,e) for(auto cnt=(b);(cnt)!=(e);++(cnt))
#define diterate(cnt,b,e) for(auto cnt=(b);(cnt)!=(e);--(cnt))
const ll MD = 1000000007ll; const long double PI = 3.1415926535897932384626433832795L;
template<typename T1, typename T2> inline void assert_equal(T1 expected, T2 actual) { if (!(expected == actual)) { cerr << "assertion fault: expected=" << expected << " actual=" << actual << endl; abort(); } }
template<typename T1, typename T2> inline void assert_less(T1 actual, T2 threshold) { if (!(actual < threshold)) { cerr << "assertion fault: " << actual << " < (const)" << threshold << endl; abort(); } }
template<typename T1, typename T2> inline void assert_eqless(T1 actual, T2 threshold) { if (!(actual <= threshold)) { cerr << "assertion fault: " << actual << " <= (const)" << threshold << endl; abort(); } }
template<typename T1, typename T2> inline ostream& operator <<(ostream &o, const pair<T1, T2> p) { o << '(' << p.first << ':' << p.second << ')'; return o; }
template<typename Vec> inline ostream& _ostream_vecprint(ostream &o, const Vec& p) { o << '['; for (auto& e : p) o << e << ','; o << ']'; return o; }
template<typename T> inline ostream& operator<<(ostream& o, const vector<T>& v) { return _ostream_vecprint(o, v); }
template<typename T, size_t S> inline ostream& operator<<(ostream& o, const array<T, S>& v) { return _ostream_vecprint(o, v); }
template<typename T> inline T& maxset(T& to, const T& val) { return to = max(to, val); }
template<typename T> inline T& minset(T& to, const T& val) { return to = min(to, val); }
void bye(string s, int code = 0) { cout << s << endl; exit(code); }
mt19937_64 randdev(8901016);
template<typename T> inline T rand(T l, T h) { return uniform_int_distribution<T>(l, h)(randdev); }
template<> inline double rand<double>(double l, double h) { return uniform_real_distribution<double>(l, h)(randdev); }
template<> inline float rand<float>(float l, float h) { return uniform_real_distribution<float>(l, h)(randdev); }
#if defined(_WIN32) || defined(_WIN64)
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
#elif defined(__GNUC__)
#else
#define getchar_unlocked getchar
#define putchar_unlocked putchar
#endif
namespace {
#define isvisiblechar(c) (0x21<=(c)&&(c)<=0x7E)
class MaiScanner {
public:
template<typename T> void input_integer(T& var) {
var = 0; T sign = 1;
int cc = getchar_unlocked();
for (; cc<'0' || '9'<cc; cc = getchar_unlocked())
if (cc == '-') sign = -1;
for (; '0' <= cc && cc <= '9'; cc = getchar_unlocked())
var = (var << 3) + (var << 1) + cc - '0';
var = var * sign;
}
inline int c() { return getchar_unlocked(); }
inline MaiScanner& operator>>(int& var) { input_integer<int>(var); return *this; }
inline MaiScanner& operator>>(long long& var) { input_integer<long long>(var); return *this; }
inline MaiScanner& operator>>(string& var) {
int cc = getchar_unlocked();
for (; !isvisiblechar(cc); cc = getchar_unlocked());
for (; isvisiblechar(cc); cc = getchar_unlocked())
var.push_back(cc);
return *this;
}
template<typename IT> void in(IT begin, IT end) { for (auto it = begin; it != end; ++it) *this >> *it; }
};
class MaiPrinter {
public:
template<typename T>
void output_integer(T var) {
if (var == 0) { putchar_unlocked('0'); return; }
if (var < 0)
putchar_unlocked('-'),
var = -var;
char stack[32]; int stack_p = 0;
while (var)
stack[stack_p++] = '0' + (var % 10),
var /= 10;
while (stack_p)
putchar_unlocked(stack[--stack_p]);
}
inline MaiPrinter& operator<<(char c) { putchar_unlocked(c); return *this; }
inline MaiPrinter& operator<<(int var) { output_integer<int>(var); return *this; }
inline MaiPrinter& operator<<(long long var) { output_integer<long long>(var); return *this; }
inline MaiPrinter& operator<<(char* str_p) { while (*str_p) putchar_unlocked(*(str_p++)); return *this; }
inline MaiPrinter& operator<<(const string& str) {
const char* p = str.c_str();
const char* l = p + str.size();
while (p < l) putchar_unlocked(*p++);
return *this;
}
template<typename IT> void join(IT begin, IT end, char sep = '\n') { for (auto it = begin; it != end; ++it) *this << *it << sep; }
};
}
MaiScanner scanner;
MaiPrinter printer;
inline complex<int> read_complex() {
int x, y;
scanner >> x >> y;
return complex<int>(x, y);
}
vector<complex<int>> reverse_oresen(vector<complex<int>> oresen) {
reverse(ALL(oresen));
for (int i = 1; i < oresen.size(); i += 2) {
oresen[i] *= -1;
}
return oresen;
}
vector<complex<int>> read_oresen() {
int M;
scanner >> M;
vector<complex<int>> oresen;
complex<int> lastb = read_complex(), lastf = read_complex();
oresen.push_back(abs(lastf - lastb));
repeat(_, M - 2) {
complex<int> v = read_complex();
oresen.push_back(((v - lastf)/ abs(v - lastf)) / ((lastf - lastb)/ abs(lastf - lastb)));
oresen.push_back(abs(v - lastf));
lastb = lastf;
lastf = v;
}
return oresen;
}
void solve(int N) {
auto orig = read_oresen();
auto origr = reverse_oresen(orig);
repeat(i, N) {
auto o = read_oresen();
if (orig == o || origr == o) {
printer << i+1 << '\n';
}
}
printer << "+++++\n";
}
int main() {
int n;
while (scanner >> n, n > 0) {
solve(n);
}
return 0;
}
| a.cc: In function 'void solve(int)':
a.cc:148:16: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
148 | printer << "+++++\n";
| ^~~~~~~~~
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:3:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<std::complex<int>, std::allocator<std::complex<int> > >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::complex<int>]': target specific option mismatch
182 | ~allocator() _GLIBCXX_NOTHROW { }
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
132 | struct _Vector_impl
| ^~~~~~~~~~~~
|
s011212017 | p00717 | C++ | #define I(X,C)\
X##xm=X##ym=9999,X##xM=X##yM=-9999;\
for(scanf("%d",&C),i=0;i<C;i++){\
scanf("%d%d",X[i],X[i]+1);\
if(X##xm>X[i][0])X##xm=X[i][0];\
if(X##ym>X[i][1])X##ym=X[i][1];\
if(X##xM<X[i][0])X##xM=X[i][0];\
if(X##yM<X[i][1])X##yM=X[i][1];\
}for(i=0;i<C;i++)X[i][0]-=X##xm,X[i][1]-=X##ym;X##xM-=X##xm,X##yM-=X##ym;
m[10][2],x[10][2],z[10][2],zz[10][2];
rx[4][2]={{1,0},{0,-1},{-1,0},{0,1}};
ry[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
mv[4][2]={{0,0},{0,0},{0,0},{0,0}};
main(N,M,Z,t,i,j,k,mxm,mym,mxM,myM,zxm,zym,zxM,zyM){
for(;scanf("%d",&N),N;puts("+++++")){
I(z,Z)
for(i=0;i<Z;i++)zz[Z-1-i][0]=z[i][0],zz[Z-1-i][1]=z[i][1];
for(j=0;j<N;j++){
I(m,M)
if(M!=Z)continue;
mv[1][0]=myM,mv[2][0]=mxM,mv[2][1]=myM,mv[3][1]=mxM;
for(k=0;k<4;k++){
for(i=0;i<M;i++)x[i][0]=rx[k][0]*m[i][0]+rx[k][1]*m[i][1]+mv[k][0],x[i][1]=ry[k][0]*m[i][0]+ry[k][1]*m[i][1]+mv[k][1];
if(!memcmp(x,z,4*2*M)||!memcmp(x,zz,4*2*M))printf("%d\n",j+1),k=4;
}
}
}
return 0;
} | a.cc:11:1: error: 'm' does not name a type
11 | m[10][2],x[10][2],z[10][2],zz[10][2];
| ^
a.cc:12:1: error: 'rx' does not name a type
12 | rx[4][2]={{1,0},{0,-1},{-1,0},{0,1}};
| ^~
a.cc:13:1: error: 'ry' does not name a type
13 | ry[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
| ^~
a.cc:14:1: error: 'mv' does not name a type
14 | mv[4][2]={{0,0},{0,0},{0,0},{0,0}};
| ^~
a.cc:16:5: error: expected constructor, destructor, or type conversion before '(' token
16 | main(N,M,Z,t,i,j,k,mxm,mym,mxM,myM,zxm,zym,zxM,zyM){
| ^
|
s665119137 | p00717 | C++ | #include <iostream>
#include <complex>
#include <cmath>
#define MAX_N 60
#define MAX_M 20
using namespace std;
#define P complex<int>
int main(){
int n, m,mm;
P org[MAX_M];
P cmp[MAX_M];
P d, o,c,deg;
while( cin>>n && n ){
cin >> mm;
for( int i=0;i<mm;i++ )
cin >> org[i].real() >> org[i].imag();
d = org[0];
for( int i=0;i<mm;i++ )
org[i] = org[i] - d;
for( int loop=1;loop<=n;loop++ ){
cin >> m;
for( int i=0;i<m;i++ )
cin >> cmp[i].real() >> cmp[i].imag();
if( m!=mm )
continue;
bool f=false;
d= cmp[0] - org[0];
for( int i=0;i<m;i++ ) // ツ閉スツ行ツ暗堋督ョ
cmp[i] = cmp[i] - d;
o = org[1] / abs(org[1]);
c = cmp[1] / abs(cmp[1]);
deg = P( 1,0 );
while( o!=c ){
c = c * P( 0,1 );
deg *= P( 0,1 );
}
for( int i=1;i<m;i++ ) // ツ嘉アツ転
cmp[i] = cmp[i] * deg;
for( int i=1;i<m;i++ ){
if( org[i]!=cmp[i] )
break;
if( i==m-1 ) f=true;
}
if( !f ){
d = cmp[m-1] - org[0];
for( int i=0;i<m;i++ )
cmp[i] = cmp[i] - d; // ツ閉スツ行ツ暗堋督ョ
o = org[1] / abs(org[1]);
c = cmp[m-2] / abs(cmp[m-2]);
deg = P( 1,0 );
while( o!=c ){
c = c * P( 0,1 );
deg *= P( 0,1 );
}
for( int i=0;i<m-1;i++ ) // ツ嘉アツ転
cmp[i] = cmp[i] * deg;
for( int i=0;i<m-1;i++ ){
if( org[i]!=cmp[m-i-1] )
break;
if( i==m-2 ) f=true;
}
}
if( f )
cout << loop << endl;
}
cout << "+++++"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:11: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: invalid conversion from 'int' to 'void*' [-fpermissive]
20 | cin >> org[i].real() >> org[i].imag();
| ~~~~~~~~~~~^~
| |
| int
a.cc:20:25: error: cannot bind rvalue '(void*)((long int)org[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:20:25: 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]
20 | cin >> org[i].real() >> org[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:20:25: 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]
20 | cin >> org[i].real() >> org[i].imag();
|
s627431187 | p00717 | C++ | #include <iostream>
#include <complex>
#include <cmath>
#define MAX_N 60
#define MAX_M 20
using namespace std;
#define P complex<int>
int main(){
int n, m,mm;
P org[MAX_M];
P cmp[MAX_M];
P d, o,c,deg;
while( cin>>n && n ){
cin >> mm;
for( int i=0;i<mm;i++ )
cin >> org[i].real() >> org[i].imag();
d = org[0];
for( int i=0;i<mm;i++ )
org[i] = org[i] - d;
for( int loop=1;loop<=n;loop++ ){
cin >> m;
for( int i=0;i<m;i++ )
cin >> cmp[i].real() >> cmp[i].imag();
if( m!=mm )
continue;
bool f=false;
d= cmp[0] - org[0];
for( int i=0;i<m;i++ ) // ツ閉スツ行ツ暗堋督ョ
cmp[i] = cmp[i] - d;
o = org[1] / abs(org[1]);
c = cmp[1] / abs(cmp[1]);
deg = P( 1,0 );
while( o!=c ){
c = c * P( 0,1 );
deg *= P( 0,1 );
}
for( int i=1;i<m;i++ ) // ツ嘉アツ転
cmp[i] = cmp[i] * deg;
for( int i=1;i<m;i++ ){
if( org[i]!=cmp[i] )
break;
if( i==m-1 ) f=true;
}
if( !f ){
d = cmp[m-1] - org[0];
for( int i=0;i<m;i++ )
cmp[i] = cmp[i] - d; // ツ閉スツ行ツ暗堋督ョ
o = org[1] / abs(org[1]);
c = cmp[m-2] / abs(cmp[m-2]);
deg = P( 1,0 );
while( o!=c ){
c = c * P( 0,1 );
deg *= P( 0,1 );
}
for( int i=0;i<m-1;i++ ) // ツ嘉アツ転
cmp[i] = cmp[i] * deg;
for( int i=0;i<m-1;i++ ){
if( org[i]!=cmp[m-i-1] )
break;
if( i==m-2 ) f=true;
}
}
if( f )
cout << loop << endl;
}
cout << "+++++"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:11: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'int'
20 | cin >> org[i].real() >> org[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:20:25: error: invalid conversion from 'int' to 'void*' [-fpermissive]
20 | cin >> org[i].real() >> org[i].imag();
| ~~~~~~~~~~~^~
| |
| int
a.cc:20:25: error: cannot bind rvalue '(void*)((long int)org[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:20:25: 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]
20 | cin >> org[i].real() >> org[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:20:25: 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]
20 | cin >> org[i].real() >> org[i].imag();
|
s683081563 | p00717 | C++ | #include <iostream>
#include <vector>
#include <cmath>
#include <complex>
#define PI M_PI
using namespace std;
typedef complex<int> P;
struct l {
int n;
vector<P> p;
};
P rotate(P p, int n) {
int x = p.real(), y = p.imag();
return
n == 0 ? P(x, y)
: n == 1 ? P(-y, x)
: n == 2 ? P(y, -x)
: P(-x, -y)
;
}
int main() {
int n;
while (cin >> n, n) {
vector<l> lines(++n);
for (int i = 0; i < n; ++i) {
cin >> lines[i].n;
for (int j = 0; j < lines[i].n; ++j) {
int x, y;
cin >> x >> y;
lines[i].p.push_back( P(x, y) );
}
}
vector<l> pattern(8);
for (int i = 0; i < 4; ++i) {
l new_line;
for (int j = 0; j < lines[0].n; ++j)
new_line.p.push_back( rotate(lines[0].p[j], i) );
pattern[i+4] = pattern[i] = new_line;
reverse( pattern[i+4].p.begin(), pattern[i+4].p.end() );
}
for (int i = 1; i < n; ++i) {
if (lines[i].n != lines[0].n) continue;
for (int j = 0; j < 8; ++j) {
P d = pattern[j].p[0] - lines[i].p[0];
bool same = true;
for (int k = 1; k < lines[i].n; ++k)
same &= lines[i].p[k] + d == pattern[j].p[k];
if (same) {
cout << i << endl;
break;
}
}
}
cout << "+++++" << endl;
}
} | a.cc: In function 'int main()':
a.cc:49:25: error: 'reverse' was not declared in this scope
49 | reverse( pattern[i+4].p.begin(), pattern[i+4].p.end() );
| ^~~~~~~
|
s498222329 | p00717 | C++ | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
typedef int Element;
typedef complex<Element> Point;
Element dot(const Point& a, const Point& b){
return (a.real() * b.real() + a.imag() * b.imag());
}
Element cross(const Point& a, const Point& b){
return (a.real() * b.imag() - a.imag() * b.real());
}
int ccw(Point a, Point b, Point c){
b -= a; c -= a;
if(cross(b,c) > 0) return +1; // counter clock wise
if(cross(b,c) < 0) return -1; // clock wise
if(dot(b,c) < 0) return +2; // c--a--b
if(norm(b) < norm(c)) return -2; // a--b--c
return 0; // a--c--b || b == c
}
int main(){
int N,M,i,j,x;
vector< complex<Element> > origin;
vector< complex<Element> > v[10];
while(1){
scanf("%d",&N);
if(N == 0) break;
scanf("%d",&M);
origin.resize(M);
REP(i,M) scanf("%d %d",&origin[i].real(),&origin[i].imag());
REP(i,N){
scanf("%d",&M);
v[i].resize(M);
REP(j,M) scanf("%d %d",&v[i][j].real(),&v[i][j].imag());
}
bool used[10];
vector<int> res;
REP(i,10) used[i] = false;
REP(x,2) REP(i,N){
bool same = true;
if(x == 1) reverse(v[i].begin(),v[i].end());
if(v[i].size() != origin.size()) continue;
REP(j,origin.size()-1){
if(abs(v[i][j].real() - v[i][j+1].real()) != abs(origin[j].real() - origin[j+1].real())) same = false;
if(abs(v[i][j].imag() - v[i][j+1].imag()) != abs(origin[j].imag() - origin[j+1].imag())) same = false;
}
REP(j,origin.size()-2) if(ccw(v[i][j],v[i][j+1],v[i][j+2]) != ccw(origin[j],origin[j+1],origin[j+2])) same = false;
if(same && !printed[i]){
res.push_back(i+1);
used[i] = true;
}
}
sort(res.begin(),res.end());
REP(i,res.size()) cout << res[i] << endl;
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:50:43: error: lvalue required as unary '&' operand
50 | REP(i,M) scanf("%d %d",&origin[i].real(),&origin[i].imag());
| ~~~~~~~~~~~~~~^~
a.cc:50:61: error: lvalue required as unary '&' operand
50 | REP(i,M) scanf("%d %d",&origin[i].real(),&origin[i].imag());
| ~~~~~~~~~~~~~~^~
a.cc:54:43: error: lvalue required as unary '&' operand
54 | REP(j,M) scanf("%d %d",&v[i][j].real(),&v[i][j].imag());
| ~~~~~~~~~~~~^~
a.cc:54:59: error: lvalue required as unary '&' operand
54 | REP(j,M) scanf("%d %d",&v[i][j].real(),&v[i][j].imag());
| ~~~~~~~~~~~~^~
a.cc:69:19: error: 'printed' was not declared in this scope; did you mean 'printf'?
69 | if(same && !printed[i]){
| ^~~~~~~
| printf
|
s266758486 | p00717 | C++ | #include <iostream>
#include <complex>
#include <vector>
using namespace std;
#define pb push_back
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define sz size()
typedef complex<int> P;
typedef vector<P> V;
int n;
bool same(V a,V b){
rep2(i,1,a.sz){
if(a[i]-b[i]!=a[0]-b[0])return 0;
}
return 1;
}
int main(){
while(cin>>n && n){
V v;
int m,x,y;
cin>>m;
rep(i,m){
cin>>x>>y;
v.pb(P(x,y));
}
rep(h,n){
V w;
cin>>m;
rep(i,m){
cin>>x>>y;
w.pb(P(x,y));
}
if(m!=v.sz)continue;
rep(i,2){
rep(j,4){
if(same(v,w)){
cout<<h+1<<endl;
goto out;
}
rep(k,m)w[k]=w[k]*P(0,1);
}
reverse(w.begin(),w.end());
}
out:;
}
cout<<"+++++\n";
}
} | a.cc: In function 'int main()':
a.cc:48:33: error: 'reverse' was not declared in this scope
48 | reverse(w.begin(),w.end());
| ^~~~~~~
|
s114668816 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = abs(p[i][j]-p[i][j-1]);//要潤
}
else if(j == m[i]-1)ed = abs(p[i][j]-p[i][j-1]);
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
//if(i == 3){cout << "3晩M " << endl;
//cout <<i << " --------------------" << endl;
//rep(j,m[i])cout << p[i][j] << endl;
//}
}
bool iso;
//cout << "基準" << endl;
//rep(i,m[0])cout << p[0][i] << endl;
//cout << "基準" << endl;
REP(i,1,n+1){
if(m[i] != m[0])continue;
//cout << i << "-------------------------" << endl;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
//cout <<"moto no p[i][k] = " << p[i][k] << " ";
//cp = p[i][k]*polar(1.0,rad[j]);
cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
/*
cp.real() = p[i][k].real()*cos(rad[j])-p[i][k].imag()*sin(rad[j]);
cp.imag() = p[i][k].real()*sin(rad[j])+p[i][k].imag()*cos(rad[j]);
*/
//要潤
/*
//cout <<"pre cp = " << cp;
if(cp.real() > 0.0){
if(1.0-EPS>cp.real()-(int)cp.real()&&cp.real()-(int)cp.real() > 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() > 0.0){
if(1.0-EPS>cp.imag()-(int)cp.imag()&&cp.imag()-(int)cp.imag() > 0.0){
cp.imag() = (int)cp.imag();
}
}
if(cp.real() <0.0){
if(-1.0+EPS<cp.real()+(int)cp.real() && cp.real()+(int)cp.real() < 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() < 0.0){
if(-1.0+EPS< cp.imag()+(int)cp.imag() &&cp.imag()+(int)cp.imag() < 0.0){
cp.imag() = (int)cp.imag();
}
}
// cout << endl;
*/
//要潤
//cout << j<< "th cp = " << cp << " 基準 is " << p[0][k]<< endl;
//if(!(1.0-EPS>cp.real()-p[0][k].real()&&cp.real()-p[0][k].real()>=0.0-EPS&&1.0-EPS>cp.imag()-p[0][k].imag()&&cp.imag()-p[0][k].imag()>=0.0-EPS)){
//iso = false;
//break;
//}
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:75:18: error: lvalue required as left operand of assignment
75 | cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
| ~~~~~~~^~
a.cc:76:18: error: lvalue required as left operand of assignment
76 | cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
| ~~~~~~~^~
|
s978217019 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = abs(p[i][j]-p[i][j-1]);//要潤
}
else if(j == m[i]-1)ed = abs(p[i][j]-p[i][j-1]);
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
//if(i == 3){cout << "3晩M " << endl;
//cout <<i << " --------------------" << endl;
//rep(j,m[i])cout << p[i][j] << endl;
//}
}
bool iso;
//cout << "基準" << endl;
//rep(i,m[0])cout << p[0][i] << endl;
//cout << "基準" << endl;
REP(i,1,n+1){
if(m[i] != m[0])continue;
//cout << i << "-------------------------" << endl;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
//cout <<"moto no p[i][k] = " << p[i][k] << " ";
//cp = p[i][k]*polar(1.0,rad[j]);
cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
/*
cp.real() = p[i][k].real()*cos(rad[j])-p[i][k].imag()*sin(rad[j]);
cp.imag() = p[i][k].real()*sin(rad[j])+p[i][k].imag()*cos(rad[j]);
*/
//要潤
/*
//cout <<"pre cp = " << cp;
if(cp.real() > 0.0){
if(1.0-EPS>cp.real()-(int)cp.real()&&cp.real()-(int)cp.real() > 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() > 0.0){
if(1.0-EPS>cp.imag()-(int)cp.imag()&&cp.imag()-(int)cp.imag() > 0.0){
cp.imag() = (int)cp.imag();
}
}
if(cp.real() <0.0){
if(-1.0+EPS<cp.real()+(int)cp.real() && cp.real()+(int)cp.real() < 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() < 0.0){
if(-1.0+EPS< cp.imag()+(int)cp.imag() &&cp.imag()+(int)cp.imag() < 0.0){
cp.imag() = (int)cp.imag();
}
}
// cout << endl;
*/
//要潤
//cout << j<< "th cp = " << cp << " 基準 is " << p[0][k]<< endl;
//if(!(1.0-EPS>cp.real()-p[0][k].real()&&cp.real()-p[0][k].real()>=0.0-EPS&&1.0-EPS>cp.imag()-p[0][k].imag()&&cp.imag()-p[0][k].imag()>=0.0-EPS)){
//iso = false;
//break;
//}
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:75:18: error: lvalue required as left operand of assignment
75 | cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
| ~~~~~~~^~
a.cc:76:18: error: lvalue required as left operand of assignment
76 | cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
| ~~~~~~~^~
|
s936975653 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = abs(p[i][j]-p[i][j-1]);//要潤
}
else if(j == m[i]-1)ed = abs(p[i][j]-p[i][j-1]);
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
//if(i == 3){cout << "3晩M " << endl;
//cout <<i << " --------------------" << endl;
//rep(j,m[i])cout << p[i][j] << endl;
//}
}
bool iso;
//cout << "基準" << endl;
//rep(i,m[0])cout << p[0][i] << endl;
//cout << "基準" << endl;
REP(i,1,n+1){
if(m[i] != m[0])continue;
//cout << i << "-------------------------" << endl;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
//cout <<"moto no p[i][k] = " << p[i][k] << " ";
//cp = p[i][k]*polar(1.0,rad[j]);
cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
/*
cp.real() = p[i][k].real()*cos(rad[j])-p[i][k].imag()*sin(rad[j]);
cp.imag() = p[i][k].real()*sin(rad[j])+p[i][k].imag()*cos(rad[j]);
*/
//要潤
/*
//cout <<"pre cp = " << cp;
if(cp.real() > 0.0){
if(1.0-EPS>cp.real()-(int)cp.real()&&cp.real()-(int)cp.real() > 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() > 0.0){
if(1.0-EPS>cp.imag()-(int)cp.imag()&&cp.imag()-(int)cp.imag() > 0.0){
cp.imag() = (int)cp.imag();
}
}
if(cp.real() <0.0){
if(-1.0+EPS<cp.real()+(int)cp.real() && cp.real()+(int)cp.real() < 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() < 0.0){
if(-1.0+EPS< cp.imag()+(int)cp.imag() &&cp.imag()+(int)cp.imag() < 0.0){
cp.imag() = (int)cp.imag();
}
}
// cout << endl;
*/
//要潤
//cout << j<< "th cp = " << cp << " 基準 is " << p[0][k]<< endl;
//if(!(1.0-EPS>cp.real()-p[0][k].real()&&cp.real()-p[0][k].real()>=0.0-EPS&&1.0-EPS>cp.imag()-p[0][k].imag()&&cp.imag()-p[0][k].imag()>=0.0-EPS)){
//iso = false;
//break;
//}
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:75:18: error: lvalue required as left operand of assignment
75 | cp.real() = p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j];
| ~~~~~~~^~
a.cc:76:18: error: lvalue required as left operand of assignment
76 | cp.imag() = p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j];
| ~~~~~~~^~
|
s885616236 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = abs(p[i][j]-p[i][j-1]);//要潤
}
else if(j == m[i]-1)ed = abs(p[i][j]-p[i][j-1]);
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
//if(i == 3){cout << "3晩M " << endl;
//cout <<i << " --------------------" << endl;
//rep(j,m[i])cout << p[i][j] << endl;
//}
}
bool iso;
//cout << "基準" << endl;
//rep(i,m[0])cout << p[0][i] << endl;
//cout << "基準" << endl;
REP(i,1,n+1){
if(m[i] != m[0])continue;
//cout << i << "-------------------------" << endl;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
//cout <<"moto no p[i][k] = " << p[i][k] << " ";
//cp = p[i][k]*polar(1.0,rad[j]);
cp.real() = (int)(p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j]);
cp.imag() = (int)(p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j]);
/*
cp.real() = p[i][k].real()*cos(rad[j])-p[i][k].imag()*sin(rad[j]);
cp.imag() = p[i][k].real()*sin(rad[j])+p[i][k].imag()*cos(rad[j]);
*/
//要潤
/*
//cout <<"pre cp = " << cp;
if(cp.real() > 0.0){
if(1.0-EPS>cp.real()-(int)cp.real()&&cp.real()-(int)cp.real() > 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() > 0.0){
if(1.0-EPS>cp.imag()-(int)cp.imag()&&cp.imag()-(int)cp.imag() > 0.0){
cp.imag() = (int)cp.imag();
}
}
if(cp.real() <0.0){
if(-1.0+EPS<cp.real()+(int)cp.real() && cp.real()+(int)cp.real() < 0.0){
cp.real() = (int)cp.real();
}
}
if(cp.imag() < 0.0){
if(-1.0+EPS< cp.imag()+(int)cp.imag() &&cp.imag()+(int)cp.imag() < 0.0){
cp.imag() = (int)cp.imag();
}
}
// cout << endl;
*/
//要潤
//cout << j<< "th cp = " << cp << " 基準 is " << p[0][k]<< endl;
//if(!(1.0-EPS>cp.real()-p[0][k].real()&&cp.real()-p[0][k].real()>=0.0-EPS&&1.0-EPS>cp.imag()-p[0][k].imag()&&cp.imag()-p[0][k].imag()>=0.0-EPS)){
//iso = false;
//break;
//}
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:75:18: error: lvalue required as left operand of assignment
75 | cp.real() = (int)(p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j]);
| ~~~~~~~^~
a.cc:76:18: error: lvalue required as left operand of assignment
76 | cp.imag() = (int)(p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j]);
| ~~~~~~~^~
|
s381696905 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = abs((double)(p[i][j]-p[i][j-1]));//要潤
}
else if(j == m[i]-1)ed = abs((double)(p[i][j]-p[i][j-1]));
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
}
bool iso;
REP(i,1,n+1){
if(m[i] != m[0])continue;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
cp = P((int)(p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j]),(int)(p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j]));
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:20: error: invalid cast from type 'std::complex<int>' to type 'double'
28 | st = abs((double)(p[i][j]-p[i][j-1]));//要潤
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:38: error: invalid cast from type 'std::complex<int>' to type 'double'
30 | else if(j == m[i]-1)ed = abs((double)(p[i][j]-p[i][j-1]));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s102650114 | p00717 | C++ | #include<complex>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
using namespace std;
typedef complex<int> P;
const double rad[4] ={0.0,M_PI/2,M_PI,-M_PI/2};
const int Sin[4] = {0,1,0,-1};
const int Cos[4] = {1,0,-1,0};
int main(){
int n,m[110],x,y;
double st,ed;
P p[60][15];
while(cin >> n && n){
rep(i,n+1){
cin >> m[i];
rep(j,m[i]){
cin >> x >> y;
p[i][j] = P(x,y);
if(j == 1){
st = (double)abs((int)(p[i][j]-p[i][j-1]));//要潤
}
else if(j == m[i]-1)ed = (double)abs((int)(p[i][j]-p[i][j-1]));
}
if(st > ed){
P sub = p[i][0];
rep(j,m[i])p[i][j] -= sub;
}
else {
P sub = p[i][m[i]-1];
rep(j,m[i])p[i][j] -= sub;
P h;
rep(j,m[i]/2){
h = p[i][j];
p[i][j] = p[i][(m[i]-1)-j];
p[i][(m[i]-1)-j] = h;
}
}
}
bool iso;
REP(i,1,n+1){
if(m[i] != m[0])continue;
rep(j,4){
iso = true;
rep(k,m[0]){
P cp;
cp = P((int)(p[i][k].real()*Cos[j]-p[i][k].imag()*Sin[j]),(int)(p[i][k].real()*Sin[j]+p[i][k].imag()*Cos[j]));
if(cp != p[0][k]){iso = false; break;}
}
if(iso)break;
}
if(iso)cout << i << endl;
}
cout <<"+++++" << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:28: error: invalid cast from type 'std::complex<int>' to type 'int'
28 | st = (double)abs((int)(p[i][j]-p[i][j-1]));//要潤
| ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:46: error: invalid cast from type 'std::complex<int>' to type 'int'
30 | else if(j == m[i]-1)ed = (double)abs((int)(p[i][j]-p[i][j-1]));
| ^~~~~~~~~~~~~~~~~~~~~~~~
|
s692922245 | p00717 | C++ | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define pb push_back
struct Vector {
int x, y;
Vector() {}
Vector(int x, int y) : x(x), y(y) {}
double norm() {
return x*x + y*y;
}
double abs() {
return sqrt(x*x + y*y);
}
};
typedef vector<Vector> vv;
Vector rotate90R(Vector v) {
return Vector(-v.y, v.x);
}
int lcm(int a, int b) {
return (a*b)/__gcd(a, b);
}
bool isEqVecs(vv vv1, vv vv2) {
int a, b, l;
l = lcm(vv1[0].norm(), vv2[0].norm());
a = l / vv1[0].norm(); // テ・ツ?催ァツ篠?
b = l / vv2[0].norm();
if(vv1.size() != vv2.size()) return false; // テ」ツδ凖」ツつッテ」ツδ暗」ツδォテ」ツ?ョテヲツ閉ーテ」ツ?古ァツ閉ーテ」ツ?ェテ」ツつ?
bool isok = true;
// テヲツッツ氾ァツ篠?」ツ?古ッツシツ敕」ツ?凝ィツェツソテ」ツ?ケテ」ツつ?
for(int i=0; i<vv1.size(); i++) {
if(!(vv1[i].x * a == vv2[i].x * b
&& vv1[i].y * a == vv2[i].y * b)) isok = false;
}
return isok;
}
int main() {
int n;
// input data
while(cin >> n && n) {
vv vvec[51][8];
int id2m[51];
Vector data[51];
for(int id=0; id<=n; id++) {
cin >> id2m[id];
for(int j=0; j<id2m[id]; j++) {
cin >> data[j].x >> data[j].y;
}
for(int j=1; j<id2m[id]; j++) {
Vector V1(data[j].x-data[j-1].x, data[j].y-data[j-1].y);
Vector V2(-(data[id2m[id]-1-j].x-data[id2m[id]-j].x), -(data[id2m[id]-1-j].y-data[id2m[id]-j].y));
vvec[id][0].pb(V1);
vvec[id][1].pb(rotate90R(vvec[id][0][j-1]));
vvec[id][2].pb(rotate90R(vvec[id][1][j-1]));
vvec[id][3].pb(rotate90R(vvec[id][2][j-1]));
vvec[id][4].pb(V2);
vvec[id][5].pb(rotate90R(vvec[id][4][j-1]));
vvec[id][6].pb(rotate90R(vvec[id][5][j-1]));
vvec[id][7].pb(rotate90R(vvec[id][6][j-1]));
}
/*
for(int k=0; k<4; k++) {
for(int v_i=0; v_i<id2m[id]-1; v_i++) {
cout << vvec[id][k][v_i].x << ' ' << vvec[id][k][v_i].y << endl;
}
}
*/
}
for(int i=1; i<=n; i++) {
// Obj(id = 0) テ」ツ?ィ Obj(for all except id = 0) * 8 テ」ツ?ィテ」ツ?ョテ、ツクツ?ィツ?エテ」ツつ津ィツェツソテ」ツ?ケテ」ツつ?
for(int k=0; k<8; k++) {
if(isEqVecs(vvec[i][k], vvec[0][0])) {
cout << i << endl;
}
}
}
cout << "+++++" << endl;
}
return 0;
} | a.cc: In function 'int lcm(int, int)':
a.cc:29:16: error: '__gcd' was not declared in this scope
29 | return (a*b)/__gcd(a, b);
| ^~~~~
|
s116296690 | p00717 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,m;
int s,t;
int i,j,flag;
vector<int> x,y,a,b,p,q;
while(cin>>n,n){
a.clear();
b.clear();
cin>>m;
cin>>s>>t;
a.push_back(s);
b.push_back(t);
for(i=0;i<m-1;i++){
cin>>s>>t;
a.push_back(s-a[0]);
b.push_back(t-b[0]);
}
a[0]=a[0]-a[0];
b[0]=b[0]-b[0];
for(i=0;i<n;i++){
cin>>m;
flag=0;
x.clear();
y.clear();
p.clear();
q.clear();
for(j=0;j<m;j++){
cin>>s>>t;
x.push_back(s);
y.push_back(t);
}
s=x[0];
t=y[0];
for(j=0;j<m;j++){
p.push_back(x[j]-s);
q.push_back(y[j]-t);
}
for(int c=0;c<4;c++){
for(j=0;j<m;j++){
s=p[j];
p[j]=-q[j];
q[j]=s;
}
if(p==a&&q==b){
cout<<i+1<<endl;
flag=1;
break;
}
}
if(flag){
flag=0;
continue;
}
reverse(x.begin(),x.end());
reverse(y.begin(),y.end());
for(j=0;j<m;j++){
p[j]=x[j]-x[0];
q[j]=y[j]-y[0];
}
for(int c=0;c<4;c++){
for(j=0;j<m;j++){
s=p[j];
p[j]=-q[j];
q[j]=s;
}
if(p==a&&q==b){
cout<<i+1<<endl;
flag=1;
break;
}
}
}
cout<<"+++++"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:60:25: error: 'reverse' was not declared in this scope
60 | reverse(x.begin(),x.end());
| ^~~~~~~
|
s180848955 | p00717 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,m;
int s,t;
int i,j,flag;
vector<int> x,y,a,b,p,q;
while(cin>>n,n){
a.clear();
b.clear();
cin>>m;
cin>>s>>t;
a.push_back(s);
b.push_back(t);
for(i=0;i<m-1;i++){
cin>>s>>t;
a.push_back(s-a[0]);
b.push_back(t-b[0]);
}
a[0]=a[0]-a[0];
b[0]=b[0]-b[0];
for(i=0;i<n;i++){
cin>>m;
flag=0;
x.clear();
y.clear();
p.clear();
q.clear();
for(j=0;j<m;j++){
cin>>s>>t;
x.push_back(s);
y.push_back(t);
}
s=x[0];
t=y[0];
for(j=0;j<m;j++){
p.push_back(x[j]-s);
q.push_back(y[j]-t);
}
for(int c=0;c<4;c++){
for(j=0;j<m;j++){
s=p[j];
p[j]=-q[j];
q[j]=s;
}
if(p==a&&q==b){
cout<<i+1<<endl;
flag=1;
break;
}
}
if(flag){
flag=0;
continue;
}
reverse(x.begin(),x.end());
reverse(y.begin(),y.end());
for(j=0;j<m;j++){
p[j]=x[j]-x[0];
q[j]=y[j]-y[0];
}
for(int c=0;c<4;c++){
for(j=0;j<m;j++){
s=p[j];
p[j]=-q[j];
q[j]=s;
}
if(p==a&&q==b){
cout<<i+1<<endl;
flag=1;
break;
}
}
}
cout<<"+++++"<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:60:25: error: 'reverse' was not declared in this scope
60 | reverse(x.begin(),x.end());
| ^~~~~~~
|
s601043710 | p00717 | C++ | #include <iostream>
#include<algorithm>
#define MAX 11
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int n;
while (cin >> n, n){
//初期化
int edge[MAX][2], oppedge[MAX][2], ledge[MAX][2], redge[MAX][2];
int endedge[MAX][2], endoppedge[MAX][2], endledge[MAX][2], endredge[MAX][2];
for (int i = 0; i < MAX; i++){
for (int j = 0; j < 2; j++){
edge[i][j] = oppedge[i][j] = ledge[i][j] = redge[i][j] = 0;
endedge[i][j] = endoppedge[i][j] = endledge[i][j] = endredge[i][j] = 0;
}
}
//基準図形の頂点の座標を入力
int m;
cin >> m;
int x[11], y[11];
for (int i = 0; i < m; i++){
cin >> x[i] >> y[i];
}
//基準図形の取得
for (int i = 0; i < m - 1; i++){
if (x[i] != x[i + 1]){
edge[i][0] = x[i + 1] - x[i];
}
else{
edge[i][1] = y[i + 1] - y[i];
}
}
//基準図形を逆向きに辿ったもの
for (int i = m - 2; i >= 0; i--){
endedge[i][0] = edge[m - 2 - i][0];
endedge[i][1] = edge[m - 2 - i][1];
}
//基準図形を左90度回転したもの
for (int i = 0; i < m - 1; i++){
ledge[i][0] = edge[i][1] * (-1);
ledge[i][1] = edge[i][0];
endledge[i][0] = endedge[i][1] * (-1);
endledge[i][1] = endedge[i][0];
}
//基準図形を右90度回転したもの
for (int i = 0; i < m - 1; i++){
redge[i][0] = edge[i][1];
redge[i][1] = edge[i][0] * (-1);
endredge[i][0] = endedge[i][1];
endredge[i][1] = endedge[i][0] * (-1);
}
//基準図形を180度回転したもの
for (int i = 0; i < m - 1; i++){
oppedge[i][0] = edge[i][0] * (-1);
oppedge[i][1] = edge[i][1] * (-1);
endoppedge[i][0] = endedge[i][0] * (-1);
endoppedge[i][1] = endedge[i][1] * (-1);
}
//対象図形
for (int i = 0; i < n; i++){
cin >> m;
//初期化
bool edgeflag, redgeflag, ledgeflag, oppedgeflag;
bool endedgeflag, endredgeflag, endledgeflag, endoppedgeflag;
edgeflag = redgeflag = ledgeflag = oppedgeflag = true;
endedgeflag = endredgeflag = endledgeflag = endoppedgeflag = true;
int under[MAX][2];
for (int j = 0; j < MAX; j++){
for (int k = 0; k < 2; k++){
under[j][k] = 0;
}
}
// 対象図形の頂点の座標を入力
for (int j = 0; j < m; j++){
cin >> x[j] >> y[j];
}
//対象図形の取得
for (int j = 0; j < m - 1; j++){
if (x[j] != x[j + 1]){
under[j][0] = x[j + 1] - x[j];
}
else{
under[j][1] = y[j + 1] - y[j];
}
}
//対象図形の判定
for (int j = 0; j < m - 1; j++){
if (edge[j][0] != under[j][0] || edge[j][1] != under[j][1]){
edgeflag = false;
}
if (redge[j][0] != under[j][0] || redge[j][1] != under[j][1]){
redgeflag = false;
}
if (ledge[j][0] != under[j][0] || ledge[j][1] != under[j][1]){
ledgeflag = false;
}
if (oppedge[j][0] != under[j][0] || oppedge[j][1] != under[j][1]){
oppedgeflag = false;
}
if (endedge[j][0] != under[j][0] || endedge[j][1] != under[j][1]){
endedgeflag = false;
}
if (endredge[j][0] != under[j][0] || endredge[j][1] != under[j][1]){
endredgeflag = false;
}
if (endledge[j][0] != under[j][0] || endledge[j][1] != under[j][1]){
endledgeflag = false;
}
if (endoppedge[j][0] != under[j][0] || endoppedge[j][1] != under[j][1]){
endoppedgeflag = false;
}
}
if (edgeflag || redgeflag || ledgeflag || oppedgeflag || endedgeflag || endredgeflag || endledgeflag || endoppedgeflag)
cout << i + 1 << endl;
}
cout << "+++++" << endl;
}
return 0;
} | a.cc:7:22: error: '_TCHAR' has not been declared
7 | int _tmain(int argc, _TCHAR* argv[])
| ^~~~~~
|
s647296846 | p00718 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
while(n-->0){
int tot=0;
for(int i=0;i<2;i++) tot+=MCXItoNumber(ir.next());
out.println(NumbertoMCXI(tot));
}
}
public static int MCXItoNumber(String s){
int[] dig=new int[4];
Arrays.fill(dig,-1);
int v=-1;
for(int i=s.length()-1;i>=0;i--){
char c=s.charAt(i);
int td=td(c);
if(td==-1) dig[v]=c-'0';
else{
if(v!=-1&&dig[v]==-1) dig[v]=1;
v=td;
}
}
if(v!=-1&&dig[v]==-1) dig[v]=1;
for(int i=0;i<4;i++) if(dig[i]<0) dig[i]=0;
int ret=0;
for(int i=0;i<4;i++){
ret+=Math.pos(10,i)*dig[i];
}
return ret;
}
public static NumbertoMCXI(int a){
int[] dig=new int[4];
for(int i=3;i>=0;i--){
dig[i]=(int)(a/Math.pos(10,i));
a-=dig[i]*Math.pos(10,i);
}
String ret="";
for(int i=3;i>=0;i--){
if(dig[i]==0) continue;
else if(dig[i]!=1) ret+=Integer.toString(dig[i]);
ret+=tc(i);
}
return ret;
}
pubilc static int td(char s){
if(s=='m') return 3;
else if(s=='c') return 2;
else if(s=='x') return 1;
else if(s=='i') return 0;
else return -1;
}
pubilc static String tc(int s){
if(s==3) return "m";
else if(s==2) return "c";
else if(s==1) return "x";
else return "i";
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:47: error: invalid method declaration; return type required
public static NumbertoMCXI(int a){
^
Main.java:62: error: <identifier> expected
pubilc static int td(char s){
^
Main.java:70: error: <identifier> expected
pubilc static String tc(int s){
^
3 errors
|
s304365401 | p00718 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
while(n-->0){
int tot=0;
for(int i=0;i<2;i++) tot+=MCXItoNumber(ir.next());
out.println(NumbertoMCXI(tot));
}
}
public static int MCXItoNumber(String s){
int[] dig=new int[4];
Arrays.fill(dig,-1);
int v=-1;
for(int i=s.length()-1;i>=0;i--){
char c=s.charAt(i);
int td=td(c);
if(td==-1) dig[v]=c-'0';
else{
if(v!=-1&&dig[v]==-1) dig[v]=1;
v=td;
}
}
if(v!=-1&&dig[v]==-1) dig[v]=1;
for(int i=0;i<4;i++) if(dig[i]<0) dig[i]=0;
int ret=0;
for(int i=0;i<4;i++){
ret+=Math.pos(10,i)*dig[i];
}
return ret;
}
public static String NumbertoMCXI(int a){
int[] dig=new int[4];
for(int i=3;i>=0;i--){
dig[i]=(int)(a/Math.pos(10,i));
a-=dig[i]*Math.pos(10,i);
}
String ret="";
for(int i=3;i>=0;i--){
if(dig[i]==0) continue;
else if(dig[i]!=1) ret+=Integer.toString(dig[i]);
ret+=tc(i);
}
return ret;
}
pubilic static int td(char s){
if(s=='m') return 3;
else if(s=='c') return 2;
else if(s=='x') return 1;
else if(s=='i') return 0;
else return -1;
}
public static String tc(int s){
if(s==3) return "m";
else if(s==2) return "c";
else if(s==1) return "x";
else return "i";
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:62: error: <identifier> expected
pubilic static int td(char s){
^
1 error
|
s688877908 | p00718 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
while(n-->0){
int tot=0;
for(int i=0;i<2;i++) tot+=MCXItoNumber(ir.next());
out.println(NumbertoMCXI(tot));
}
}
public static int MCXItoNumber(String s){
int[] dig=new int[4];
Arrays.fill(dig,-1);
int v=-1;
for(int i=s.length()-1;i>=0;i--){
char c=s.charAt(i);
int td=td(c);
if(td==-1) dig[v]=c-'0';
else{
if(v!=-1&&dig[v]==-1) dig[v]=1;
v=td;
}
}
if(v!=-1&&dig[v]==-1) dig[v]=1;
for(int i=0;i<4;i++) if(dig[i]<0) dig[i]=0;
int ret=0;
for(int i=0;i<4;i++){
ret+=Math.pos(10,i)*dig[i];
}
return ret;
}
public static String NumbertoMCXI(int a){
int[] dig=new int[4];
for(int i=3;i>=0;i--){
dig[i]=(int)(a/Math.pos(10,i));
a-=dig[i]*Math.pos(10,i);
}
String ret="";
for(int i=3;i>=0;i--){
if(dig[i]==0) continue;
else if(dig[i]!=1) ret+=Integer.toString(dig[i]);
ret+=tc(i);
}
return ret;
}
public static int td(char s){
if(s=='m') return 3;
else if(s=='c') return 2;
else if(s=='x') return 1;
else if(s=='i') return 0;
else return -1;
}
public static String tc(int s){
if(s==3) return "m";
else if(s==2) return "c";
else if(s==1) return "x";
else return "i";
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:42: error: cannot find symbol
ret+=Math.pos(10,i)*dig[i];
^
symbol: method pos(int,int)
location: class Math
Main.java:50: error: cannot find symbol
dig[i]=(int)(a/Math.pos(10,i));
^
symbol: method pos(int,int)
location: class Math
Main.java:51: error: cannot find symbol
a-=dig[i]*Math.pos(10,i);
^
symbol: method pos(int,int)
location: class Math
3 errors
|
s524153732 | p00718 | Java | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
int n=ir.nextInt();
while(n-->0){
int tot=0;
for(int i=0;i<2;i++) tot+=MCXItoNumber(ir.next());
out.println(NumbertoMCXI(tot));
}
}
public static int MCXItoNumber(String s){
int[] dig=new int[4];
Arrays.fill(dig,-1);
int v=-1;
for(int i=s.length()-1;i>=0;i--){
char c=s.charAt(i);
int td=td(c);
if(td==-1) dig[v]=c-'0';
else{
if(v!=-1&&dig[v]==-1) dig[v]=1;
v=td;
}
}
if(v!=-1&&dig[v]==-1) dig[v]=1;
for(int i=0;i<4;i++) if(dig[i]<0) dig[i]=0;
int ret=0;
for(int i=0;i<4;i++){
ret+=Math.pow(10,i)*dig[i];
}
return ret;
}
public static String NumbertoMCXI(int a){
int[] dig=new int[4];
for(int i=3;i>=0;i--){
dig[i]=(int)(a/Math.pow(10,i));
a-=dig[i]*Math.pos(10,i);
}
String ret="";
for(int i=3;i>=0;i--){
if(dig[i]==0) continue;
else if(dig[i]!=1) ret+=Integer.toString(dig[i]);
ret+=tc(i);
}
return ret;
}
public static int td(char s){
if(s=='m') return 3;
else if(s=='c') return 2;
else if(s=='x') return 1;
else if(s=='i') return 0;
else return -1;
}
public static String tc(int s){
if(s==3) return "m";
else if(s==2) return "c";
else if(s==1) return "x";
else return "i";
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | Main.java:51: error: cannot find symbol
a-=dig[i]*Math.pos(10,i);
^
symbol: method pos(int,int)
location: class Math
1 error
|
s975437796 | p00718 | Java | import java.util.*;
public class P1137 {
Scanner sc;
void run() {
sc = new Scanner(System.in);
int n= sc.nextInt();
for (int i=0;i<n;i++) {
String str1 = sc.next();
String str2 = sc.next();
int num = str2Num(str1) + str2Num(str2);
System.out.println(num2Str(num));
}
}
int str2Num(String str) {
int num=0;
int tmp=1;
for (int i=0;i<str.length();i++) {
String a = "" + str.charAt(i);
if (a.compareTo("m")==0) {
num += tmp * 1000;
tmp = 1;
}else if (a.compareTo("c")==0) {
num += tmp * 100;
tmp = 1;
}else if (a.compareTo("x")==0) {
num += tmp * 10;
tmp = 1;
}else if (a.compareTo("i")==0){
num += tmp;
tmp = 1;
}else {
tmp = Integer.parseInt(a);
}
}
return num;
}
int[] ku = {1000,100,10,1};
char[] c = {'m','c','x','i'};
String num2Str(int num) {
String str = "";
for (int i=0;i<4;i++) {
if (num / ku[i] > 0) {
int tmp = num/ku[i];
num = num - tmp*ku[i];
if (tmp != 1) str += tmp;
str += c[i];
}
}
return str;
}
public static void main(String[] args) {
new P1137().run();
}
} | Main.java:2: error: class P1137 is public, should be declared in a file named P1137.java
public class P1137 {
^
1 error
|
s897179508 | p00718 | Java |
import java.io.*;
import java.util.*;
public class ProblemC
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
for (; N-->0; )
{
String x = sc.next(), y = sc.next();
System.out.println(toString(toInt(x) + toInt(y)));
}
}
private static int dd(char c)
{
switch (c)
{
case 'm': return 1000;
case 'c': return 100;
case 'x': return 10;
case 'i': return 1;
}
return 0;
}
private static int toInt(String s)
{
int ret = 0;
for (int i = 0; i < s.length(); )
{
char c = s.charAt(i++);
int n = 1;
if (Character.isDigit(c))
{
n = c - '0';
c = s.charAt(i++);
}
ret += n * dd(c);
}
return ret;
}
private static String toString(int n)
{
int x;
String ret = "";
x = n % 10;
ret = (x == 0 ? "" : (x == 1 ? "i" : x + "i")) + ret;
n /= 10;
x = n % 10;
ret = (x == 0 ? "" : (x == 1 ? "x" : x + "x")) + ret;
n /= 10;
x = n % 10;
ret = (x == 0 ? "" : (x == 1 ? "c" : x + "c")) + ret;
n /= 10;
x = n % 10;
ret = (x == 0 ? "" : (x == 1 ? "m" : x + "m")) + ret;
n /= 10;
return ret;
}
}
/*
10
xi x9i
i 9i
c2x2i 4c8x8i
m2ci 4m7c9x8i
9c9x9i i
i 9m9c9x8i
m i
i m
m9i i
9m8c7xi c2x8i
*/ | Main.java:5: error: class ProblemC is public, should be declared in a file named ProblemC.java
public class ProblemC
^
1 error
|
s967344027 | p00718 | Java | import java.util.Scanner;
public class Main {
Scanner sc;
private int parse( String mcxi ){
boolean isNumEntered = false;
int mk = 0;
int ck = 0;
int xk = 0;
int ik = 0;
int cur = 0;
char[] cstr = mcxi.toCharArray();
for( int i = 0; i < cstr.length; i++ ){
switch( cstr[ i ] ){
case 'm':
mk = cur;
if( !isNumEntered ){ mk = 1; }
isNumEntered = false;
break;
case 'c':
ck = cur;
if( !isNumEntered ){ ck = 1; }
isNumEntered = false;
break;
case 'x':
xk = cur;
if( !isNumEntered ){ xk = 1; }
isNumEntered = false;
break;
case 'i':
ik = cur;
if( !isNumEntered ){ ik = 1; }
isNumEntered = false;
break;
default:
cur = cstr[ i ] - '0';
isNumEntered = true;
break;
}
}
return mk * 1000 + ck * 100 + xk * 10 + ik;
}
private String getMcxi( int in ){
int mk = in / 1000;
in %= 1000;
int ck = in / 100;
in %= 100;
int xk = in / 10;
in %= 10;
int ik = in;
String r = "";
if( mk >= 2 ){ r += mk; }
if( mk >= 1 ){ r += "m"; }
if( ck >= 2 ){ r += ck; }
if( ck >= 1 ){ r += "c"; }
if( xk >= 2 ){ r += xk; }
if( xk >= 1 ){ r += "x"; }
if( ik >= 2 ){ r += ik; }
if( ik >= 1 ){ r += "i"; }
return r;
}
private void run(){
sc = new Scanner( System.in );
int n = sc.nextInt();
for( int i = 0; i < n; i++ ){
System.out.println( getMcxi ( parse( sc.next() ) + parse( sc.next() ) ) );
}
}
public static void main( String[] args ){
new Main().run();
} | Main.java:74: error: reached end of file while parsing
}
^
1 error
|
s652116851 | p00718 | Java | import java.io.*;
import java.util.*;
public class p1136 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
String line;
/* input */
line = br.readLine();
int n = Integer.parseInt(line);
if(n==0) return;
for(int k=0;k<n;k++){
String ex[] = br.readLine().split(" ");
String sum ="";
int m=0,c=0,x=0,i=0;
for(int j=0;j<=1;j++){
int ii = ex[j].indexOf("i");
if(ii>-1){
if(ii==0){
i += 1;
} else {
if(Character.isDigit(ex[j].charAt(ii-1))){
i += Integer.parseInt(ex[j].substring(ii-1,ii));
} else {
i += 1;
}
}
}
if(i>=10){
x += 1;
i -= 10;
}
int xi = ex[j].indexOf("x");
if(xi>-1){
if(xi==0){
x += 1;
if(x>=10){
c += 1;
x -= 10;
}
} else {
if(Character.isDigit(ex[j].charAt(xi-1))){
x += Integer.parseInt(ex[j].substring(xi-1,xi));
} else {
x += 1;
}
}
}
if(x>=10){
c += 1;
x -= 10;
}
int ci = ex[j].indexOf("c");
if(ci>-1){
if(ci==0){
c += 1;
} else {
if(Character.isDigit(ex[j].charAt(ci-1))){
c += Integer.parseInt(ex[j].substring(ci-1,ci));
} else {
c += 1;
}
}
}
if(c>=10){
m += 1;
c -= 10;
}
int mi = ex[j].indexOf("m");
if(mi>-1){
if(mi==0){
m += 1;
} else {
if(Character.isDigit(ex[j].charAt(mi-1))){
m += Integer.parseInt(ex[j].substring(mi-1,mi));
} else {
m += 1;
}
}
}
}
String ms = ((m==0)?"":(m==1)?"m":(m+"m"));
String cs = ((c==0)?"":(c==1)?"c":(c+"c"));
String xs = ((x==0)?"":(x==1)?"x":(x+"x"));
String is = ((i==0)?"":(i==1)?"i":(i+"i"));
sum = ms + cs + xs + is;
System.out.println(sum);
}
} catch (IOException e) {
e.printStackTrace();
}
}
} | Main.java:4: error: class p1136 is public, should be declared in a file named p1136.java
public class p1136 {
^
1 error
|
s688775912 | p00718 | C | #include<stdio.h>
#include<ctype.h>
int main(void)
{
int ans[4]={};
int coef,k,c,formula;
int i,j;
scanf("%d%*c",&k);
for(i=0;i<k;i++)
{
coef=1;
formula=0;
int scale[2][4]={};
while(1)
{
scanf("%c",&c);
if(c==10)
{
break;
}
if(isdigit(c))
{
coef=1;
}
else if(isalpha(c))
{
switch(c)
{
case 'm':
scale[formula][3]+=coef;
break;
case 'c':
scale[formula][2]+=coef;
break;
case 'x':
scale[formula][1]+=coef;
break;
case 'i':
scale[formula][0]+=coef;
break;
default
break;
}
}
else
{
formula=1;
}
}
for(j=3;j>=0;j--)
{
int x=scale[0][j]+scale[1][j];
ans[j]=x%10;
ans[j+1]=x/10;
}
for(j=3;j>=0;j--)
{
if(ans[j]!=0)
{
if(ans[j]==1)
{
switch(j)
{
case 0:
printf("i");
break;
case 1:
printf("x");
break;
case 2:
printf("c");
break;
case 3:
printf("m");
break;
default:
break;
}
}
else
{
switch(j)
{
case 0:
printf("%di",ans[j]);
break;
case 1:
printf("%dx",ans[j]);
break;
case 2:
printf("%dc",ans[j]);
break;
case 3:
printf("%dm",ans[j]);
break;
default:
break;
}
}
}
}
printf("\n");
}
return 0;
} | main.c: In function 'main':
main.c:44:28: error: expected ':' before 'break'
44 | default
| ^
| :
45 | break;
| ~~~~~
|
s118377847 | p00718 | C | #include<stdio.h>
int search(char a[]){
int i,score,box=0;
for(i=0;;i++){
if(a[i]=='\0')break;
switch(a[i]){
case 'm' :if(a[i-1]>='2'&&a[i-1]<='9'&&i!=0)box+=(a[i-1]-'1')*1000;else box+=1000;break;
case 'c' :if(a[i-1]>='2'&&a[i-1]<='9'&&i!=0)box+=(a[i-1]-'1')*100;else box+=100;break;
case 'x' :if(a[i-1]>='2'&&a[i-1]<='9'&&i!=0)box+=(a[i-1]-'1')*10;else box+=10;;break;
case 'i' :if(a[i-1]>='2'&&a[i-1]<='9'&&i!=0)box+=(a[i-1]-'1')*1;else box+=1;;break;
}
}
return box;
}
int main(void){
int n,i,j,flag,box;
char mcxi1[10],mcxi2[10],ans[10];
scanf("%d",&n);
while(n--){
for(i=0;i<10;i++){mcxi1[j]='\0';mcxi2[j]='\0';ans[i]='\0';}
flag=0;
scanf("%s%s",mcxi1,mcxi2);
box=search(mcxi1);
box+=search(mcxi2);
for(i=0;i<10;i++){
if(ans[i]='\0'){
if(box/1000>1)ans[i]='1'+box/1000;ans[i+1]='m';
else if(box/1000>0)ans[i]='m';
else if(box/100>1)ans[i]='1'+box/1000;ans[i+1]='c';
else if(box/100>0)ans[i]='c';
else if(box/10>1)ans[i]='1'+box/1000;ans[i+1]='x';
else if(box/10>0)ans[i]='x';
else if(box/1>1){ans[i]='1'+box/1000;ans[i+1]='i';flag=1;}
else if(box/1>0){ans[i]='i';flag=1;}
}
if(flag==1)break;
}
printf("%s\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:28:33: error: expected '}' before 'else'
28 | else if(box/1000>0)ans[i]='m';
| ^~~~
main.c:30:33: error: 'else' without a previous 'if'
30 | else if(box/100>0)ans[i]='c';
| ^~~~
main.c:32:33: error: 'else' without a previous 'if'
32 | else if(box/10>0)ans[i]='x';
| ^~~~
main.c: At top level:
main.c:40:9: error: expected identifier or '(' before 'return'
40 | return 0;
| ^~~~~~
main.c:41:1: error: expected identifier or '(' before '}' token
41 | }
| ^
|
s715251358 | p00718 | C++ | #include <iostream>
#include <typeinfo>
#include <cstdlib>
#include <string>
using namespace std;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
string str1, str2;
string ans;
cin >> str1 >> str2;
int str_i=0, str_x=0, str_c=0, str_m=0;
char c1[9],c2[9];
strcpy(c1, str1.c_str());
strcpy(c2, str2.c_str());
for(int j=str1.size()-1;j>=0;j--){
if(c1[j]=='m'||c1[j]=='c'||c1[j]=='x'||c1[j]=='i') {
if(j>0){
if(c1[j-1]>='2'&&c1[j-1]<='9'){
if(c1[j]=='i') str_i+=(int)(c1[j-1]-'0');
if(c1[j]=='c') str_c+=(int)(c1[j-1]-'0');
if(c1[j]=='x') str_x+=(int)(c1[j-1]-'0');
if(c1[j]=='m') str_m+=(int)(c1[j-1]-'0');
}else{
if(c1[j]=='i') str_i++;
if(c1[j]=='c') str_c++;
if(c1[j]=='x') str_x++;
if(c1[j]=='m') str_m++;
}
}else{
if(c1[j]=='i') str_i++;
if(c1[j]=='c') str_c++;
if(c1[j]=='x') str_x++;
if(c1[j]=='m') str_m++;
}
}
}
for(int j=str2.size()-1;j>=0;j--){
if(c2[j]=='m'||c2[j]=='c'||c2[j]=='x'||c2[j]=='i') {
if(j>0){
if(c2[j-1]>='2'&&c2[j-1]<='9'){
if(c2[j]=='i') str_i+=(int)(c2[j-1]-'0');
if(c2[j]=='c') str_c+=(int)(c2[j-1]-'0');
if(c2[j]=='x') str_x+=(int)(c2[j-1]-'0');
if(c2[j]=='m') str_m+=(int)(c2[j-1]-'0');
}else{
if(c2[j]=='i') str_i++;
if(c2[j]=='c') str_c++;
if(c2[j]=='x') str_x++;
if(c2[j]=='m') str_m++;
}
}else{
if(c2[j]=='i') str_i++;
if(c2[j]=='c') str_c++;
if(c2[j]=='x') str_x++;
if(c2[j]=='m') str_m++;
}
}
}
if(str_i>=10){
str_i-=10;
str_x++;
}
if(str_x>=10){
str_x-=10;
str_c++;
}
if(str_c>=10){
str_c-=10;
str_m++;
}
if(str_m==1) ans = ans + 'm';
else if(str_m!=0) ans=ans+to_string(str_m)+'m';
if(str_c==1) ans = ans + 'c';
else if(str_c!=0) ans=ans+to_string(str_c)+'c';
if(str_x==1) ans = ans + 'x';
else if(str_x!=0) ans=ans+to_string(str_x)+'x';
if(str_i==1) ans = ans + 'i';
else if(str_i!=0) ans=ans+to_string(str_i)+'i';
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:5: error: 'strcpy' was not declared in this scope
18 | strcpy(c1, str1.c_str());
| ^~~~~~
a.cc:4:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <cstdlib>
+++ |+#include <cstring>
4 | #include <string>
|
s780270248 | p00718 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
bool a[1300000]={0};
a[1]=1;
for(int i=2;i<650001;i++){
if(a[i]==1) continue;
int j=2*i;
while(j<1300000){
a[j]=1;
j=j+i;
}
}
int k
while(cin>>k && k){
int ans;
if(a[k]==0) ans=0;
else{
int l=k+1,m=k-1;
while(a[l]==0) l++;
while(a[m]==0) m--;
ans=l-m;
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:1: error: expected initializer before 'while'
18 | while(cin>>k && k){
| ^~~~~
|
s698851056 | p00718 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
string itos(int n){
int a,b,c,d;
a=n/1000;
n=n%1000;
b=n/100;
n=n%100;
c=n/10;
c=n%10;
d=n;
string s="";
if(a>1) s=s+to_string(a);
if(a>0) s=s+"m";
if(b>1) s=s+to_string(b);
if(b>0) s=s+"c";
if(c>1) s=s+to_string(c);
if(c>0) s=s+"x";
if(d>1) s=s+to_string(d);
if(d>0) s=s+"i";
return s;
}
int stoi(string s){
int l=s.length();
int ans=0,k=1;
for(int i=0;i<l;i++){
if('1'<s[i] && s[i]<='9'){
k=s[i]-'0';
}
else if(s[i]='m'){
ans=ans+k*1000;
k=1;
}
else if(s[i]='c'){
ans=ans+k*100;
k=1;
}
else if(s[i]='x'){
ans=ans+k*10;
k=1;
}
else if(s[i]='i'){
ans=ans+k;
k=1;
}
}
return ans;
}
int main() {
string s,t;
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>s>>t;
int ans=stoi(s)+stoi(t);
cout<<itos(ans)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:74:13: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:74:21: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
s029663517 | p00718 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
string itos(int n){
int a,b,c,d;
a=n/1000;
n=n%1000;
b=n/100;
n=n%100;
c=n/10;
c=n%10;
d=n;
string s="";
if(a>1) s=s+to_string(a);
if(a>0) s=s+"m";
if(b>1) s=s+to_string(b);
if(b>0) s=s+"c";
if(c>1) s=s+to_string(c);
if(c>0) s=s+"x";
if(d>1) s=s+to_string(d);
if(d>0) s=s+"i";
return s;
}
int stoi(string s){
int l=s.length();
int ans=0,k=1;
for(int i=0;i<l;i++){
if('1'<s[i] && s[i]<='9'){
k=s[i]-'0';
}
else if(s[i]='m'){
ans=ans+k*1000;
k=1;
}
else if(s[i]='c'){
ans=ans+k*100;
k=1;
}
else if(s[i]='x'){
ans=ans+k*10;
k=1;
}
else if(s[i]='i'){
ans=ans+k;
k=1;
}
}
return ans;
}
int main() {
string s,t;
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>s>>t;
int ans=stoi(s)+stoi(t);
cout<<itos(ans)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:74:13: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:74:21: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
s975926589 | p00718 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
string itos(int n){
int a,b,c,d;
a=n/1000;
n=n%1000;
b=n/100;
n=n%100;
c=n/10;
c=n%10;
d=n;
string s="";
if(a>1) s=s+to_string(a);
if(a>0) s=s+"m";
if(b>1) s=s+to_string(b);
if(b>0) s=s+"c";
if(c>1) s=s+to_string(c);
if(c>0) s=s+"x";
if(d>1) s=s+to_string(d);
if(d>0) s=s+"i";
return s;
}
int stoi(string s){
int l=s.length();
int ans=0,k=1;
for(int i=0;i<l;i++){
if('1'<s[i] && s[i]<='9'){
k=s[i]-'0';
}
else if(s[i]=='m'){
ans=ans+k*1000;
k=1;
}
else if(s[i]=='c'){
ans=ans+k*100;
k=1;
}
else if(s[i]=='x'){
ans=ans+k*10;
k=1;
}
else if(s[i]=='i'){
ans=ans+k;
k=1;
}
}
return ans;
}
int main() {
string s,t;
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>s>>t;
int ans=stoi(s)+stoi(t);
cout<<itos(ans)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:74:13: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:74:21: error: call of overloaded 'stoi(std::string&)' is ambiguous
74 | int ans=stoi(s)+stoi(t);
| ~~~~^~~
a.cc:30:5: note: candidate: 'int stoi(std::string)'
30 | int stoi(string s){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
s967138682 | p00718 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
void slove(string s, string s1){
int array[5] = {0};//[0]:m [1]:c [2]:x [3]:i
int size = s.size();
int size1 = s1.size();
rep(i, size){
rep(j, 5) printf("%d", array[j]);
printf("\n");
if ('0' <= s[i] && s[i] <= '9'){
if (s[i + 1] == 'm') array[0] += stoi(s[i]);
else if(s[i + 1] == 'c') array[1] += stoi(s[i]);
else if(s[i + 1] == 'x') array[2] += stoi(s[i]);
else if(s[i + 1] == 'i') array[3] += stoi(s[i]);
i++;
}else{
if (s[i] == 'm') array[0]++;
else if(s[i] == 'c') array[1]++;
else if(s[i] == 'x') array[2]++;
else if(s[i] == 'i') array[3]++;
}
}
rep(j, 5) printf("%d", array[j]);
printf("\n");
rep(i, size1){
rep(j, 5) printf("%d", array[j]);
printf("\n");
if ('0' <= s1[i] && s1[i] <= '9'){
if (s1[i + 1] == 'm') array[0] += stoi(s1[i]);
else if(s1[i + 1] == 'c') array[1] += stoi(s1[i]);
else if(s1[i + 1] == 'x') array[2] += stoi(s1[i]);
else if(s1[i + 1] == 'i') array[3] += stoi(s1[i]);
i++;
}else{
if (s[i] == 'm') array[0]++;
else if(s[i] == 'c') array[1]++;
else if(s[i] == 'x') array[2]++;
else if(s[i] == 'i') array[3]++;
}
}
rep(j, 5) printf("%d", array[j]);
printf("\n");
printf("board\n");
rep(i, 5) printf("%d\n", array[i]);
rep(i, 4){
int kai = array[i] / 10;
int amari = array[i] % 10;
array[i] = amari;
array[i + 1] += kai;
}
string ans;
if (array[0] != 0 && array[0] != 1) ans += to_string(array[0]) + 'm';
else if (array[0] == 1) ans += 'm';
if (array[1] != 0 && array[1] != 1) ans += to_string(array[1]) + 'c';
else if (array[1] == 1) ans += 'c';
if (array[2] != 0 && array[2] != 1) ans += to_string(array[2]) + 'x';
else if (array[2] == 1) ans += 'x';
if (array[3] != 0 && array[3] != 1) ans += to_string(array[3]) + 'i';
else if (array[3] == 1) ans += 'i';
cout << ans << endl;
return;
}
int main(void){
int n; cin >> n;
rep(i, n){
string s1, s2;
cin >> s1 >> s2;
slove(s1, s2);
}
return 0;
} | a.cc: In function 'void slove(std::string, std::string)':
a.cc:36:62: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
36 | if (s[i + 1] == 'm') array[0] += stoi(s[i]);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:37:66: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
37 | else if(s[i + 1] == 'c') array[1] += stoi(s[i]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:38:66: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
38 | else if(s[i + 1] == 'x') array[2] += stoi(s[i]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:39:66: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
39 | else if(s[i + 1] == 'i') array[3] += stoi(s[i]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:55:63: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
55 | if (s1[i + 1] == 'm') array[0] += stoi(s1[i]);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:56:67: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
56 | else if(s1[i + 1] == 'c') array[1] += stoi(s1[i]);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:57:67: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
57 | else if(s1[i + 1] == 'x') array[2] += stoi(s1[i]);
| ~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for arg |
s459124691 | p00718 | C++ | #include<iostream>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char mcxi[4] = { 'i','x','c','m' };
int decode(string s);
string encode(int n);
int main() {
int sum, n; cin >> n;
while (n--) {
string s1, s2; cin >> s1 >> s2;
sum = decode(s1) + decode(s2);
cout << encode(sum) << endl;
}
return 0;
}
int decode(string s) {
int sum = 0;
rep(i, s.size()) {
int coe = 1;
if (1 < s[i] - '0'&&s[i] - '0' <= 9) coe = s[i++] - '0';
rep(j, 4) {
if (s[i] == mcxi[j]) {
sum += coe*(int)pow(10.0, j);
break;
}
}
}
return sum;
}
string encode(int n) {
string s;
int tmp;
for (int i = 3; i >= 0; i--) {
tmp = (int)(n / pow(10.0, i));
if (tmp > 1) {
s.push_back(tmp + '0');
s.push_back(mcxi[i]);
n -= (int)(tmp*(pow(10.0, i)));
}
else if (tmp == 1) {
s.push_back(mcxi[i]);
n -= (int)(pow(10.0, i));
}
}
return s;
} | a.cc: In function 'int decode(std::string)':
a.cc:28:49: error: 'pow' was not declared in this scope
28 | sum += coe*(int)pow(10.0, j);
| ^~~
a.cc: In function 'std::string encode(int)':
a.cc:40:33: error: 'pow' was not declared in this scope
40 | tmp = (int)(n / pow(10.0, i));
| ^~~
|
s549519591 | p00718 | C++ | #include<iostream>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char mcxi[4] = { 'i','x','c','m' };
int decode(string s);
string encode(int n);
int main() {
int sum, n; cin >> n;
while (n--) {
string s1, s2; cin >> s1 >> s2;
sum = decode(s1) + decode(s2);
cout << encode(sum) << endl;
}
return 0;
}
int decode(string s) {
int sum = 0;
rep(i, s.size()) {
int coe = 1;
if (1 < s[i] - '0'&&s[i] - '0' <= 9) coe = s[i++] - '0';
rep(j, 4) {
if (s[i] == mcxi[j]) {
sum += coe*(int)pow(10.0, j);
break;
}
}
}
return sum;
}
string encode(int n) {
string s;
int tmp;
for (int i = 3; i >= 0; i--) {
tmp = (int)(n / pow(10.0, i));
if (tmp > 1) {
s.push_back(tmp + '0');
s.push_back(mcxi[i]);
n -= (int)(tmp*(pow(10.0, i)));
}
else if (tmp == 1) {
s.push_back(mcxi[i]);
n -= (int)(pow(10.0, i));
}
}
return s;
} | a.cc: In function 'int decode(std::string)':
a.cc:28:49: error: 'pow' was not declared in this scope
28 | sum += coe*(int)pow(10.0, j);
| ^~~
a.cc: In function 'std::string encode(int)':
a.cc:40:33: error: 'pow' was not declared in this scope
40 | tmp = (int)(n / pow(10.0, i));
| ^~~
|
s275043736 | p00718 | C++ | #include<iostream>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char mcxi[4] = { 'i','x','c','m' };
int decode(string s);
string encode(int n);
int main() {
int sum, n; cin >> n;
while (n--) {
string s1, s2; cin >> s1 >> s2;
sum = decode(s1) + decode(s2);
cout << encode(sum) << endl;
}
return 0;
}
int decode(string s) {
int sum = 0;
rep(i, s.size()) {
int coe = 1;
if (1 < s[i] - '0'&&s[i] - '0' <= 9) coe = s[i++] - '0';
rep(j, 4) {
if (s[i] == mcxi[j]) {
sum += coe*(int)pow(10.0, j);
break;
}
}
}
return sum;
}
string encode(int n) {
string s;
int tmp;
for (int i = 3; i >= 0; i--) {
tmp = (int)(n / pow(10.0, i));
if (tmp > 1) {
s.push_back(tmp + '0');
s.push_back(mcxi[i]);
n -= (int)(tmp*(pow(10.0, i)));
}
else if (tmp == 1) {
s.push_back(mcxi[i]);
n -= (int)(pow(10.0, i));
}
}
return s;
} | a.cc: In function 'int decode(std::string)':
a.cc:28:49: error: 'pow' was not declared in this scope
28 | sum += coe*(int)pow(10.0, j);
| ^~~
a.cc: In function 'std::string encode(int)':
a.cc:40:33: error: 'pow' was not declared in this scope
40 | tmp = (int)(n / pow(10.0, i));
| ^~~
|
s855727181 | p00718 | C++ | #include<iostream>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char mcxi[4] = { 'i','x','c','m' };
int decode(string s);
string encode(int n);
int main() {
int sum, n; cin >> n;
while (n--) {
string s1, s2; cin >> s1 >> s2;
sum = decode(s1) + decode(s2);
cout << encode(sum) << endl;
}
return 0;
}
int decode(string s) {
int sum = 0;
rep(i, (int)s.size()) {
int coe = 1;
if (1 < s[i] - '0'&&s[i] - '0' <= 9) coe = s[i++] - '0';
rep(j, 4) {
if (s[i] == mcxi[j]) {
sum += coe*(int)pow(10.0, j);
break;
}
}
}
return sum;
}
string encode(int n) {
string s;
int tmp;
for (int i = 3; i >= 0; i--) {
tmp = (int)(n / pow(10.0, i));
if (tmp > 1) {
s.push_back(tmp + '0');
s.push_back(mcxi[i]);
n -= (int)(tmp*(pow(10.0, i)));
}
else if (tmp == 1) {
s.push_back(mcxi[i]);
n -= (int)(pow(10.0, i));
}
}
return s;
} | a.cc: In function 'int decode(std::string)':
a.cc:28:49: error: 'pow' was not declared in this scope
28 | sum += coe*(int)pow(10.0, j);
| ^~~
a.cc: In function 'std::string encode(int)':
a.cc:40:33: error: 'pow' was not declared in this scope
40 | tmp = (int)(n / pow(10.0, i));
| ^~~
|
s094077218 | p00718 | C++ | #include<iostream>
#include<string>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
char mcxi[4] = { 'i','x','c','m' };
int decode(string s);
string encode(int n);
int main() {
int sum, n; cin >> n;
while (n--) {
string s1, s2; cin >> s1 >> s2;
sum = decode(s1) + decode(s2);
cout << encode(sum) << endl;
}
return 0;
}
int decode(string s) {
int sum = 0;
rep(i, (int)s.size()) {
int coe = 1;
if (1 < s[i] - '0'&&s[i] - '0' <= 9) coe = s[i++] - '0';
rep(j, 4) {
if (s[i] == mcxi[j]) {
sum += coe*(int)pow(10.0, j);
break;
}
}
}
return sum;
}
string encode(int n) {
string s;
int tmp;
for (int i = 3; i >= 0; i--) {
tmp = (int)(n / pow(10.0, i));
if (tmp > 1) {
s.push_back(tmp + '0');
s.push_back(mcxi[i]);
n -= (int)(tmp*(pow(10.0, i)));
}
else if (tmp == 1) {
s.push_back(mcxi[i]);
n -= (int)(pow(10.0, i));
}
}
return s;
}
Status API Training Shop Blog About
?? 2016 GitHub, Inc. Terms | a.cc:54:1: error: 'Status' does not name a type
54 | Status API Training Shop Blog About
| ^~~~~~
|
s968329139 | p00718 | C++ | #include <string>
#include <iostream>
using namespace std;
void itom(int num){
int a=num/1000;
if(a>1)cout<<a;
if(a>0)cout<<'m';
num%=1000;
a=num/100;
if(a>1)cout<<a;
if(a>0)cout<<'c';
num%=100;
a=num/10;
if(a>1)cout<<a;
if(a>0)cout<<'x';
num%=10;
a=num;
if(a>1)cout<<a;
if(a>0)cout<<'i';
cout<<endl;
}
void mtoi(string s){
int res = 0;
int mul = 1;
for (int i=0; i<s.size(); i++) {
if (s[i] >= '2' && s[i] <= '9') {
mul = (int) s[i] - (int) '0';
} else {
switch (s[i]) {
case 'm':
res += mul * 1000;
break;
case 'c':
res += mul * 100;
break;
case 'x':
res += mul * 10;
break;
default:
res += mul;
}
mul = 1;
}
}
return res;
}
int main() {
int n, i1, i2;
cin >> n;
while (n--) {
string s1, s2;
cin >> s1 >> s2;
i1=mtoi(s1);
i2=mtoi(s2);
itom(i1+i2);
}
return 0;
} | a.cc: In function 'void mtoi(std::string)':
a.cc:52:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
52 | return res;
| ^~~
a.cc: In function 'int main()':
a.cc:62:16: error: void value not ignored as it ought to be
62 | i1=mtoi(s1);
| ~~~~^~~~
a.cc:63:16: error: void value not ignored as it ought to be
63 | i2=mtoi(s2);
| ~~~~^~~~
|
s515282034 | p00718 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define ENDL endl
using namespace std;
int n;
string A, B;
int f(char c) {
if (c == 'm')
return 1000;
if (c == 'c')
return 100;
if (c == 'x')
return 10;
return 1;
}
int main() {
cin >> n;
for (int Q = 0; Q < n;Q++){
cin>>A>>B;
A = 1 + A;
B = 1 + B;
rep(i, A.size()) if (A[i] == 'm' || A[i] == 'c' || A[i] == 'x' ||
A[i] == 'i') if (A[i - 1] != 'm' && A[i - 1] =
'c' && A[i - 1] != 'x' &&
A[i - 1] != 'i') a +=
(A[i - 1] - '0')f(A[i]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:11: error: no match for 'operator+' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
21 | A = 1 + A;
| ~ ^ ~
| | |
| int std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
21 | A = 1 + A;
| ^
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const _CharT*' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: deduced conflicting types for parameter '_CharT' ('int' and 'char')
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const _CharT*' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: deduced conflicting types for parameter '_CharT' ('int' and 'char')
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | A = 1 + A;
| ^
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)'
340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::complex<_Tp>' and 'int'
21 | A = 1 + A;
| ^
/usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)'
349 | operator+(const complex<_Tp>& __x, const _Tp& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:349:5: note: template argument deduction/substitution failed:
a.cc:21:13: note: mismatched types 'const std::complex<_Tp>' and 'int'
21 | A = 1 + A |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.