Submission #879472

# Submission time Handle Problem Language Result Execution time Memory
879472 2023-11-27T14:02:37 Z Rafi22 World of Tank (innopolis2018_final_E) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
ll infl=1000000000000000007;
int inf=2000000007;
int mod=1000000007;
int mod1=998244353;

const int N=1000007;

int DP[N][2];
int zkad1[N][2];
int zkad2[N][2];
bool odw[N][2];
int a[N][2];
int nx[N][2];
int last[2];
bool bad[2];

void gg()
{
    cout<<"No";
    exit(0);
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m1,m2,t;
    cin>>n>>m1>>m2>>t;
    vector<pair<int,pair<int,int>>>V;
    for(int i=1;i<=m1;i++) cin>>a[i][0];
    for(int i=1;i<=m2;i++) cin>>a[i][1];
    m1++,m2++;
    a[m1][0]=inf;
    a[m2][1]=inf;
    for(int i=1;i<=m1;i++) V.pb({a[i][0],{i,0}});
    for(int i=1;i<=m2;i++) V.pb({a[i][1],{i,1}});

    for(int i=1;i<=m1;i++) DP[i][0]=inf;
    for(int i=1;i<=m2;i++) DP[i][1]=inf;
    sort(all(V));
    reverse(all(V));
    for(auto [q,p]:V)
    {
        int i=p.st,j=p.nd;
        last[j]=i;
        nx[i][j]=last[j^1];
        if(a[i][j]<=t&&a[nx[i][j]][j^1]==a[i][j]) gg();
        if(a[i][j]<t&&a[nx[i][j]][j^1]==a[i][j]+1) gg();
        if(a[i][j]==t) bad[j]=1;
    }
    priority_queue<pair<int,pair<int,int>>>Q;
    for(int i=1;i<=m1;i++)
    {
        if(a[i][0]>t&&!bad[0])
        {
            DP[i][0]=t;
            Q.push({-DP[i][0],{i,0}});
            break;
        }
    }
    for(int i=1;i<=m2;i++)
    {
        if(a[i][1]>t&&!bad[1])
        {
            DP[i][1]=t;
            Q.push({-DP[i][1],{i,1}});
            break;
        }
    }
    while(sz(Q)>0)
    {
        int i=Q.top().nd.st,j=Q.top().nd.nd;
        int x=-Q.top().st;
        Q.pop();
        if(a[i][j]==inf) break;
        if(DP[i][j]>=a[i][j]) continue;
        if(DP[i][j]!=x) continue;
        if(DP[i][j]+t<DP[i+1][j])
        {
            DP[i+1][j]=DP[i][j]+t;
            Q.push({-DP[i+1][j],{i+1,j}});
        }
        int k=nx[i][j];
        for(;k>0;k--)
        {
            if(a[k][j^1]<=DP[i][j]||a[k][j^1]<a[i-1][j]) break;
            if(a[k-1][j^1]<a[i][j]-1)
            {
                if(max(DP[i][j],a[k-1][j^1]+1)<DP[k][j^1])
                {
                    DP[k][j^1]=max(DP[i][j],a[k-1][j^1]+1);
                    Q.push({-DP[k][j^1],{k,j^1}});
                }
            }
        }
    }
    if(DP[m1][0]<a[m1][0]||DP[m2][1]<a[m2][1]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
/*
100 10 10 6
15 30 31 51 52 53 54 55 99 100
15 30 31 51 52 53 54 55 99 100
*/

Compilation message

E.cpp:31:2: error: extended character   is not valid in an identifier
   31 |     cout<<"No";
      |  ^
E.cpp:31:5: error: extended character   is not valid in an identifier
   31 |     cout<<"No";
      |    ^
E.cpp:110:2: error: extended character   is not valid in an identifier
  110 |     if(DP[m1][0]<a[m1][0]||DP[m2][1]<a[m2][1]) cout<<"Yes"<<endl;
      |  ^
E.cpp:110:5: error: extended character   is not valid in an identifier
  110 |     if(DP[m1][0]<a[m1][0]||DP[m2][1]<a[m2][1]) cout<<"Yes"<<endl;
      |    ^
E.cpp:111:2: error: extended character   is not valid in an identifier
  111 |     else cout<<"No"<<endl;
      |  ^
E.cpp:111:5: error: extended character   is not valid in an identifier
  111 |     else cout<<"No"<<endl;
      |    ^
E.cpp: In function 'void gg()':
E.cpp:31:2: error: '\U000000a0' was not declared in this scope
   31 |     cout<<"No";
      |  ^
E.cpp: In function 'int main()':
E.cpp:110:2: error: '\U000000a0' was not declared in this scope
  110 |     if(DP[m1][0]<a[m1][0]||DP[m2][1]<a[m2][1]) cout<<"Yes"<<endl;
      |  ^
E.cpp:111:4: error: expected ';' before '\U000000a0else'
  111 |     else cout<<"No"<<endl;
      |   ^~~~~~
      |   ;