Submission #474662

# Submission time Handle Problem Language Result Execution time Memory
474662 2021-09-19T09:58:51 Z HossamHero7 Sateliti (COCI20_satellti) C++14
0 / 110
3 ms 332 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++){
        vector <string> v2;
        v2 = v;
        for(int i=0;i<n;i++){
            v2[(i+shifI)%n] = v[i];
        }
        int idx = 0;
        for(int i=0;i<m;i++){
            if(v2[0][i] == '*'){
                idx = i;
                break;
            }
        }
        int shifJ = m-idx;
        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 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -