Submission #474659

# Submission time Handle Problem Language Result Execution time Memory
474659 2021-09-19T09:48:15 Z HossamHero7 Sateliti (COCI20_satellti) C++14
10 / 110
3000 ms 588 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
    int n,m;
    cin>>n>>m;
    vector <string> v(n);
    for(auto &i:v) cin>>i;
    vector <string> ans;
    for(int shifI=0;shifI<=n*2;shifI++){
        for(int shifJ=0;shifJ<=m*2;shifJ++){
            vector <string> v2;
            v2 = v;
            for(int i=0;i<n;i++){
                v2[(i+shifI)%n] = v[i];
            }
            for(int i=0;i<n;i++){
                string temp = v[i];
                for(int j=0;j<m;j++){
                    temp[(j+shifJ)%m] = v2[i][j];
                }
                v2[i] = temp;
            }
            if(ans.size() == 0 || v2<ans) ans = v2;
        }
    }
    for(auto i : ans){
        cout<<i<<endl;
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 237 ms 308 KB Output is correct
2 Correct 191 ms 308 KB Output is correct
3 Correct 197 ms 204 KB Output is correct
4 Correct 199 ms 204 KB Output is correct
5 Correct 200 ms 312 KB Output is correct
6 Correct 197 ms 312 KB Output is correct
7 Correct 202 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 237 ms 308 KB Output is correct
2 Correct 191 ms 308 KB Output is correct
3 Correct 197 ms 204 KB Output is correct
4 Correct 199 ms 204 KB Output is correct
5 Correct 200 ms 312 KB Output is correct
6 Correct 197 ms 312 KB Output is correct
7 Correct 202 ms 332 KB Output is correct
8 Execution timed out 3078 ms 588 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 237 ms 308 KB Output is correct
2 Correct 191 ms 308 KB Output is correct
3 Correct 197 ms 204 KB Output is correct
4 Correct 199 ms 204 KB Output is correct
5 Correct 200 ms 312 KB Output is correct
6 Correct 197 ms 312 KB Output is correct
7 Correct 202 ms 332 KB Output is correct
8 Execution timed out 3078 ms 588 KB Time limit exceeded
9 Halted 0 ms 0 KB -