Submission #289439

#TimeUsernameProblemLanguageResultExecution timeMemory
289439arnold518회전 (JOI12_rotate)C++14
10 / 100
2089 ms7416 KiB
#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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...