제출 #624775

#제출 시각아이디문제언어결과실행 시간메모리
624775Icebear16모임들 (IOI18_meetings)C++14
컴파일 에러
0 ms0 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) a.size() vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { int Q = L.size(); int n = H.size(); int adj[n][n]; vector<long long> C(Q); for(int i=0;i<n;i++){ adj[i][i]=H[i]; for(int k=i-1;k>=0;k--){ adj[i][k]=max(adj[i][k+1],H[k]); } for(int k=i+1;k<n;k++){ adj[i][k]=max(adj[i][k-1],H[k]); } } long long dj[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ dj[i][j]=adj[i][j]; } } for(int i=0;i<n;i++){ for(int j=1;j<n;j++){ dj[i][j]+=dj[i][j-1]; } } // int rt[n][n], lt[n][n]; // for(int i=0;i<n;i++){ // for(int j=0;j<n;j++){ // cout<<dj[i][j]<<" "; // } // cout<<endl; // } for(int i=0;i<Q;i++){ long long ans=1e10; for(int j=0;j<n;j++){ if(L[i]==0){ ans=min(ans,dj[j][R[i]]); }else{ ans=min(ans,dj[j][R[i]]-dj[j][L[i]-1]); } } C[i]=ans; } return C; }#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) a.size() vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { int Q = L.size(); int n = H.size(); int adj[n][n]; vector<long long> C(Q); for(int i=0;i<n;i++){ adj[i][i]=H[i]; for(int k=i-1;k>=0;k--){ adj[i][k]=max(adj[i][k+1],H[k]); } for(int k=i+1;k<n;k++){ adj[i][k]=max(adj[i][k-1],H[k]); } } long long dj[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ dj[i][j]=adj[i][j]; } } for(int i=0;i<n;i++){ for(int j=1;j<n;j++){ dj[i][j]+=dj[i][j-1]; } } // int rt[n][n], lt[n][n]; // for(int i=0;i<n;i++){ // for(int j=0;j<n;j++){ // cout<<dj[i][j]<<" "; // } // cout<<endl; // } for(int i=0;i<Q;i++){ long long ans=1e10; for(int j=0;j<n;j++){ if(L[i]==0){ ans=min(ans,dj[j][R[i]]); }else{ ans=min(ans,dj[j][R[i]]-dj[j][L[i]-1]); } } C[i]=ans; } return C; }

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

meetings.cpp:50:2: error: stray '#' in program
   50 | }#include "meetings.h"
      |  ^
meetings.cpp:50:3: error: 'include' does not name a type
   50 | }#include "meetings.h"
      |   ^~~~~~~
meetings.cpp:55:19: error: redefinition of 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)'
   55 | vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) {
      |                   ^~~~~~~~~~~~~
meetings.cpp:6:19: note: 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)' previously defined here
    6 | vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) {
      |                   ^~~~~~~~~~~~~