Submission #1443548
Source Code Expand
/* W A 自动机 --InterestingLSY */ #include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <stack> #include <queue> #include <algorithm> #include <set> #include <map> #define pb push_back #define mp make_pair #define INF 9999999 #define LINF 9999999999999999 #define SINF "%" #define uint unsigned int #define msn(a,v) memset(a,v,sizeof(a)) #define ms(a) msn(a,0) #define NONE -1 #define ll long long #define uchar unsigned char #define sint short int #define usint unsigned sint #define xsize(a) sizeof(a)/1024/1024 #define fr(aaaaa,bbbbb) for(aaaaa = 1;aaaaa <= bbbbb;aaaaa++) #define frr(aaaaa,bbbbb,ccccc) for(aaaaa = ccccc;aaaaa <= bbbbb;aaaaa++) using namespace std; #define MAXN 5100 int n,k; ll data[MAXN]; int main(){ //freopen("D.txt","r",stdin); scanf("%d %d",&n,&k); for(int i = 1;i <= n;i++) scanf("%lld",&data[i]); sort(data+1,data+n+1); /* if For each good subset Z that i∈Z,and Z/{i} is a good subset) , then i is UNNESSERY Is Equal To if There is at least one good subset Z that i∈Z,and Z/{i} is not a good subset, then i is NOT UNNESSERY */ int ans = 0; ll sum = (ll)0; //sum : SIGMA(Seems like Unnessery num in [n,i)) for(int i = n;i >= 1;i--){ if(sum + (ll)data[i] < k){ sum += (ll)data[i]; ans++; //cout << i << " "; }else ans = sum = 0; } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - No Need |
User | interestingLSY |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1460 Byte |
Status | WA |
Exec Time | 2 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:40:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d",&n,&k); ^ ./Main.cpp:42:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&data[i]); ^
Judge Result
Set Name | Sample | Subtask | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | 0 / 300 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
Subtask | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 2_026.txt, 2_027.txt, 2_028.txt, 2_029.txt, 2_030.txt, 2_031.txt, 2_032.txt, 2_033.txt, 2_034.txt, 2_035.txt, 2_036.txt, 2_037.txt, 2_038.txt, 2_039.txt, 2_040.txt, 2_041.txt, 2_042.txt, 2_043.txt, 2_044.txt, 2_045.txt, 2_046.txt, 2_047.txt, 2_048.txt, 2_049.txt, 2_050.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | AC | 1 ms | 256 KB |
1_004.txt | AC | 1 ms | 256 KB |
1_005.txt | AC | 1 ms | 256 KB |
1_006.txt | AC | 1 ms | 256 KB |
1_007.txt | AC | 1 ms | 256 KB |
1_008.txt | AC | 1 ms | 256 KB |
1_009.txt | AC | 1 ms | 256 KB |
1_010.txt | AC | 1 ms | 256 KB |
1_011.txt | AC | 1 ms | 256 KB |
1_012.txt | AC | 1 ms | 256 KB |
1_013.txt | AC | 1 ms | 256 KB |
1_014.txt | AC | 1 ms | 256 KB |
1_015.txt | WA | 1 ms | 256 KB |
1_016.txt | AC | 1 ms | 256 KB |
1_017.txt | AC | 1 ms | 256 KB |
1_018.txt | AC | 1 ms | 256 KB |
1_019.txt | AC | 1 ms | 256 KB |
1_020.txt | WA | 1 ms | 256 KB |
1_021.txt | WA | 1 ms | 256 KB |
1_022.txt | WA | 1 ms | 256 KB |
1_023.txt | WA | 1 ms | 256 KB |
1_024.txt | AC | 1 ms | 256 KB |
1_025.txt | AC | 1 ms | 256 KB |
2_026.txt | AC | 1 ms | 256 KB |
2_027.txt | AC | 1 ms | 256 KB |
2_028.txt | AC | 1 ms | 256 KB |
2_029.txt | AC | 2 ms | 256 KB |
2_030.txt | AC | 2 ms | 256 KB |
2_031.txt | AC | 2 ms | 256 KB |
2_032.txt | AC | 2 ms | 256 KB |
2_033.txt | AC | 2 ms | 256 KB |
2_034.txt | AC | 2 ms | 256 KB |
2_035.txt | AC | 2 ms | 256 KB |
2_036.txt | WA | 2 ms | 256 KB |
2_037.txt | AC | 1 ms | 256 KB |
2_038.txt | AC | 1 ms | 256 KB |
2_039.txt | AC | 1 ms | 256 KB |
2_040.txt | AC | 2 ms | 256 KB |
2_041.txt | WA | 2 ms | 256 KB |
2_042.txt | WA | 2 ms | 256 KB |
2_043.txt | WA | 2 ms | 256 KB |
2_044.txt | WA | 2 ms | 256 KB |
2_045.txt | WA | 2 ms | 256 KB |
2_046.txt | AC | 2 ms | 256 KB |
2_047.txt | AC | 2 ms | 256 KB |
2_048.txt | AC | 2 ms | 256 KB |
2_049.txt | AC | 2 ms | 256 KB |
2_050.txt | AC | 2 ms | 256 KB |