#include<bits/stdc++.h>
using namespace std;
#define Point complex<int>
#define pii pair<int, int>
struct Polygon{
int id;
Point dims;
Point pos;
Polygon(Point p){
dims = p;
}
void display(){
cout<<4<<" ";
cout<<pos.real()<<" "<<pos.imag()<<" ";
cout<<dims.real()+pos.real()<<" "<<pos.imag()<<" ";
cout<<dims.real()+pos.real()<<" "<<dims.imag()+pos.imag()<<" ";
cout<<pos.real()<<" "<<dims.imag()+pos.imag()<<endl;
}
};
vector<Polygon> polygons;
Polygon get_rem(Polygon cur, Polygon target){
Polygon res(0);
if(cur.dims.imag() == target.dims.imag()){
res.dims = Point(cur.dims.real()- target.dims.real(), cur.dims.imag());
res.pos = Point(target.dims.real(), 0);
}
if(cur.dims.real() == target.dims.real()){
res.dims = Point(cur.dims.real(), cur.dims.imag()-target.dims.imag());
res.pos = Point(0, target.dims.imag());
}
return res;
}
Polygon get_rem(int curid, Polygon target){
Polygon cur = polygons[curid];
return get_rem(cur, target);
}
void cut_out(int cur_id, Polygon target){
Polygon rem = get_rem(cur_id, target);
cout<<"scissors"<<endl;
cout<<cur_id<<" "<<2<<endl;
target.display();
polygons.push_back(target);
rem.display();
polygons.push_back(rem);
}
int normalyse(int cur){
cout<<"tape"<<endl;
cout<<1<<" "<<cur<<endl;
Polygon cur_poly = polygons[cur];
cur_poly.pos= 0;
cur_poly.display();
polygons.push_back(cur_poly);
return polygons.size()-1;
}
int merge_into(int mid_id, int other_part, Polygon target){
Polygon rem = get_rem(target, polygons[mid_id]);
cout<<"tape"<<endl;
cout<<2<<" "<<mid_id<<" "<<other_part<<endl;
polygons[mid_id].display();
rem.display();
polygons.push_back(target);
return polygons.size()-1;
}
int turn_into(int cur, Polygon target){
Polygon a = polygons[cur];
if(a.dims == target.dims){
return cur;
}
Polygon mid(Point(min(a.dims.real(), target.dims.real()), min(target.dims.imag(), a.dims.imag())));
cut_out(cur, mid);
int mid_id = polygons.size()-2;
int cur_part= polygons.size()-1;
int target_part = turn_into(normalyse(cur_part), get_rem(target, mid));
return merge_into(mid_id, target_part, target);
}
signed main(){
vector<Polygon> v(2, Polygon(2));
for(int i = 0; i<2; i++){
int a;
cin>>a;
for(int j = 0; j<a; j++){
int x, y;
cin>>x>>y;
if(x!=0 && y!=0){
v[i].dims = Point(x, y);
}
}
}
polygons.push_back(v[0]);
turn_into(0, v[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1059 ms |
47500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1030 ms |
43944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |