답안 #644949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
644949 2022-09-25T16:29:24 Z Baytoro 원형 문자열 (IZhO13_rowords) C++17
28 / 100
16 ms 16468 KB
#include <bits/stdc++.h>
using namespace std;
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
const int INF=1e18;
void fopn(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
int binpow(int a,int n){
	if(n==0)
		return 1;
	if(n%2==1)
		return binpow(a, n-1)*a;
	else{
		int b=binpow(a, n/2);
		return b*b;
	}
}
int cost(pair<int,int> a, pair<int,int> b){
	return (a.fr-b.fr)*(a.fr-b.fr)+(a.sc-b.sc)*(a.sc-b.sc);
}
int dp[2002][2002];
int h,g,c,n,m,q,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
	string a,b;
	cin>>a>>b;
	sort(all(a));
	sort(all(b));
	res=0;
	for(i=0;i<a.size();i++){
		for(j=0;j<b.size();j++){
			if(a[i]==b[j])
				dp[i+1][j+1]=dp[i][j]+1;
			dp[i+1][j+1]=max(dp[i+1][j+1],max(dp[i][j+1],dp[i+1][j]));
			res=max(res,dp[i+1][j+1]);
		}
	}
	cout<<res<<endl;
}
main(){
	//fopn("radio");
	//ios;
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}




Compilation message

rowords.cpp: In function 'void solve()':
rowords.cpp:38:11: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(i=0;i<a.size();i++){
      |          ~^~~~~~~~~
rowords.cpp:39:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |   for(j=0;j<b.size();j++){
      |           ~^~~~~~~~~
rowords.cpp: At global scope:
rowords.cpp:48:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   48 | main(){
      | ^~~~
rowords.cpp: In function 'void fopn(std::string)':
rowords.cpp:14:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rowords.cpp:15:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Incorrect 1 ms 468 KB Output isn't correct
6 Correct 4 ms 5036 KB Output is correct
7 Correct 13 ms 12116 KB Output is correct
8 Incorrect 11 ms 12080 KB Output isn't correct
9 Incorrect 13 ms 12084 KB Output isn't correct
10 Incorrect 15 ms 12108 KB Output isn't correct
11 Incorrect 13 ms 13268 KB Output isn't correct
12 Correct 12 ms 15188 KB Output is correct
13 Incorrect 13 ms 15096 KB Output isn't correct
14 Incorrect 13 ms 13792 KB Output isn't correct
15 Incorrect 16 ms 15956 KB Output isn't correct
16 Incorrect 12 ms 13268 KB Output isn't correct
17 Incorrect 12 ms 12552 KB Output isn't correct
18 Incorrect 16 ms 16468 KB Output isn't correct
19 Incorrect 12 ms 12116 KB Output isn't correct
20 Incorrect 16 ms 14780 KB Output isn't correct
21 Incorrect 7 ms 9044 KB Output isn't correct
22 Incorrect 9 ms 10964 KB Output isn't correct
23 Incorrect 10 ms 12372 KB Output isn't correct
24 Incorrect 10 ms 13108 KB Output isn't correct
25 Incorrect 13 ms 15400 KB Output isn't correct