답안 #71115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71115 2018-08-24T07:04:49 Z khohko 구간 성분 (KOI15_interval) C++17
0 / 100
7 ms 696 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e6+100))
#define HS ((ll)(1049))
#define MOD ((ll)(1000000861))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;

string s,t;

ll pw[ARRS];
int mp[30000500];


int main(){
	#ifdef KHOKHO
		freopen("in.in","r",stdin);
		freopen("out.out","w",stdout);
	#endif
	cin>>s>>t;
	pw[0]=1;
	for(int i=1; i<500; i++)pw[i]=(rand()<<16+rand())%10000000;
	int pas=0;
	for(int i=0; i<s.size(); i++){
		ll hs=0;
		for(int j=i; j<s.size(); j++){
			hs^=pw[s[j]-'a'+1];
			mp[hs]=j-i+1;
		}
	}

	for(int i=0; i<t.size(); i++){
		ll hs=0;
		for(int j=i; j<t.size(); j++){
			hs^=pw[t[j]-'a'+1];
			pas=max(pas,mp[hs]);
		}
	}

	cout<<pas;


}

Compilation message

interval.cpp: In function 'int main()':
interval.cpp:31:43: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
  for(int i=1; i<500; i++)pw[i]=(rand()<<16+rand())%10000000;
                                         ~~^~~~~~~
interval.cpp:33:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<s.size(); i++){
               ~^~~~~~~~~
interval.cpp:35:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=i; j<s.size(); j++){
                ~^~~~~~~~~
interval.cpp:41:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<t.size(); i++){
               ~^~~~~~~~~
interval.cpp:43:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=i; j<t.size(); j++){
                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 664 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -