Submission #644950

# Submission time Handle Problem Language Result Execution time Memory
644950 2022-09-25T16:32:41 Z Baytoro Round words (IZhO13_rowords) C++17
28 / 100
15 ms 16548 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;
			else
				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:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | 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);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 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 3 ms 5076 KB Output is correct
7 Correct 9 ms 12072 KB Output is correct
8 Incorrect 9 ms 12116 KB Output isn't correct
9 Incorrect 9 ms 12116 KB Output isn't correct
10 Incorrect 10 ms 12116 KB Output isn't correct
11 Incorrect 12 ms 13252 KB Output isn't correct
12 Correct 8 ms 15060 KB Output is correct
13 Incorrect 12 ms 15112 KB Output isn't correct
14 Incorrect 11 ms 13832 KB Output isn't correct
15 Incorrect 15 ms 15968 KB Output isn't correct
16 Incorrect 10 ms 13268 KB Output isn't correct
17 Incorrect 12 ms 12500 KB Output isn't correct
18 Incorrect 14 ms 16548 KB Output isn't correct
19 Incorrect 10 ms 12116 KB Output isn't correct
20 Incorrect 12 ms 14796 KB Output isn't correct
21 Incorrect 6 ms 9044 KB Output isn't correct
22 Incorrect 8 ms 10964 KB Output isn't correct
23 Incorrect 9 ms 12372 KB Output isn't correct
24 Incorrect 10 ms 13140 KB Output isn't correct
25 Incorrect 11 ms 15316 KB Output isn't correct