Submission #2179169


Source Code Expand

//#pragma GCC optimize ("O3")
//#pragma GCC target ("tune=native")
//#pragma GCC target ("avx")
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ull,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);

#define N 3000
#define M 7
#define Q 30000
mt19937_64 rng;
random_device seed_gen;
ll aa = 17;

ll n, m, q;

void init();
void input();
void solve();

int main(){
	init();
	input();
	solve();
	return 0;
}

void init(){
	rng = mt19937_64(123457);
}
void input(){
	scanf("%d%d%d",&n,&m,&q);
}
void solve(){
	uniform_int_distribution<> alph(0, 12);
	string s("");
	vector<int> y;
	rep(i, n/6){
		y.pb(alph(rng));
		if(i>0){
			while(y[i]==y[i-1]) y[i] = alph(rng);
		}
		rep(j, 6) s += (char)('a'+y.back()*2+(j/3));
	}
	printf("%s\n", s.c_str()); fflush(stdout);
	printf("2.68\n"); fflush(stdout);
	//cerr<<s<<endl;
	//cerr<<y<<endl;
	s += s;
	y.insert(y.end(), all(y));
	vector<int> res(q);
	rep(query, q){
		string t;
		cin>>t;
		vector<int> x(m);
		rep(i, m) x[i] = (t[i]-'a')/2;
		rep(i, n/6){
			int p = 0;
			int j = i;
			while(p<m){
				if(x[p]!=y[j]) break;
				while(p<m&&x[p]==y[j]) p++;
				j++;
			}
			if(p!=m) continue;
			res[query] = i*6;
			//if(x[0]==x[1]) res[query] -= 1;
			break;
		}
		if((t[0]-'a')%2) res[query]+=3;
		//cerr<<res[query]<<endl;
	}
	rep(query, q){
		printf("%d\n", (res[query]+n*n)%n);
		fflush(stdout);
	}
}

Submission Info

Submission Time
Task B - くるくる寿司
User Lepton
Language C++14 (GCC 5.4.1)
Score 320549
Code Size 2981 Byte
Status AC
Exec Time 90 ms
Memory 980 KiB

Compile Error

./Main.cpp: In function ‘void input()’:
./Main.cpp:84:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘ll* {aka long long int*}’ [-Wformat=]
  scanf("%d%d%d",&n,&m,&q);
                         ^
./Main.cpp:84:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘ll* {aka long long int*}’ [-Wformat=]
./Main.cpp:84:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘ll* {aka long long int*}’ [-Wformat=]
./Main.cpp: In function ‘void solve()’:
./Main.cpp:126:36: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll {aka long long int}’ [-Wformat=]
   printf("%d\n", (res[query]+n*n)%n);
                                    ^
./Main.cpp: In function ‘void input()’:
./Main.cpp:84:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&n,&m,&q);
                          ^

Judge Result

Set Name test_all
Score / Max Score 320549 / 948690
Status
AC × 10
Set Name Test Cases
test_all subtask_01_01.txt, subtask_01_02.txt, subtask_01_03.txt, subtask_01_04.txt, subtask_01_05.txt, subtask_01_06.txt, subtask_01_07.txt, subtask_01_08.txt, subtask_01_09.txt, subtask_01_10.txt
Case Name Status Exec Time Memory
subtask_01_01.txt AC 86 ms 976 KiB
subtask_01_02.txt AC 87 ms 976 KiB
subtask_01_03.txt AC 86 ms 976 KiB
subtask_01_04.txt AC 86 ms 976 KiB
subtask_01_05.txt AC 87 ms 976 KiB
subtask_01_06.txt AC 90 ms 980 KiB
subtask_01_07.txt AC 87 ms 976 KiB
subtask_01_08.txt AC 88 ms 972 KiB
subtask_01_09.txt AC 87 ms 976 KiB
subtask_01_10.txt AC 87 ms 976 KiB