Submission #163431

# Submission time Handle Problem Language Result Execution time Memory
163431 2019-11-13T09:50:00 Z davitmarg Wall (IOI14_wall) C++17
Compilation error
0 ms 0 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

#ifndef death
#include "wall.h"
#endif

const int N = 2000006;

void buildWall(int n, int k, int op[], int L[], int R[], int H[], int fin[])
{
    for (int i = 0; i < n; i++)
        fin[i] = 0;
    for (int j = 0; j < k; j++)
    {
        for (int i = L[j]]; i <= R[j]; i++)
            if (op[j] == 1)
            {
                if (fin[i] < H[j])
                    fin[i] = H[j];
            }
            else
            {
                if (fin[i] > H[j])
                    fin[i] = H[j];
            }
    }
}

#ifdef death

int main()
{
    int N, K, L[102], R[102], OP[102], H[102], A[102];
    cin >> N >> K;
    for (int i = 0; i < K; i++)
        cin >> OP[i] >> L[i] >> R[i] >> H[i];
    buildWall(N, K, OP, L, R, H, A);
    for (int i = 0; i < N; i++)
        cout << A[i] << endl;

    return 0;
}

#endif

/*
 
10 3
1 3 4 91220
1 5 9 48623
2 3 5 39412
 
*/

Compilation message

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:37:26: error: expected ';' before ']' token
         for (int i = L[j]]; i <= R[j]; i++)
                          ^
wall.cpp:37:26: error: expected primary-expression before ']' token
wall.cpp:37:26: error: expected ';' before ']' token
wall.cpp:37:26: error: expected primary-expression before ']' token
wall.cpp:37:26: error: expected ')' before ']' token
wall.cpp:37:26: error: expected primary-expression before ']' token
wall.cpp:37:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for (int i = L[j]]; i <= R[j]; i++)
         ^~~
wall.cpp:37:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
         for (int i = L[j]]; i <= R[j]; i++)
                             ^
wall.cpp:37:18: warning: unused variable 'i' [-Wunused-variable]
         for (int i = L[j]]; i <= R[j]; i++)
                  ^
wall.cpp:37:29: error: 'i' was not declared in this scope
         for (int i = L[j]]; i <= R[j]; i++)
                             ^
wall.cpp:43:13: error: 'else' without a previous 'if'
             else
             ^~~~