#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()
// input
template<class T> void IN(T& x) {cin >> x;}
template<class H, class... T> void IN(H& h, T&... t) {IN(h); IN(t...); }
// output
template<class T1, class T2> void OUT(const pair<T1,T2>& x);
template<class T> void OUT(const complex<T>& x);
template<class T> void OUT(const vector<T>& x);
template<class T> void OUT(const T& x) {cout << x;}
template<class H, class... T> void OUT(const H& h, const T&... t) {OUT(h); OUT(t...); }
template<class... T> void OUTL(const T&... t) {OUT(t..., "\n"); }
template<class H> void OUTLS(const H& h) {OUTL(h); }
template<class H, class... T> void OUTLS(const H& h, const T&... t) {OUT(h,' '); OUTLS(t...); }
template<class T1, class T2> void OUT(const pair<T1,T2>& x) {OUT(x.fi,' ',x.se);}
template<class T> void OUT(const complex<T>& x) {OUT(x.real(),' ',x.imag());}
template<class T> void OUT(const vector<T>& x) { RE(i,x.sz) OUT(i==0?"":" ", x[i]); }
//===================//
// Added libraries //
//===================//
//===================//
//end added libraries//
//===================//
void program();
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
program();
}
//===================//
// begin program //
//===================//
const int MX = 5e5;
typedef complex<double> Vec;
typedef vector<Vec> Shape;
Shape res;
Shape shapes[MX];
int n;
void read(Shape& s) {
int n;
IN(n);
s.resize(n);
RE(i,n) {
double x, y;
IN(x,y);
s[i] = {x,y};
}
}
void print(const Shape& s) {
OUTLS(s.sz,s);
}
int moveShape(int s, const Shape& bg, const Shape& target) {
OUTL("tape");
OUTLS(1,s);
print(bg);
print(target);
shapes[n] = target;
return n++;
}
int moveShape(int s, const Shape& target) {
return moveShape(s,target,target);
}
int rectToRect(int s, const Shape& t) {
Shape& S = shapes[s];
double xs=abs(S[0]-S[1]);
double ys=abs(S[1]-S[2]);
if(ys > xs) {
swap(xs, ys);
s = moveShape(s,{{{xs,0},{xs,ys},{0,ys},{0,0}}}, {{{0,0},{xs,0},{xs,ys},{0,ys}}});
} else {
s = moveShape(s,{{{0,0},{xs,0},{xs,ys},{0,ys}}});
}
double xt=abs(t[0]-t[1]);
double yt=abs(t[1]-t[2]);
if(yt < xt) swap(xt, yt);
while(xs >= xt*2.0) {
int a=n, b=n+1, c=n+2;
xs /= 2.0;
shapes[n++] = {{0,0},{xs,0},{xs,ys},{0,ys}};
shapes[n++] = {{xs,0},{2.0*xs,0},{2.0*xs,ys},{xs,ys}};
OUTL("scissors");
OUTLS(s,2);
print(shapes[a]);
print(shapes[b]);
shapes[b] = {{xs,ys},{2.0*xs,ys},{2.0*xs,2.0*ys},{xs,2.0*ys}};
ys *= 2.0;
shapes[n++] = {{0,0},{xs,0},{xs,ys},{0,ys}};
OUTL("tape");
OUTLS(2,a,b);
print(shapes[a]);
print(shapes[b]);
print(shapes[c]);
s = c;
}
double x = xs-xt;
double y = yt-ys;
int a=n, b=n+1, c=n+2, d=n+3; n+=4;
shapes[a] = {{0,0},{xt,0},{xt,y},{x,ys},{0,ys}};
shapes[b] = {{xt,0},{xs,0},{xt,y}};
shapes[c] = {{xs,0},{xs,ys},{x,ys}};
OUTL("scissors");
OUTLS(s,3);
print(shapes[a]);
print(shapes[b]);
print(shapes[c]);
shapes[b] = {{0,ys},{x,ys},{0,yt}};
shapes[c] = {{xt,y},{xt,yt},{0,yt}};
shapes[d] = {{0,0},{xt,0},{xt,yt},{0,yt}};
OUTL("tape");
OUTLS(3,a,b,c);
print(shapes[a]);
print(shapes[b]);
print(shapes[c]);
print(shapes[d]);
return d;
}
void program() {
read(shapes[n++]);
read(res);
int r = rectToRect(0,res);
moveShape(r,res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '12.000000', should be '24.000000', error '0.500000' (allowed 0.001000) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
12032 KB |
used 50 vertices, largest error was 0.00000000957500 |
2 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '26791199.919626', should be '53582400.000000', error '0.500000' (allowed 0.001000) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '12.000000', should be '24.000000', error '0.500000' (allowed 0.001000) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 1 (tape), polygon 0: Equivalent polygons must have same number of vertices (3 != 4) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
12032 KB |
Operation 1 (tape), polygon 0: Equivalent polygons must have same number of vertices (3 != 4) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '12.000000', should be '24.000000', error '0.500000' (allowed 0.001000) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '12.000000', should be '24.000000', error '0.500000' (allowed 0.001000) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
12032 KB |
Operation 3: Intersection of the big shape and the shape set is '12.000000', should be '24.000000', error '0.500000' (allowed 0.001000) |
2 |
Halted |
0 ms |
0 KB |
- |