Submission #650851

# Submission time Handle Problem Language Result Execution time Memory
650851 2022-10-15T18:43:59 Z edogawa_something Mobitel (COCI14_mobitel) C++14
50 / 50
1 ms 464 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string st;
typedef bool bl;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
typedef vector<pii> vpi;
#define pu push
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie();
#define test ll qqqqq;cin>>qqqqq;while(qqqqq--)
#define F first
#define S second
#define forn(i,n) for(ll i=0;i<n;i++)
#define forx(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define pob pop_back
#define all(v) v.begin(),v.end()
#define lb lower_bound
#define ub upper_bound
#define pof pop_front
const ll dx[]{1,0,-1,0};
const ll dy[]{0,1,0,-1};
const ll inf=2e18;
const ll mod=1e9+7;
const ll M=1e6+1;
const ll MM=10002;
const ll MMM=101;
const ld pi=acos(-1);
const ll mod1=1000000321;
st s;
ll p[M],per[M];
map<char,ll>mp,mpp;
int main(){
    fast
    forn(i,9)
    cin>>p[i];
    forn(i,9){
        forn(j,9){
            if(p[j]==i+1)
            per[i+1]=j+1;
        }
    }
    cin>>s;
    for(char a='a';a<='r';a++){
        mp[a]=min(9,((a-'a')/3)+2);
        mpp[a]=(a-'a')%3;
    }
    mp['s']=7,mpp['s']=3;
    mp['t']=8,mpp['t']=0;
    mp['u']=8,mpp['u']=1;
    mp['v']=8,mpp['v']=2;
    mp['w']=9,mpp['w']=0;
    mp['x']=9,mpp['x']=1;
    mp['y']=9,mpp['y']=2;
    mp['z']=9,mpp['z']=3;
    forn(i,s.size()){
        if(i>0&&mp[s[i]]==mp[s[i-1]])
        cout<<'#';
        forn(j,mpp[s[i]]+1)
        cout<<per[mp[s[i]]];
    }
    return 0;
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:19:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | #define forn(i,n) for(ll i=0;i<n;i++)
......
   62 |     forn(i,s.size()){
      |          ~~~~~~~~~~            
mobitel.cpp:62:5: note: in expansion of macro 'forn'
   62 |     forn(i,s.size()){
      |     ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct