제출 #1191402

#제출 시각아이디문제언어결과실행 시간메모리
1191402SmuggingSpunSateliti (COCI20_satellti)C++20
10 / 110
12 ms328 KiB
#include<bits/stdc++.h>
#define taskname "C"
using namespace std;
template<class T>void minimize(T& a, T b){
	if(a > b){
		a = b;
	}
}
int n, m;
namespace sub1{
	void solve(){
		vector<string>a(n);
		for(string& s : a){
			cin >> s;
		}		
		vector<string>ans = a;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++){
				vector<string>b;
				for(int k = i; k < n; k++){
					b.emplace_back(a[k].substr(j, m - j) + a[k].substr(0, j));
				}
				for(int k = 0; k < i; k++){
					b.emplace_back(a[k].substr(j, m - j) + a[k].substr(0, j));
				}
				minimize(ans, b);
			}
		}
		for(string& s : ans){
			cout << s << "\n";
		}
	}
}
namespace sub23{
	int min_cyclic(vector<int>a){
		for(int n = a.size(), i = 0; i < n; i++){
			a.emplace_back(a[i]);
		}	
		int n = a.size(), i = 0, ans = 0;
		while(i < (n >> 1)){
			int j = (ans = i) + 1, k = i;
			while(j < n && a[k] <= a[i]){
				if(a[j] == a[k]){
					k++;
				}
				else{
					k = i;
				}
				j++;
			}
			while(i <= k){
				i += j - k;
			}
		}
		return ans;
	}
	void solve(){
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	cin >> n >> m;
	if(max(n, m) <= 50){
		sub1::solve();
	}
	else{
		sub23::solve();
	}
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:63:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...