Submission #17536129
Source Code Expand
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[105],L[105][105],R[105][105];
int fr(int l,int r);
int fl(int l,int r)
{
if(l==r)return 1;
if(L[l][r]!=-1e9)return L[l][r];
if(fr(l+1,r)>a[r])return L[l][r]=1;
return L[l][r]=a[r]-fr(l+1,r)+fl(l,r-1)+1;
}
int fr(int l,int r)
{
if(l==r)return 1;
if(R[l][r]!=-1e9)return R[l][r];
if(fl(l,r-1)>a[l])return R[l][r]=1;
return R[l][r]=a[l]-fl(l,r-1)+fr(l+1,r)+1;
}
signed main()
{
int t;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
L[i][j]=R[i][j]=-1e9;
if(fl(1,n)<=a[1])puts("First");
else puts("Second");
}
return 0;
}
Submission Info
| Submission Time |
|
| Task |
D - Pocky Game |
| User |
AzusaCat |
| Language |
C++ (GCC 9.2.1) |
| Score |
900 |
| Code Size |
838 Byte |
| Status |
AC |
| Exec Time |
13 ms |
| Memory |
3920 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:23:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
23 | scanf("%lld",&t);
| ~~~~~^~~~~~~~~~~
./Main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
26 | scanf("%lld",&n);
| ~~~~~^~~~~~~~~~~
./Main.cpp:27:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
27 | for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
| ~~~~~^~~~~~~~~~~~~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
900 / 900 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00-sample-001.txt |
| All |
00-sample-001.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt, 01-023.txt, 01-024.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00-sample-001.txt |
AC |
8 ms |
3600 KiB |
| 01-001.txt |
AC |
2 ms |
3604 KiB |
| 01-002.txt |
AC |
2 ms |
3612 KiB |
| 01-003.txt |
AC |
2 ms |
3496 KiB |
| 01-004.txt |
AC |
2 ms |
3612 KiB |
| 01-005.txt |
AC |
5 ms |
3676 KiB |
| 01-006.txt |
AC |
3 ms |
3660 KiB |
| 01-007.txt |
AC |
2 ms |
3516 KiB |
| 01-008.txt |
AC |
2 ms |
3636 KiB |
| 01-009.txt |
AC |
5 ms |
3664 KiB |
| 01-010.txt |
AC |
4 ms |
3552 KiB |
| 01-011.txt |
AC |
2 ms |
3724 KiB |
| 01-012.txt |
AC |
5 ms |
3672 KiB |
| 01-013.txt |
AC |
7 ms |
3644 KiB |
| 01-014.txt |
AC |
8 ms |
3808 KiB |
| 01-015.txt |
AC |
6 ms |
3644 KiB |
| 01-016.txt |
AC |
9 ms |
3808 KiB |
| 01-017.txt |
AC |
9 ms |
3920 KiB |
| 01-018.txt |
AC |
9 ms |
3756 KiB |
| 01-019.txt |
AC |
10 ms |
3644 KiB |
| 01-020.txt |
AC |
12 ms |
3640 KiB |
| 01-021.txt |
AC |
9 ms |
3640 KiB |
| 01-022.txt |
AC |
10 ms |
3640 KiB |
| 01-023.txt |
AC |
13 ms |
3644 KiB |
| 01-024.txt |
AC |
13 ms |
3752 KiB |