Submission #45599479
Source Code Expand
#ifdef LOGX
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define unless(x) if(!(x))
#define until(x) while(!(x))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define mybit(i,j) (((i)>>(j))&1)
/*---------type/const---------*/
constexpr int big=1000000007;
//constexpr int big=998244353;
constexpr double EPS=1e-8; //適宜変える
typedef long long ll;
typedef unsigned long long ull;
typedef std::string::const_iterator state; //構文解析
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr char newl='\n';
struct{
constexpr operator int(){return -int(1e9)-10;}
constexpr operator ll(){return -ll(1e18)-10;}
}neginf;
struct{
constexpr operator int(){return int(1e9)+10;}
constexpr operator ll(){return ll(1e18)+10;}
constexpr auto operator -(){return neginf;}
}inf;
/*---------debug---------*/
#ifdef LOGX
#include <template/debug.hpp>
#else
#define dbg(...) ;
#define dbgnewl ;
#define prt(x) ;
#define _prt(x) ;
#endif
/*---------function---------*/
template<typename T> T max(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=max(ans,elem);}return ans;}
template<typename T> T min(const std::vector<T> &a){T ans=a[0];for(T elem:a){ans=min(ans,elem);}return ans;}
template<typename T,typename U> bool chmin(T &a,const U b){if(a>b){a=b;return true;}return false;}
template<typename T,typename U> bool chmax(T &a,const U b){if(a<b){a=b;return true;}return false;}
bool valid(int i,int j,int h,int w){return (i>=0 && j>=0 && i<h && j<w);}
template<class T,class U>T expm(T x,U y,const ll mod=big){T res=1;while(y){if(y&1)(res*=x)%=mod;(x*=x)%=mod;y>>=1;}return res;}
template<class T,class U>T exp(T x,U y){T res=1;while(y){if(y&1)res*=x;x*=x;y>>=1;}return res;}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout << std::fixed << std::setprecision(10);
/*------------------------------------*/
int m;
cin >> m;
string a,b,c;
cin >> a >> b >> c;
int ans=4*m;
rep(s,3*m)rep(t,3*m)if(s!=t)rep(u,3*m)if(s!=u && t!=u){
if(a[s%m]==b[t%m] && b[t%m]==c[u%m])chmin(ans,max(s,max(t,u)));
}
if(ans==4*m)cout << -1 << newl;
else cout << ans << newl;
}
Submission Info
| Submission Time |
|
| Task |
C - Slot Strategy 2 (Easy) |
| User |
logx |
| Language |
C++ 20 (gcc 12.2) |
| Score |
300 |
| Code Size |
2504 Byte |
| Status |
AC |
| Exec Time |
98 ms |
| Memory |
3608 KiB |
Compile Error
Main.cpp:36:2: warning: ‘inf’ defined but not used [-Wunused-variable]
36 | }inf;
| ^~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
300 / 300 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
| All |
random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name |
Status |
Exec Time |
Memory |
| random_01.txt |
AC |
98 ms |
3452 KiB |
| random_02.txt |
AC |
1 ms |
3600 KiB |
| random_03.txt |
AC |
98 ms |
3476 KiB |
| random_04.txt |
AC |
1 ms |
3388 KiB |
| random_05.txt |
AC |
98 ms |
3476 KiB |
| random_06.txt |
AC |
3 ms |
3436 KiB |
| random_07.txt |
AC |
1 ms |
3472 KiB |
| random_08.txt |
AC |
1 ms |
3412 KiB |
| random_09.txt |
AC |
93 ms |
3608 KiB |
| random_10.txt |
AC |
93 ms |
3320 KiB |
| random_11.txt |
AC |
93 ms |
3460 KiB |
| random_12.txt |
AC |
93 ms |
3380 KiB |
| random_13.txt |
AC |
93 ms |
3608 KiB |
| random_14.txt |
AC |
93 ms |
3436 KiB |
| random_15.txt |
AC |
93 ms |
3316 KiB |
| random_16.txt |
AC |
93 ms |
3524 KiB |
| random_17.txt |
AC |
1 ms |
3452 KiB |
| random_18.txt |
AC |
1 ms |
3512 KiB |
| random_19.txt |
AC |
1 ms |
3432 KiB |
| random_20.txt |
AC |
1 ms |
3432 KiB |
| random_21.txt |
AC |
1 ms |
3460 KiB |
| random_22.txt |
AC |
1 ms |
3512 KiB |
| random_23.txt |
AC |
1 ms |
3596 KiB |
| sample_01.txt |
AC |
1 ms |
3320 KiB |
| sample_02.txt |
AC |
1 ms |
3408 KiB |
| sample_03.txt |
AC |
1 ms |
3524 KiB |