Submission #68541076


Source Code Expand

#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
double EPS = 1e-12;
typedef long long int lld;
typedef pair<lld,lld> PA;
long double tick(){static clock_t oldt; clock_t newt=clock();
    long double diff=1.0L*(newt-oldt)/CLOCKS_PER_SEC; oldt = newt; return diff; }
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define sz(a) ((int)a.size())
#ifdef LOCAL_RUN
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
#else
#define Error(x...) 42
#endif
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
// Ab :)
#define popcount __builtin_popcountll


#define lim 300010
#define lim2 200010


lld A[lim];


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    string first, second;
    cin >> first >> second;
    int qq;
    qq = m;
    vector<int> operations(n + 2, 0);
    while(qq--){
        int l, r;
        cin >> l >> r;
        operations[l]++;
        operations[r + 1]--;
    }
    string ans;
    int curr = 0;
    for(int i = 1; i <= n; i++){
        curr += operations[i];
        Error(i, curr);
        if(curr % 2 == 0) ans += first[i - 1];
        else ans += second[i - 1];
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Substr Swap
User abhishek_saini
Language C++ 20 (gcc 12.2)
Score 400
Code Size 1660 Byte
Status AC
Exec Time 27 ms
Memory 7056 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:20:21: warning: statement has no effect [-Wunused-value]
   20 | #define Error(x...) 42
      |                     ^~
Main.cpp:56:9: note: in expansion of macro ‘Error’
   56 |         Error(i, curr);
      |         ^~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 16
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3416 KiB
00_sample_01.txt AC 1 ms 3456 KiB
01_test_00.txt AC 1 ms 3520 KiB
01_test_01.txt AC 1 ms 3416 KiB
01_test_02.txt AC 1 ms 3480 KiB
01_test_03.txt AC 1 ms 3500 KiB
01_test_04.txt AC 2 ms 3576 KiB
01_test_05.txt AC 10 ms 4036 KiB
01_test_06.txt AC 12 ms 3468 KiB
01_test_07.txt AC 5 ms 6892 KiB
01_test_08.txt AC 22 ms 6364 KiB
01_test_09.txt AC 23 ms 7056 KiB
01_test_10.txt AC 27 ms 6680 KiB
01_test_11.txt AC 27 ms 7036 KiB
01_test_12.txt AC 20 ms 6972 KiB
01_test_13.txt AC 24 ms 6964 KiB