Submission #289439

# Submission time Handle Problem Language Result Execution time Memory
289439 2020-09-02T16:30:47 Z arnold518 None (JOI12_rotate) C++14
10 / 100
2000 ms 7416 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2000;

struct Query
{
	int y, x, s;
};

int N, Q;
char S[MAXN+10][MAXN+10];
Query A[MAXN+10];

char T[MAXN+10][MAXN+10], T2[MAXN+10][MAXN+10];

void rotate(int s)
{
	for(int i=1; i<=s; i++) for(int j=1; j<=s; j++)
	{
		T2[s-j+1][i]=T[i][j];
	}
}

int main()
{
	int i, j;

	scanf("%d%d", &N, &Q);
	for(int i=1; i<=N; i++) scanf("%s", S[i]+1);

	for(int i=1; i<=Q; i++) scanf("%d%d%d", &A[i].y, &A[i].x, &A[i].s);

	for(int i=1; i<=Q; i++)
	{
		int y=A[i].y, x=A[i].x, s=A[i].s;
		for(int p=1; p<=s; p++) for(int q=1; q<=s; q++) T[p][q]=S[p+y-1][q+x-1];
		rotate(s);
		for(int p=1; p<=s; p++) for(int q=1; q<=s; q++) S[p+y-1][q+x-1]=T2[p][q];
	}
	for(int i=1; i<=N; i++)
	{
		for(int j=1; j<=N; j++) printf("%c", S[i][j]);
		printf("\n");
	}
}

Compilation message

rotate.cpp: In function 'int main()':
rotate.cpp:31:6: warning: unused variable 'i' [-Wunused-variable]
   31 |  int i, j;
      |      ^
rotate.cpp:31:9: warning: unused variable 'j' [-Wunused-variable]
   31 |  int i, j;
      |         ^
rotate.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   33 |  scanf("%d%d", &N, &Q);
      |  ~~~~~^~~~~~~~~~~~~~~~
rotate.cpp:34:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |  for(int i=1; i<=N; i++) scanf("%s", S[i]+1);
      |                          ~~~~~^~~~~~~~~~~~~~
rotate.cpp:36:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   36 |  for(int i=1; i<=Q; i++) scanf("%d%d%d", &A[i].y, &A[i].x, &A[i].s);
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 896 KB Output is correct
2 Correct 4 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2078 ms 7288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2083 ms 7288 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 7272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2082 ms 7416 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2084 ms 7292 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2076 ms 7292 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2089 ms 7288 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2045 ms 7288 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 7300 KB Time limit exceeded