結果
問題 | No.1440 The Quiz Competition |
ユーザー | iaNTU |
提出日時 | 2021-03-27 00:02:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 10,587 bytes |
コンパイル時間 | 1,933 ms |
コンパイル使用メモリ | 201,896 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-05-06 18:04:03 |
合計ジャッジ時間 | 3,345 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
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 | WA | - |
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 | - |
ソースコード
// Exported by Exporter.exe // Included from A.cpp #include <bits/stdc++.h> using namespace std; #define PB push_back #define F first #define S second #define MP make_pair #define MTP make_tuple #define R Read #define RD Read_Digit #define RP Read_P #define RL Read_Loop #define RLD Read_Loop_Digit #define RLP Read_Loop_P #ifdef ONLINE_JUDGE #define Debug(x) ; #define Debugln(x) ; #define Debug_Array(n,x) ; #define Debugln_Array(n,x) ; #else #define Debug(x) printf("%s :", (#x)); _Debug(x) #define Debugln(x) printf("%s :", (#x)); _Debugln(x) #define Debug_Array(n,x) printf("%s :", (#x)); _Debug_Array((n), (x)) #define Debugln_Array(n,x) printf("%s :", (#x)); _Debugln_Array((n), (x)) #endif typedef long long int ll; typedef unsigned long long int ull; constexpr int kN = int(1E5 + 10); // constexpr int kMod = 998244353; // constexpr int kMod = int(1E9 + 7); // constexpr int kInf = 0x3f3f3f3f; // constexpr ll kInf = 0x3f3f3f3f3f3f3f3f; // constexpr double kPi = acos(-1); // constexpr double kEps = 1E-9; // Included from C:\Users\ianli\Desktop\CP\template\Various\Fast_IO\Fast_IO.cpp // --- Get --- static inline char Get_Raw_Char() { static char buf[1 << 16], *p = buf, *end = buf; if (p == end) { if ((end = buf + fread(buf, 1, 1 << 16, stdin)) == buf) return '\0'; p = buf; } return *p++; } // --- Read --- template <typename T> static inline void Read_P(T &n) { static_assert(is_integral<T>::value); char c; while (!isdigit(c = Get_Raw_Char())) ; n = int(c - '0'); while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0'); return ; } template <typename T> static inline void Read(T &n) { static_assert(is_integral<T>::value); char c; bool neg = false; while (!isdigit(c = Get_Raw_Char())) if (c == '-') neg = true; n = int(c - '0'); while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0'); if (neg) n = -n; return ; } template <typename T> static inline void Read_Digit(T &n) { static_assert(is_integral<T>::value); char c; while (!isdigit(c = Get_Raw_Char())) ; n = int(c - '0'); return ; } // --- Read multiple --- template <typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {Read(n); return Read(Fargs...);} template <typename T, typename... Targs> static inline void Read_Digit(T &n, Targs&... Fargs) {Read_Digit(n); return Read_Digit(Fargs...);} template <typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {Read_P(n); return Read_P(Fargs...);} // --- Read Loop --- template <typename T> static inline void Read_Loop_i(int i, T *a) {return Read(a[i]);} template <typename T, typename... Targs> static inline void Read_Loop_i(int i, T *a, Targs*... Fargs) {Read(a[i]); return Read_Loop_i(i, Fargs...);} template <typename... Targs> static inline void Read_Loop(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_i(i, Fargs...);} template <typename T> static inline void Read_Loop_Digit_i(int i, T *a) {return Read_Digit(a[i]);} template <typename T, typename... Targs> static inline void Read_Loop_Digit_i(int i, T *a, Targs*... Fargs) {Read_Digit(a[i]); return Read_Loop_Digit_i(i, Fargs...);} template <typename... Targs> static inline void Read_Loop_Digit(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_Digit_i(i, Fargs...);} template <typename T> static inline void Read_Loop_P_i(int i, T *a) {return Read_P(a[i]);} template <typename T, typename... Targs> static inline void Read_Loop_P_i(int i, T *a, Targs*... Fargs) {Read_P(a[i]); return Read_Loop_P_i(i, Fargs...);} template <typename... Targs> static inline void Read_Loop_P(int n, Targs*... Fargs) {for (int i = 1; i <= n; i++) Read_Loop_P_i(i, Fargs...);} // --- Float --- template <int mul, typename T> static inline void Read(T &n) { char c; bool neg = false; while (!isdigit(c = Get_Raw_Char())) if (c == '-') neg = true; n = int(c - '0'); while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0'); int cnt = 0; if (c == '.') { while (isdigit(c = Get_Raw_Char())) { n = n * 10 + int(c - '0'); cnt++; } } while (cnt++ < mul) n = n * 10; if (neg) n = -n; return ; } template <int mul, typename T> static inline void Read_P(T &n) { char c; while (!isdigit(c = Get_Raw_Char())) ; n = int(c - '0'); while (isdigit(c = Get_Raw_Char())) n = n * 10 + int(c - '0'); int cnt = 0; if (c == '.') { while (isdigit(c = Get_Raw_Char())) { n = n * 10 + int(c - '0'); cnt++; } } while (cnt++ < mul) n = n * 10; return ; } template <int mul, typename T, typename... Targs> static inline void Read(T &n, Targs&... Fargs) {Read<mul>(n); return Read<mul>(Fargs...);} template <int mul, typename T, typename... Targs> static inline void Read_P(T &n, Targs&... Fargs) {Read_P<mul>(n); return Read_P<mul>(Fargs...);} // --- init --- inline void IOS() {ios::sync_with_stdio(false); cin.tie(0);} inline void Freopen(const char *in, const char *out) {freopen(in, "r", stdin); freopen(out, "w", stdout);} // --- Output --- template <typename T> void Print(T x) { if (x < 0) { printf("-"); x = -x; } if (x == 0) printf("0"); else { static int val[100]; int idx = -1; while (x) { val[++idx] = x % 10; x /= 10; } while (idx >= 0) printf("%d", val[idx--]); } } // End of C:\Users\ianli\Desktop\CP\template\Various\Fast_IO\Fast_IO.cpp // Included from C:\Users\ianli\Desktop\CP\template\Various\Useful_Functions\Useful_Functions.cpp template <typename T> inline void sort(vector<T> &v) {return sort(v.begin(), v.end());} template <typename T> inline void sort_r(vector<T> &v) {return sort(v.begin(), v.end(), greater<T>());} template <typename T> inline void reverse(vector<T> &v) {return reverse(v.begin(), v.end());} template <typename T> inline void Merge(vector<T> &a, vector<T> &b, vector<T> &c) { if (c.size() < a.size() + b.size()) c.resize(a.size() + b.size()); merge(a.begin(), a.end(), b.begin(), b.end(), c.begin()); return ; } template <typename T> inline void Discrete(vector<T> &v) {sort(v); v.resize(unique(v.begin(), v.end()) - v.begin());} template <typename T> using PQ = priority_queue<T>; template <typename T> using PQ_R = priority_queue<T, vector<T>, greater<T>>; template <typename T> inline T ABS(T n) {return n >= 0 ? n : -n;} template <typename T> inline T gcd(T a, T b) {return b ? gcd(b, a % b) : a;} template <typename T> inline T lcm(T a, T b) {return a * b / gcd(a, b);} template <typename T, typename... Targs> inline T min(T a, T b, T c, Targs... args) {return min(a, min(b, c, args...));} template <typename T, typename... Targs> inline T max(T a, T b, T c, Targs... args) {return max(a, max(b, c, args...));} template <typename T> inline void chmin(T &a, T b) {a = min(a, b); return ;} template <typename T> inline void chmax(T &a, T b) {a = max(a, b); return ;} template <typename T, typename... Targs> inline void chmin(T &a, T b, T c, Targs... args) {a = min(a, min(b, c, args...)); return ;} template <typename T, typename... Targs> inline void chmax(T &a, T b, T c, Targs... args) {a = max(a, max(b, c, args...)); return ;} template <typename T> inline int Digit_Sum(T a) { int ans = 0; while (a) { ans += a % 10; a /= 10; } return ans; } template <typename T> inline int Num_Length(T a) { int ans = 1; while (a /= 10) ans++; return ans; } // End of C:\Users\ianli\Desktop\CP\template\Various\Useful_Functions\Useful_Functions.cpp // Included from C:\Users\ianli\Desktop\CP\template\Various\Debug\Debug.cpp void _print(int x) {printf("%d", x);} void _print(long long int x) {printf("%lld", x);} void _print(double x) {printf("%lf", x);} template <typename T1, typename T2> void _print(pair<T1, T2> x) {printf("("); _print(x.first); printf(", "); _print(x.second); printf(")");} template <typename T> void _Debug(T x) {_print(x); printf("\n");} template <typename T> void _Debug(vector<T> v) { if (v.empty()) printf(" empty"); else for (T i : v) printf(" "), _print(i); printf("\n"); } template <typename T1, typename T2, typename T3> void _Debug(priority_queue<T1, T2, T3> pq) { if (pq.empty()) printf(" empty"); else { while (!pq.empty()) { printf(" "); _print(pq.top()); pq.pop(); } } printf("\n"); } template <typename T> void _Debug(queue<T> q) { if (q.empty()) printf(" empty"); else { while (!q.empty()) { printf(" "); _print(q.front()); q.pop(); } } printf("\n"); } template <typename T> void _Debug(stack<T> st) { if (st.empty()) printf(" empty"); else { while (!st.empty()) { printf(" "); _print(st.top()); st.pop(); } } printf("\n"); } template <typename T> void _Debug(deque<T> dq) { if (dq.empty()) printf(" empty"); else { while (!dq.empty()) { printf(" "); _print(dq.front()); dq.pop_front(); } } printf("\n"); } template <typename T> void _Debugln(vector<T> v) { if (v.empty()) printf(" empty\n"); else { for (T i : v) printf("\n"), _print(i); printf("\n"); } } template <typename T1, typename T2, typename T3> void _Debugln(priority_queue<T1, T2, T3> pq) { if (pq.empty()) printf(" empty"); else { while (!pq.empty()) { printf("\n"); _print(pq.top()); pq.pop(); } } printf("\n"); } template <typename T> void _Debugln(queue<T> q) { if (q.empty()) printf(" empty"); else { while (!q.empty()) { printf("\n"); _print(q.front()); q.pop(); } } printf("\n"); } template <typename T> void _Debugln(stack<T> st) { if (st.empty()) printf(" empty"); else { while (!st.empty()) { printf("\n"); _print(st.top()); st.pop(); } } printf("\n"); } template <typename T> void _Debugln(deque<T> dq) { if (dq.empty()) printf(" empty"); else { while (!dq.empty()) { printf("\n"); _print(dq.front()); dq.pop_front(); } } printf("\n"); } template <typename T> void _Debug_Array(int n, const T *x) {for (int i = 1; i <= n; i++) printf(" "), _print(x[i]); printf("\n");} template <typename T> void _Debugln_Array(int n, const T *x) {printf("\n"); for (int i = 1; i <= n; i++) _print(x[i]), printf("\n");} // End of C:\Users\ianli\Desktop\CP\template\Various\Debug\Debug.cpp void solve() { int n, a, w, k; RP(n, a, w, k); if (a >= k || w >= n - k) { if (k < n) printf("%d\n", a / k); else { ll tot = 0, cur = 1; while (w) { if (w >= n) { tot += cur * n; w -= n; } else { tot += cur * w; w = 0; } cur++; } if (a >= tot) printf("%lld\n", (a - tot) / k); else printf("-%lld\n", (tot - a + k - 1) / k); } } else printf(":(\n"); return ; } int main() { int t; RP(t); for (int i = 1; i <= t; i++) solve(); } // End of A.cpp