Submission #1266683

#TimeUsernameProblemLanguageResultExecution timeMemory
1266683InvMOD회전 (JOI12_rotate)C++17
100 / 100
993 ms2424 KiB
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define eb emplace_back #define vi vector<int> #define pi pair<int,int> #define sz(v) (int)(v).size() #define all(v) (v).begin(), (v).end() #define compact(v) (v).erase(unique(all(v)), (v).end()) template<class T> using upq = priority_queue<T, vector<T>, greater<T>>; template<class T> int lwrbound(const vector<T>& a, const T& b, const int s = 0){return int(lower_bound(s + all(a), b) - a.begin());} template<class T> int uprbound(const vector<T>& a, const T& b, const int s = 0){return int(upper_bound(s + all(a), b) - a.begin());} #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define ROF(i, a, b) for(int i = (a); i >= (b); i--) #define sumof(x) accumulate(all(x), 0ll) #define dbg(x) "[" << #x " = " << (x) << "]" #define el "\n" using ll = long long; using ld = long double; template<class T> bool ckmx(T& a, const T b){return (a < b ? a = b, true : false);} template<class T> bool ckmn(T& a, const T b){return (a > b ? a = b, true : false);} const int N = 1e3; char a[N][N]; void Main() { int n, q; cin >> n >> q; FOR(i, 0, n - 1){ FOR(j, 0, n - 1){ cin >> a[i][j]; } } while(q--){ int ik, jk, sk; cin >> ik >> jk >> sk; --ik, --jk; FOR(i, 0, (sk - 1 - (sk & 1)) / 2){ FOR(j, 0, (sk - 1) / 2){ int c = (sk - 1 - i), d = (sk - 1 - j); swap(a[ik + (i)][jk + (j)], a[ik + (j)][jk + c]); swap(a[ik + (j)][jk + c], a[ik + c][jk + d]); swap(a[ik + c][jk + d], a[ik + d][jk + (i)]); } } } FOR(i, 0, n - 1){ FOR(j, 0, n - 1){ cout << a[i][j]; } cout << el; } } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define name "InvMOD" if(fopen(name".INP", "r")){ freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout); } int t = 1; while(t--) Main(); return 0; }

Compilation message (stderr)

rotate.cpp: In function 'int32_t main()':
rotate.cpp:74:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |         freopen(name".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
rotate.cpp:75:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |         freopen(name".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...