結果
問題 | No.1972 Modulo Set |
ユーザー | popofy |
提出日時 | 2022-06-10 21:50:48 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,511 bytes |
コンパイル時間 | 3,745 ms |
コンパイル使用メモリ | 235,028 KB |
実行使用メモリ | 15,488 KB |
最終ジャッジ日時 | 2024-09-21 06:12:59 |
合計ジャッジ時間 | 5,805 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 29 ms
7,652 KB |
testcase_29 | AC | 46 ms
9,600 KB |
testcase_30 | AC | 66 ms
12,032 KB |
testcase_31 | AC | 4 ms
5,376 KB |
testcase_32 | AC | 60 ms
11,392 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
ソースコード
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> //#define __INCLUDE_ATCODER_LIB //#define __INTERACTIVE #ifdef __INCLUDE_ATCODER_LIB #include <atcoder/all> using namespace atcoder; #endif using namespace std; #define overload4(a, b, c, d, e, ...) e #define rep1(a) for(decltype(a) i = 0, i##_len = (a); i < i##_len; ++i) #define rep2(i, a) for(decltype(a) i = 0, i##_len = (a); i < i##_len; ++i) #define rep3(i, a, b) for(decltype(b) i = (a), i##_len = (b); i < i##_len; ++i) #define rep4(i, a, b, c) for(decltype(b) i = (a), i##_len = (b); i < i##_len; i += (c)) #define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define rrep1(a) for(decltype(a) i = (a); i--;) #define rrep2(i, a) for(decltype(a) i = (a); i--;) #define rrep3(i, a, b) for(decltype(a) i = (b), i##_len = (a); i-- > i##_len;) #define rrep4(i, a, b, c) for(decltype(a) i = (a)+((b)-(a)-1)/(c)*(c), i##_len = (a); i >= i##_len; i -= c) #define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) ((int)(x).size()) #define yes(s) cout << ((s)?"Yes":"No") << "\n"; #define bit(n) (1LL << ((int)(n))) #define get1bit(x,n) (((x) >> (int)(n)) & 1) #define INF ((1 << 30) - 1) #define INFL (1LL << 60) #define PRECISION std::setprecision(16) #ifdef __INTERACTIVE #define NO_SYNC_STD #define ENDL std::endl #else #define NO_SYNC_STD std::cin.tie(nullptr);ios::sync_with_stdio(false) #define ENDL "\n" #endif #ifdef __LOCAL #include <dump.hpp> #define dump(...) DUMPOUT << " " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << " ", dump_func(__VA_ARGS__) #else #define dump(...) #endif using ll=long long;using ld=long double;template<class T> using V=vector<T>;template<class T> using VV=vector<vector<T>>;template<class T> using PQ=priority_queue<T,V<T>,greater<T>>; template<class T> istream &operator>>(istream &is,complex<T> &v){T x,y; is >> x >> y;v.real(x);v.imag(y);return is;} template<class T> istream &operator>>(istream &is,V<T> &v){for(auto&& e:v)is >> e;return is;} template<class T,class U> istream &operator>>(istream &is,pair<T,U> &v){is >> v.first >> v.second;return is;} template<class T,size_t n> istream &operator>>(istream &is,array<T,n> &v){for(auto&& e:v)is >> e;return is;} template<class... A> void print_rest(){cout << ENDL;} template<class T,class... A> void print_rest(const T& first,const A&... rest){cout << " " << first;print_rest(rest...);} template<class T,class... A> void print(const T& first,const A&... rest){cout << fixed << PRECISION << first;print_rest(rest...);} template<class T,class... A> void die(const T& first,const A&... rest){cout << fixed << PRECISION << first;print_rest(rest...);exit(0);} template<class T> inline string join(const T& v,string sep=" "){if(v.size() == 0)return "";stringstream ss;for(auto&& e:v)ss << sep << e;return ss.str().substr(sz(sep));} V<string> split(const string &s,char sep=' ') {V<string> ret;stringstream ss(s);string buf;while(getline(ss,buf,sep))ret.push_back(buf);return ret;} template<class T> inline string padding(const T& v,int length,char pad=' ',bool left=false){stringstream ss;ss << (left?std::left:std::right) << setw(length) << setfill(pad) << v;return ss.str();} template<class T> V<T> make_vec(size_t n,T a){return V<T>(n,a);} template<class... Ts> auto make_vec(size_t n,Ts... ts){return V<decltype(make_vec(ts...))>(n,make_vec(ts...));} template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;} template<class T,class F> pair<T,T> binarysearch(T ng,T ok,T eps,F f,bool sign=false){while(abs(ng-ok)>eps){auto mid=ng+(ok-ng)/2;if(sign^f(mid)){ok=mid;}else{ng=mid;}}return{ng,ok};} template<class T> constexpr T cdiv(T x,T y){return (x+y-1)/y;} template<class T> constexpr bool between(T a,T x,T b){return(a<=x&&x<b);} template<class T> inline int between_count(V<T>&a,T l,T r) {return lower_bound(all(a),r)-lower_bound(all(a),l);} template<class T> inline int lower_index(V<T>&a,T x){return distance(a.begin(),lower_bound(all(a),x));} template<class T> inline int upper_index(V<T>&a,T x){return distance(a.begin(),upper_bound(all(a),x));} template<class T> constexpr T pos1d(T y,T x,T h,T w){assert(between(T(0),y,h));assert(between(T(0),x,w));return y*w+x;} template<class T> constexpr pair<T,T> pos2d(T p,T h,T w){T y=p/w,x=p-y*w;assert(between(T(0),y,h));assert(between(T(0),x,w));return{y,x};} constexpr ll modpow(ll x,ll n,ll m=1152921504606846976LL){ll ret=1;for(;n>0;x=x*x%m,n>>=1)if(n&1)ret=ret*x%m;return ret;} constexpr ll keta(ll n, ll base = 10LL) {ll ret = 0; while(n > 0) {n /= base, ret++;} return ret;} constexpr int pcnt(ll x) {return __builtin_popcountll(x);} constexpr int flog(ll x) {return 63 - __builtin_clzll(x);} constexpr int clog(ll x) {return (x==1LL)?0:(64-__builtin_clzll(x-1LL));} struct Solver { void solve() { ll n, m; cin >> n >> m; V<ll> a(n); cin >> a; if (n == 1) die(1); map<ll,int> mp; rep(i,n) { a[i] %= m; mp[a[i]]++; } int ans = 0; for(auto [e, cnt]: mp) { int b = mp[(m-e)%m]; if (cnt >= b) ans += cnt; mp[(m-e)%m] = 0; dump(e,ans,cnt,b); } print(ans); } } solver; signed main(void){NO_SYNC_STD;dump("");solver.solve();return 0;}