답안 #772304

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
772304 2023-07-03T23:36:43 Z tolbi 고장난 휴대전화기 (COCI14_mobitel) C++17
50 / 50
1 ms 324 KB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define int long long
#define vint(x) vector<int> x
#define endl '\n'
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define revarr(x) reverse(x.begin(), x.rend())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tol(x) (1ll<<((int)(bi)))
#define det(x) cout<<"NO\0YES"+((!!x)*3)<<endl;
#define INF LONG_LONG_MAX
using namespace std;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
int32_t main(){
	ios;
	int T = 1;
	if (!T) cin>>T;
	int tno = 0;
	while (T-(tno++)){
		vint(arr(9));
		cinarr(arr);
		vector<int> pos(26);
		vector<int> kac(26);
		for (int i = 0; i < 18; ++i)
		{
			pos[i]=i/3+2;
			kac[i]=i%3+1;
		}
		pos[18]=7;
		kac[18]=4;
		pos[19]=pos[20]=pos[21]=8;
		kac[19]=1,kac[20]=2,kac[21]=3;
		pos[22]=pos[23]=pos[24]=pos[25]=9;
		kac[22]=1,kac[23]=2,kac[24]=3,kac[25]=4;
		decstr(str);
		vector<int> yer(9);
		for (int i = 0; i < 9; ++i)
		{
			yer[arr[i]-1]=i+1;
		}
		for (int i = 0; i < pos.size(); ++i)
		{
			pos[i]=yer[pos[i]-1];
		}
		int lel = -1;
		string ans = "";
		for (int i = 0; i < str.length(); ++i)
		{
			int crr = pos[str[i]-'a'];
			if (crr==lel){
				ans+='#';
			}
			lel=crr;
			char ch = to_string(crr)[0];
			for (int j = 0; j < kac[str[i]-'a']; j++){
				ans+=ch;
			}
		}
		cout<<ans<<endl;
	}
}

Compilation message

mobitel.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
mobitel.cpp: In function 'int32_t main()':
mobitel.cpp:57:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |   for (int i = 0; i < pos.size(); ++i)
      |                   ~~^~~~~~~~~~~~
mobitel.cpp:63:21: 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]
   63 |   for (int i = 0; i < str.length(); ++i)
      |                   ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct