# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289439 | arnold518 | 회전 (JOI12_rotate) | C++14 | 2089 ms | 7416 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |