제출 #959872

#제출 시각아이디문제언어결과실행 시간메모리
959872ramalzaherBliskost (COI23_bliskost)C++14
57 / 100
1037 ms20296 KiB
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set ;
#define int long long
#define F first
#define S second
#define rep(i , j , n ) for(int i = j ;i < n; i++ )
#define FOR(i , n ) rep(i ,0 , n )
#define sz size()
#define pb push_back
#define all(x) x.begin() , x.end()
#define vi vector<int>
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define cans cout<<ans<<endl;
#define forx(i, x) for(auto i : x)
#define fast
#define pii pair<int ,int >
#define endl "\n"
#define sp ' '
const int N = 300 ;
const int inf = 1e15 ;
//int rec(int a , int b , int c, int d ){
//if(a+b+c+d == 0 )
//return 1 ;
//int ans = 0 ;
//if( ((a%2)^(2 * ( b%2 ) ) ^( 3 * (c%2 ) ) ^(4 * ( d%2 ) )) == 0   ) {
//ans = 1 ;
//}
// if(a)ans += rec(0 , b , c , d ) ;
// if(b)ans += rec(a , 0 , c , d ) ;
// if(c)ans += rec(a , b , 0 , d ) ;
// if(d)ans += rec(a , b , c , 0 ) ;
// return ans ;
//
//}

main()
{
    int n, q ;
    cin>> n >> q ;
    string s, s1  ;
    cin>> s >> s1 ;
    int a[n] ;
    int a1[n] ;
    FOR(i, n )a[i] = s[i] - 'a' ;
    FOR(i, n )a1[i] = s1[i] - 'a' ;
    FOR(i, n-1 )
    {
        if(a[i] != a1[i] )
        {
            int temp = (a1[i] + 26 ) - a[i] ;
            a[i] += temp ;
            a[i+1]+=temp ;
            a[i]%=26 ;
            a[i+1]%=26 ;
        }
    }
    bool ok= 1;
    FOR(i, n )
    {
        if(a[i]!=a1[i])ok = 0 ;
    }
    if(ok)cout<<"da\n";
    else cout<<"ne\n" ;
    while(q--)
    {
        int idx; char v ;
        cin >> idx >> v ;
        idx--;
        s[idx] = v  ;
//        cout<<s<<endl<<s1;
        FOR(i, n )a[i] = s[i] - 'a' ;
        FOR(i, n )a1[i] = s1[i] - 'a' ;
        FOR(i, n-1 )
        {
            if(a[i] != a1[i] )
            {
                int temp = (a1[i] + 26 ) - a[i] ;
                a[i] += temp ;
                a[i+1]+=temp ;
                a[i]%=26 ;
                a[i+1]%=26 ;
            }
        }
        ok= 1;
        FOR(i, n )
        {
            if(a[i]!=a1[i])ok = 0 ;
        }
        if(ok)cout<<"da\n";
        else cout<<"ne\n" ;
    }
    return 0 ;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:39:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   39 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...