제출 #786421

#제출 시각아이디문제언어결과실행 시간메모리
786421LuoBoAliens (IOI16_aliens)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=100010;
struct node {
    int x, y;
} a[MAXN];
long long f[510][510];

long long min(long long x,long long y) { return x<y ? x : y ; }

long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {

    for (int i=0;i<n;i++) {
        if ( r[i]>c[i] ) { a[i+1].x=c[i]+1; a[i+1].y=r[i]+1; }
        else { a[i+1].x=r[i]+1; a[i+1].y=c[i]+1; }
    }
    
    memset(f,0x3f3f3f3f,sizeof(f));
    f[0][0]=0;
    for (int i=1;i<=n;i++) {
        for (int j=0;j<i;j++) {
            for (int opt=1;opt<=k;opt++) {
                f[i][opt]=min(f[i][opt],f[j][opt-1]+(a[i].x-a[j+1].x+1)*(a[i].x-a[j+1].x+1));
                printf("%d %d %d %d\n",i ,j ,opt, (a[i].x-a[j+1].x+1)*(a[i].x-a[j+1].x+1));
            }
        }
    }

    return f[n][k];

}

int main() {

    int n, m, k;
    scanf("%d %d %d", &n, &m, &k);
    std::vector<int> r(n), c(n);
    for (int i = 0; i < n; i++) {
        scanf("%d %d", &r[i], &c[i]);
    }
    long long ans = take_photos(n, m, k, r, c);

    printf("%lld\n", ans);
    
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

aliens.cpp: In function 'int main()':
aliens.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     scanf("%d %d %d", &n, &m, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
aliens.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         scanf("%d %d", &r[i], &c[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccR97RAk.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccaROP8m.o:aliens.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status