#include<bits/stdc++.h>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int n,st,f[26],i;
char c[4010],s[4010];
struct Nod{
char val;
int f[26];
} blanc;
vector<Nod> v;
vector<int> l[4001],car[27];
void add(int p,int en,int nod)
{
int next;
if(v[nod].f[c[p]-'a']==0)
{
next=v.size();
blanc.val=next;
v.push_back(blanc);
l[nod].push_back(next);
car[c[p]-'a'].push_back(nod);
}
else next=v[nod].f[c[p]-'a'];
if(p!=en) add(p+1,en,next);
}
int main()
{
ios_base::sync_with_stdio(false);
fin>>c+1>>s+1;
for(n=1;c[n];n++);
n--;st=1;
v.push_back(blanc);
for(st=1;st<=n;st++)
{
add(st,st+n,0);
c[st+n]=c[st];
}
for(i=0;i<v.size();i++)
{
for(auto it:l[i])
fout<<i<<" "<<it<<"\n";
}
return 0;
}
//https://oj.uz/problem/view/IZhO13_rowords
Compilation message
rowords.cpp: In function 'int main()':
rowords.cpp:34:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
34 | fin>>c+1>>s+1;
| ~^~
rowords.cpp:34:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
34 | fin>>c+1>>s+1;
| ~^~
rowords.cpp:43:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Nod>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | for(i=0;i<v.size();i++)
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
3692 KB |
Execution killed with signal 11 |
2 |
Runtime error |
6 ms |
3692 KB |
Execution killed with signal 11 |
3 |
Runtime error |
5 ms |
3692 KB |
Execution killed with signal 11 |
4 |
Runtime error |
5 ms |
3712 KB |
Execution killed with signal 11 |
5 |
Runtime error |
5 ms |
3692 KB |
Execution killed with signal 11 |
6 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
7 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
8 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
9 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
10 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
11 |
Runtime error |
5 ms |
4416 KB |
Execution killed with signal 11 |
12 |
Runtime error |
7 ms |
4412 KB |
Execution killed with signal 11 |
13 |
Runtime error |
5 ms |
4420 KB |
Execution killed with signal 11 |
14 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
15 |
Runtime error |
5 ms |
4416 KB |
Execution killed with signal 11 |
16 |
Runtime error |
6 ms |
4436 KB |
Execution killed with signal 11 |
17 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
18 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
19 |
Runtime error |
5 ms |
4204 KB |
Execution killed with signal 11 |
20 |
Runtime error |
5 ms |
4544 KB |
Execution killed with signal 11 |
21 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
22 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
23 |
Runtime error |
7 ms |
4672 KB |
Execution killed with signal 11 |
24 |
Runtime error |
6 ms |
4672 KB |
Execution killed with signal 11 |
25 |
Runtime error |
6 ms |
4800 KB |
Execution killed with signal 11 |