Submission #97407
Source Code Expand
#include <cstdio> #include <cstring> int N; int p[ 100 + 1 ]; int done[ 100*100 + 1 ]; int main() { memset( done, -1, sizeof( done ) ); scanf( "%d", &N ); for( int i = 1; i <= N; ++i ) { scanf( "%d", &p[ i ] ); } done[ 0 ] = 0; for( int j = 1; j <= N; ++j ) { for( int i = 0; i < 100*100 + 1; ++i ) { if( done[ i ] != -1 && done[ i ] != j ) { if( i + p[ j ] < 100*100 + 1 ) { if( done[ i + p[ j ] ] != -1 ) continue; done[ i + p[ j ] ] = j; // printf("[%d, %d] :: %d\n", i, j, i + p[ j ]); } } } } int cnt = 0; for( int i = 0; i < 100 * 100 + 1; ++i ) { if( done[ i ] != -1 ) ++cnt; } printf( "%d\n", cnt ); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | arukuka |
Language | C++ (G++ 4.6.4) |
Score | 2 |
Code Size | 706 Byte |
Status | AC |
Exec Time | 23 ms |
Memory | 788 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] ./Main.cpp:14:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 2 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 18 ms | 660 KB |
01 | AC | 20 ms | 788 KB |
02 | AC | 20 ms | 656 KB |
90 | AC | 19 ms | 660 KB |
91 | AC | 23 ms | 660 KB |