Submission #2211895


Source Code Expand

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define __int64 long long
#define mat vector<vector<ll> >

const int M=101;

int n,k,num;
string s;
vector<string>g[20];
int t[15];
int pos;

void dfs(int p,ll z,int num){

	if(p==pos){
		if(s.size()!=num)return ;

		ll zz=z;
		int now=0;
		string ret="";
		rep(i,pos){
			ret="";
			rep(j,zz%10)ret.push_back(s[now++]);
			g[t[i]].push_back(ret);
			zz/=10;
		}
		return ;
	}

	rep(i,3){
		dfs(p+1,z*10+i+1,num+i+1);
	}
}

int main(){
	cin>>k>>n;
	rep(i,n){
		cin>>num>>s;
		pos=0;
		while(num>0){
			t[pos++]=num%10;
			num/=10;
		}
		reverse(t,t+pos);
		dfs(0,0,0);//何番目、今までの選択の集合
		
	}

	rep(i,10){
		sort(g[i].begin(),g[i].end());
		cout<<i<<" ";
		rep(j,g[i].size())cout<<g[i][j]<<" ";
		cout<<endl;
	}
	return 0;
}

Submission Info

Submission Time
Task D - 語呂合わせ
User pappagukun
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1151 Byte
Status CE

Compile Error

./Main.cpp:17:12: error: ‘__int64’ has not been declared
 #define ll __int64
            ^
./Main.cpp:29:16: note: in expansion of macro ‘ll’
 void dfs(int p,ll z,int num){
                ^
./Main.cpp: In function ‘void dfs(int, int, int)’:
./Main.cpp:17:12: error: ‘__int64’ was not declared in this scope
 #define ll __int64
            ^
./Main.cpp:34:3: note: in expansion of macro ‘ll’
   ll zz=z;
   ^
./Main.cpp:39:10: error: ‘zz’ was not declared in this scope
    rep(j,zz%10)ret.push_back(s[now++]);
          ^
./Main.cpp:13:32: note: in definition of macro ‘rep’
 #define rep(i,a) for(int i=0;i<a;i++)
                                ^
./Main.cpp:41:4: error: ‘zz’ was not declared in this scope
    zz/=10;
    ^