Submission #1228958

#TimeUsernameProblemLanguageResultExecution timeMemory
1228958PVM_pvmMosaic (IOI24_mosaic)C++20
0 / 100
97 ms18364 KiB
#include "mosaic.h"
#include<bits/stdc++.h>
using namespace std;
#define MAXN 200'007
int n;
unordered_map<long long, long long> un;
vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) {
    int Q = (int)T.size();
    n=(int)X.size();
    if (n==1)
    {
        vector<long long> C(Q, X[0]);
        return C;
    }
    vector<int> k2(n);
    k2[0]=X[1];
    for (int q=1;q<n;q++)
    {
        if (Y[q]==0 && k2[q-1]==0) k2[q]=1;
        else k2[q]=0;
        if (k2[q]==1)
        {
            ///na q 1 sme
            un[q-1]=1;
        }
    }
    vector<int> r2(n);
    r2[0]=Y[1];
    for (int q=1;q<n;q++)
    {
        if (X[q]==0 && r2[q-1]==0) r2[q]=1;
        else r2[q]=0;
        if (r2[q]==1)
        {
            ///na 1 q sme
            un[1-q]=1;
        }
    }
    vector<long long> C(Q, 0);
    for (int q=0;q<Q;q++)
    {
        int red=T[q];
        int kolona=L[q];
        if (red==0)
        {
            C[q]=X[kolona];
        }
        else if (kolona==0)
        {
            C[q]=Y[red];
        }
        else if (un.find(red-kolona)!=un.end()) C[q]=1;
        else C[q]=0;
    }
    return C;
}
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...