제출 #72060

#제출 시각아이디문제언어결과실행 시간메모리
72060um.. (#118)놀이터에 떨어진 이상한 약 (FXCUP3_gorgeous)C++14
0 / 100
2 ms248 KiB
#include<stdio.h> #include<vector> #include<algorithm> #include<math.h> #include<queue> #include<stack> #include<string.h> #include<string> #define ll long long using namespace std; long long c[300005]; long long d[300005]; long long ans[300005]; int n; int anss = 0; void go(int l, int r, int now, int th, int m) { if (c[now] == th) m += d[now]; if(l>0) go(l - 1, r, l, th + 1, m); if(r<n+1) go(l, r + 1, r, th + 1, m); if (l == 0 && r == n + 1) { if (anss < m) anss= m; } return; } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%lld", &c[i]); } for (int i = 1; i <= n; i++) { scanf("%lld", &d[i]); } for (int i = 1; i <= n; i++) { int l = i - 1, r = n - i; anss = 0; go(i - 1, i+1, i, 1, 0); ans[i] = anss; } printf("%lld", ans[1]); for (int i = 2; i <= n; i++) printf(" %lld", ans[i]); printf("\n"); printf("%d", 15000000000); return 0; }

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

gorgeous.cpp: In function 'int main()':
gorgeous.cpp:41:7: warning: unused variable 'l' [-Wunused-variable]
   int l = i - 1, r = n - i;
       ^
gorgeous.cpp:41:18: warning: unused variable 'r' [-Wunused-variable]
   int l = i - 1, r = n - i;
                  ^
gorgeous.cpp:51:26: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
  printf("%d", 15000000000);
                          ^
gorgeous.cpp:32:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
gorgeous.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &c[i]);
   ~~~~~^~~~~~~~~~~~~~~
gorgeous.cpp:37:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &d[i]);
   ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...