Submission #100388

# Submission time Handle Problem Language Result Execution time Memory
100388 2019-03-10T20:42:35 Z AKaan37 Marko (COCI15_marko) C++17
50 / 50
232 ms 40864 KB
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//Bismillahirrahmanirrahim
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 1000005; 
const lo mod = 1000000007; 

lo n,m,cev,b,a[li],k,diz[li];
string s[li];
string ss;
vector<lo> v;
map<lo,lo> mpp;

int main(){
	scanf("%lld",&n);
	FOR{
		cin>>s[i];
	}
	cin>>ss;
	for(lo i=0;i<(lo)ss.size();i++) mpp[ss[i]-'0']++;
	FOR{
		if(ss.size()!=s[i].size())continue;
		lo flag=0;
		memset(diz,0,sizeof(diz));
		for(lo j=0;j<(lo)s[i].size();j++){
			if(s[i][j]=='a' || s[i][j]=='b' || s[i][j]=='c') s[i][j]=2;
			if(s[i][j]=='d' || s[i][j]=='e' || s[i][j]=='f') s[i][j]=3;
			if(s[i][j]=='g' || s[i][j]=='h' || s[i][j]=='i') s[i][j]=4;
			if(s[i][j]=='j' || s[i][j]=='k' || s[i][j]=='l') s[i][j]=5;
			if(s[i][j]=='m' || s[i][j]=='n' || s[i][j]=='o') s[i][j]=6;
			if(s[i][j]=='p' || s[i][j]=='q' || s[i][j]=='r' || s[i][j]=='s') s[i][j]=7;
			if(s[i][j]=='w' || s[i][j]=='x' || s[i][j]=='y' || s[i][j]=='z') s[i][j]=9;
			if(s[i][j]=='t' || s[i][j]=='u' || s[i][j]=='v') s[i][j]=8;
			if(s[i][j]==' ') s[i][j]=1;
			diz[s[i][j]]++;
			if(diz[s[i][j]]>mpp[s[i][j]]){flag=1;break;}
		}
		if(flag==0) cev++;
	}
	printf("%lld\n",cev);
	return 0;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:53:15: warning: array subscript has type 'char' [-Wchar-subscripts]
    diz[s[i][j]]++;
               ^
marko.cpp:54:18: warning: array subscript has type 'char' [-Wchar-subscripts]
    if(diz[s[i][j]]>mpp[s[i][j]]){flag=1;break;}
                  ^
marko.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 38 ms 39416 KB Output is correct
2 Correct 35 ms 39544 KB Output is correct
3 Correct 35 ms 39424 KB Output is correct
4 Correct 205 ms 40696 KB Output is correct
5 Correct 67 ms 39544 KB Output is correct
6 Correct 57 ms 39604 KB Output is correct
7 Correct 202 ms 40184 KB Output is correct
8 Correct 232 ms 40864 KB Output is correct
9 Correct 63 ms 39576 KB Output is correct
10 Correct 155 ms 40332 KB Output is correct