Submission #7364224
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <queue> #include <cmath> #include <tuple> #include <cstdio> #include <bitset> #include <sstream> #include <iterator> #include <numeric> #include <map> #include <cstring> #include <set> #include <functional> #include <iomanip> using namespace std; #define DEBUG_ //!!提出時にコメントアウト!! #ifdef DEBUG_ #define dump(x) cerr << #x << " = " << (x) << endl; #else #define dump(x) ; #endif #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b)) < EPS) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define SZ(x) ((int)(x).size()) #define pb push_back #define eb emplace_back //#define int long long typedef long long LL; typedef vector<int> VI; typedef vector<LL> VL; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<LL, LL> PLL; template <typename T> std::string printVector(const std::vector<T> &data) { std::stringstream ss; std::ostream_iterator<T> out_it(ss, ", "); ss << "["; std::copy(data.begin(), data.end() - 1, out_it); ss << data.back() << "]"; return ss.str(); } const LL LINF = 1001002003004005006ll; const int INF = 1001001001; signed main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int num,mod; cin >> num >> mod; int cnt[112345] = {}; int gen[112345] = {}; int dat[112345] = {}; for(int i=0;i<num;i++) { int z; scanf("%d",&z); cnt[z%mod]++; dat[z]++; } for(int i=0;i<=100000;i++) { gen[i%mod]+=dat[i]/2; } int ret = 0; for(int i = 0; i+i <= mod; i++){ if(i == 0 || i+i == mod){ ret += cnt[i] / 2; }else{ if(cnt[i]<cnt[mod-i])ret+=cnt[i]+min((cnt[mod-i]-cnt[i])/2,gen[mod-i]); else ret+=cnt[mod-i]+min((cnt[i]-cnt[mod-i])/2,gen[i]); } } cout << ret << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | Bloody_Yulii |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2022 Byte |
Status | WA |
Exec Time | 13 ms |
Memory | 1664 KB |
Compile Error
./Main.cpp: In function ‘int main(int, const char**)’: ./Main.cpp:73:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&z); ^
Judge Result
Set Name | sample | all | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
all | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 2 ms | 1536 KB |
01-02.txt | AC | 12 ms | 1536 KB |
01-03.txt | WA | 12 ms | 1536 KB |
01-04.txt | AC | 12 ms | 1536 KB |
01-05.txt | AC | 12 ms | 1536 KB |
01-06.txt | AC | 12 ms | 1536 KB |
01-07.txt | WA | 12 ms | 1536 KB |
01-08.txt | WA | 13 ms | 1664 KB |
01-09.txt | WA | 12 ms | 1536 KB |
01-10.txt | WA | 13 ms | 1536 KB |
01-11.txt | WA | 13 ms | 1536 KB |
01-12.txt | AC | 12 ms | 1536 KB |
01-13.txt | AC | 12 ms | 1536 KB |
01-14.txt | WA | 12 ms | 1536 KB |
01-15.txt | WA | 12 ms | 1536 KB |
01-16.txt | WA | 12 ms | 1536 KB |
01-17.txt | WA | 12 ms | 1664 KB |
01-18.txt | WA | 12 ms | 1536 KB |
01-19.txt | WA | 12 ms | 1536 KB |
01-20.txt | WA | 13 ms | 1536 KB |
01-21.txt | AC | 12 ms | 1536 KB |
01-22.txt | WA | 12 ms | 1536 KB |
01-23.txt | WA | 12 ms | 1536 KB |
01-24.txt | WA | 12 ms | 1536 KB |
01-25.txt | WA | 12 ms | 1536 KB |
01-26.txt | WA | 13 ms | 1536 KB |
01-27.txt | WA | 8 ms | 1536 KB |
01-28.txt | WA | 3 ms | 1536 KB |
01-29.txt | WA | 3 ms | 1536 KB |
01-30.txt | WA | 2 ms | 1536 KB |
sample-01.txt | AC | 2 ms | 1536 KB |
sample-02.txt | WA | 2 ms | 1536 KB |