Submission #705029

# Submission time Handle Problem Language Result Execution time Memory
705029 2023-03-03T08:31:04 Z Nursik Tenis (COI19_tenis) C++14
18 / 100
500 ms 3792 KB
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <functional>
#include <complex>
#include <random>

using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ld long double
 
const ll maxn = 2e5 + 10, maxm = 20 + 1;
const ll mod = 1e9 + 7, cmod = 998244353, inf = 1e9, blcok = 400, p2 = 31;
const ld eps = 1e-9;


int n, q;
int a[5][maxn], pos[maxn];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    cin >> n >> q;
    for (int i = 1; i <= 3; ++i){
        for (int j = 1; j <= n; ++j){
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= q; ++i){
        int type;
        cin >> type;
        if (type == 1){
            int x;
            cin >> x;
            for (int j = 1; j <= n; ++j){
                pos[j] = inf;
            }
            for (int i = 1; i <= n; ++i){
                for (int j = 1; j <= 3; ++j){
                    pos[a[j][i]] = min(pos[a[j][i]], i);
                    for (int k = i + 1; k <= n; ++k){
                        pos[a[j][i]] = min(pos[a[j][k]], pos[a[j][i]]);
                    }
                }
            }
            if (pos[x] == 1){
                cout << "DA\n";
            }
            else{
                cout << "NE\n";
            }
        }
        else{
            int p, ap, bp;
            cin >> p >> ap >> bp;
            int pos1 = -1, pos2 = -1;
            for (int i = 1; i <= n; ++i){
                if (a[p][i] == ap){
                    pos1 = i;
                }
                if (a[p][i] == bp){
                    pos2 = i;
                }
            }
            swap(a[p][pos1], a[p][pos2]);
        }
    }
}
/*
*/


# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 7 ms 336 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 11 ms 368 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 8 ms 340 KB Output is correct
12 Correct 11 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 7 ms 336 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 11 ms 368 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 8 ms 340 KB Output is correct
12 Correct 11 ms 372 KB Output is correct
13 Execution timed out 1071 ms 3528 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 3792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 7 ms 336 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 11 ms 368 KB Output is correct
10 Correct 5 ms 340 KB Output is correct
11 Correct 8 ms 340 KB Output is correct
12 Correct 11 ms 372 KB Output is correct
13 Execution timed out 1071 ms 3528 KB Time limit exceeded
14 Halted 0 ms 0 KB -