Submission #19632283


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
int X[202020],Y[202020];
int M;
ll DY[3][202020],DX[3][202020];
int Q;
ll XX,YY;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>X[i]>>Y[i];
	cin>>M;
	DX[1][0]=1;
	DY[2][0]=1;
	FOR(i,M) {
		cin>>j;
		if(j==1) {
			FOR(j,3) {
				DY[j][i+1]=-DX[j][i];
				DX[j][i+1]=DY[j][i];
			}
		}
		else if(j==2) {
			FOR(j,3) {
				DY[j][i+1]=DX[j][i];
				DX[j][i+1]=-DY[j][i];
			}
		}
		else if(j==3) {
			cin>>x;
			FOR(j,3) {
				DY[j][i+1]=DY[j][i];
				DX[j][i+1]=2*x-DX[j][i];
			}
		}
		else if(j==4) {
			cin>>x;
			FOR(j,3) {
				DY[j][i+1]=2*x-DY[j][i];
				DX[j][i+1]=DX[j][i];
			}
		}
	}
	
	cin>>Q;
	while(Q--) {
		cin>>x>>y;
		y--;
		XX=DX[0][x]+(DX[1][x]-DX[0][x])*X[y]+(DX[2][x]-DX[0][x])*Y[y];
		YY=DY[0][x]+(DY[1][x]-DY[0][x])*X[y]+(DY[2][x]-DY[0][x])*Y[y];
		cout<<XX<<" "<<YY<<endl;
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}

Submission Info

Submission Time
Task E - Rotate and Flip
User kmjp
Language C++ (GCC 9.2.1)
Score 500
Code Size 1706 Byte
Status AC
Exec Time 414 ms
Memory 16720 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:23:10: warning: unused variable ‘k’ [-Wunused-variable]
   23 |  int i,j,k,l,r,x,y; string s;
      |          ^
./Main.cpp:23:12: warning: unused variable ‘l’ [-Wunused-variable]
   23 |  int i,j,k,l,r,x,y; string s;
      |            ^
./Main.cpp:23:14: warning: unused variable ‘r’ [-Wunused-variable]
   23 |  int i,j,k,l,r,x,y; string s;
      |              ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:6:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    6 | #define FOR(x,to) for(x=0;x<(to);x++)
      |                            ^
./Main.cpp:74:38: note: in expansion of macro ‘FOR’
   74 |  FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
      |                                      ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All max_01.txt, max_02.txt, max_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
max_01.txt AC 399 ms 16568 KB
max_02.txt AC 377 ms 16604 KB
max_03.txt AC 43 ms 13020 KB
random_01.txt AC 7 ms 3556 KB
random_02.txt AC 3 ms 3680 KB
random_03.txt AC 2 ms 3544 KB
random_04.txt AC 2 ms 3552 KB
random_05.txt AC 2 ms 3540 KB
random_06.txt AC 3 ms 3492 KB
random_07.txt AC 2 ms 3684 KB
random_08.txt AC 3 ms 3660 KB
random_09.txt AC 3 ms 3684 KB
random_10.txt AC 2 ms 3608 KB
random_11.txt AC 2 ms 3588 KB
random_12.txt AC 2 ms 3676 KB
random_13.txt AC 2 ms 3532 KB
random_14.txt AC 2 ms 3652 KB
random_15.txt AC 2 ms 3656 KB
random_16.txt AC 11 ms 3656 KB
random_17.txt AC 2 ms 3588 KB
random_18.txt AC 2 ms 3652 KB
random_19.txt AC 2 ms 3684 KB
random_20.txt AC 2 ms 3496 KB
random_21.txt AC 204 ms 9084 KB
random_22.txt AC 410 ms 16720 KB
random_23.txt AC 414 ms 16628 KB
sample_01.txt AC 7 ms 3528 KB
sample_02.txt AC 3 ms 3648 KB