#include <bits/stdc++.h>
using namespace std;
struct point
{
double x, y;
point operator + (point a) { return point( x + a.x , y + a.y ); }
bool operator != (point a) { return ( x != a.x ) || ( y != a.y ); }
bool operator == (point a) { return ( x == a.x ) && ( y == a.y ); }
point(double x, double y) : x(x), y(y) {}
};
int globalInd;
vector< point > S;
vector< point > T;
vector< point > readPolygon()
{
int sz;
scanf("%d",&sz);
vector< point > ans;
for(int i = 1 ; i <= sz ; i++)
{
double x, y;
scanf("%lf %lf",&x,&y);
ans.push_back( point( x , y ) );
}
return ans;
}
void printPolygon(vector< point > v)
{
printf("%d ",(int) v.size());
for(int i = 0 ; i < (int) v.size() ; i++)
printf("%.12f %.12f ",v[i].x,v[i].y);
printf("\n");
}
void tape(vector<int> ind)
{
globalInd++;
printf("tape\n");
printf("%d ",(int) ind.size());
for(int i = 0 ; i < (int) ind.size() ; i++)
printf("%d ",ind[i]);
printf("\n");
}
void scissors(int k, int qtd)
{
printf("scissors\n");
printf("%d %d\n",k,qtd);
}
void transform(vector<point> s, vector<point> t, int& curInd)
{
if( s[0] != t[0] )
{
tape( vector<int>( 1 , curInd ) );
double dx = t[0].x - s[0].x;
double dy = t[0].y - s[0].y;
point d( dx , dy );
for(int i = 0 ; i < s.size() ; i++)
s[i] = s[i] + d;
printPolygon( s );
curInd = globalInd;
}
if( s[2] == t[2] ) return;
scissors( curInd , 2 );
vector< point > up;
vector< point > down;
vector< point > equal;
int minX = min( s[2].x , t[2].x );
int maxX = max( s[2].x , t[2].x );
int minY = min( s[2].y , t[2].y );
int maxY = max( s[2].y , t[2].y );
equal.push_back( s[0] );
equal.push_back( point( minX , s[0].y ) );
equal.push_back( point( minX , minY ) );
equal.push_back( point( s[0].x , minY ) );
printPolygon( equal );
int indEqual = ++globalInd;
up.push_back( point( s[0].x , minY ) );
up.push_back( point( minX , minY ) );
up.push_back( point( minX , maxY ) );
up.push_back( point( s[0].x , maxY ) );
down.push_back( point( minX , s[0].y ) );
down.push_back( point( maxX , s[0].y ) );
down.push_back( point( maxX , minY ) );
down.push_back( point( minX , minY ) );
vector< point > newS = up;
vector< point > newT = down;
if( s[2].x > t[2].x ) swap( newS , newT );
printPolygon( newS );
int indNewS = ++globalInd;
transform( newS , newT , indNewS );
vector< int > aux;
aux.push_back( indEqual );
aux.push_back( indNewS );
tape( aux );
printPolygon( equal );
printPolygon( newT );
curInd = globalInd;
}
int main()
{
S = readPolygon();
T = readPolygon();
int ind = 0;
transform( S , T , ind );
}
Compilation message
scissors.cpp: In function 'void transform(std::vector<point>, std::vector<point>, int&)':
scissors.cpp:81:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < s.size() ; i++)
~~^~~~~~~~~~
scissors.cpp: In function 'std::vector<point> readPolygon()':
scissors.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&sz);
~~~~~^~~~~~~~~~
scissors.cpp:32:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lf %lf",&x,&y);
~~~~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1085 ms |
84304 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1098 ms |
101604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Expected integer, but "scissors" found |
2 |
Halted |
0 ms |
0 KB |
- |