Submission #1089799

#TimeUsernameProblemLanguageResultExecution timeMemory
1089799SalihSahinSateliti (COCI20_satellti)C++14
0 / 110
1 ms348 KiB
#include<bits/stdc++.h> #define pb push_back #define int long long using namespace std; const int mod = 1e9 + 7; const int inf = 1e9; const int N = 2048; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin>>n>>m; vector<vector<char> > a(n, vector<char>(m)); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin>>a[i][j]; } } vector<int> colp(m), rowp(n); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ colp[j] += (a[i][j] == '*'); rowp[i] += (a[i][j] == '*'); } } vector<pair<vector<int>, int> > bestrow(n), bestcol(m); int bestr = 0, bestc = 0; for(int i = 0; i < n; i++){ vector<int> cand; for(int j = i; j < i + n; j++){ cand.pb(rowp[j%n]); } bestrow[i] = {cand, i}; } for(int i = 0; i < m; i++){ vector<int> cand; for(int j = i; j < i + m; j++){ cand.pb(colp[j%m]); } bestcol[i] = {cand, i}; } sort(bestrow.rbegin(), bestrow.rend()); sort(bestcol.rbegin(), bestcol.rend()); bestr = bestrow[0].second; bestc = bestcol[0].second; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ cout<<a[(i + bestr)%n][(j + bestc)%m]; } cout<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...