답안 #744579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
744579 2023-05-18T18:53:27 Z vjudge1 벽 (IOI14_wall) C++11
8 / 100
3000 ms 18124 KB
#include <bits/stdc++.h>
#include "wall.h"
using namespace std;
const int MAX=1e5+10;
const int INF=(1<<30);
void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[])
{
    memset(finalHeight,0,sizeof(finalHeight));
    int niza[n];
    memset(niza,0,sizeof(niza));
    for(int i=0; i<k; i++)
    {
        int h=height[i];
        if(op[i]==1)
        {

            for(int j=left[i]; j<=right[i]; j++)
            {
                if(niza[j]<h)
                {

                    niza[j]=h;
                }
            }

        }
        else
        {
            for(int j=left[i]; j<=right[i]; j++)
            {
                if(niza[j]>h)
                {
                    niza[j]=h;
                }
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        finalHeight[i]=niza[i];
    }

    return;
}
/*int main()
{
    int n,k;
    cin>>n>>k;
    int op[k],left[k],right[k],height[k],res[n];
    for(int i=0; i<k; i++)
    {
        cin>>op[i]>>left[i]>>right[i]>>height[i];
    }
    buildWall(n,k,op,left,right,height, res);
    return 0;
}*/

Compilation message

wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:8:33: warning: 'sizeof' on array function parameter 'finalHeight' will return size of 'int*' [-Wsizeof-array-argument]
    8 |     memset(finalHeight,0,sizeof(finalHeight));
      |                                ~^~~~~~~~~~~~
wall.cpp:6:82: note: declared here
    6 | void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[])
      |                                                                              ~~~~^~~~~~~~~~~~~
wall.cpp:8:26: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
    8 |     memset(finalHeight,0,sizeof(finalHeight));
      |                          ^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 436 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 12 ms 596 KB Output is correct
5 Correct 12 ms 596 KB Output is correct
6 Correct 10 ms 536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 127 ms 13840 KB Output is correct
3 Correct 880 ms 7420 KB Output is correct
4 Execution timed out 3061 ms 18112 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 432 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 14 ms 564 KB Output is correct
5 Correct 10 ms 468 KB Output is correct
6 Correct 12 ms 496 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 132 ms 13948 KB Output is correct
9 Correct 881 ms 7492 KB Output is correct
10 Execution timed out 3028 ms 18048 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 13 ms 524 KB Output is correct
5 Correct 9 ms 500 KB Output is correct
6 Correct 14 ms 596 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 131 ms 13976 KB Output is correct
9 Correct 912 ms 7508 KB Output is correct
10 Execution timed out 3049 ms 18124 KB Time limit exceeded
11 Halted 0 ms 0 KB -