Japan Alumni Group Summer Camp 2013 Warming Up

Submission #101841

Source codeソースコード

#include <cstdio>
#include <algorithm>

using namespace std;

int a[100000];
long long sum[200001];

int main()
{
    int n, m, x = 0, i;
    long long ans = -1e18;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 0; i < n; i++) sum[i + 1] = sum[i] + a[i];
    for (i = 0; i < n; i++) sum[n + i + 1] = sum[n + i] + a[i];
    
    ans = max(ans, sum[n / 2]);
    
    for (i = 0; i < m; i++) {
        int y;
        
        scanf("%d", &y);
        
        x += y - 1;
        x %= n;
        
        ans = max(ans, sum[x + n / 2] - sum[x]);
    }
    
    printf("%lld\n", ans);
    
    return 0;
}

Submission

Task問題 J - Very Intellectual Card Game
User nameユーザ名 ~shiokawa(304)
Created time投稿日時
Language言語 C++ (GCC 4.4.7)
Status状態 AC
Score得点 100
Source lengthソースコード長 696 Byte
File nameファイル名
Exec time実行時間 65 ms
Memory usageメモリ使用量 2732 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
./Main.cpp:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
./Main.cpp:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 1,10,11,12,13,14,15,16,17,18,2,3,4,5,6,7,8,9

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
1 AC 21 ms 676 KB
10 AC 20 ms 808 KB
11 AC 21 ms 808 KB
12 AC 21 ms 680 KB
13 AC 48 ms 2324 KB
14 AC 40 ms 1292 KB
15 AC 63 ms 2656 KB
16 AC 63 ms 2724 KB
17 AC 63 ms 2732 KB
18 AC 65 ms 2724 KB
2 AC 20 ms 800 KB
3 AC 19 ms 804 KB
4 AC 22 ms 680 KB
5 AC 21 ms 680 KB
6 AC 20 ms 680 KB
7 AC 21 ms 804 KB
8 AC 20 ms 804 KB
9 AC 20 ms 796 KB