提出 #22468044
ソースコード 拡げる
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<unordered_map>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<unordered_set>
#include<cmath>
#include <numeric>
#include <array>
#include<utility>
#include <complex>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#pragma region define
#define M_PI 3.141592653589793238
#define upperbound(v,val) upper_bound(v.begin(),v.end(),val)-v.begin()
#define lowerbound(v,val) lower_bound(v.begin(),v.end(),val)-v.begin()
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,l,r) for(int i=l;i<r;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp(a,b) make_pair(a,b)
#define pin pair<int,int>
#define qin pair<pin,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define fcout cout << fixed << setprecision(15)
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) (lower_bound(h.begin(),h.end(),val)-h.begin())
#define upper(h,val) (upper_bound(h.begin(),h.end(),val)-h.begin())
#define vveb V<veb>
#define omajinai cin.tie(0);ios::sync_with_stdio(false);
#define endl "\n"
#define pb push_back
#pragma endregion
#pragma region Inner Class
int root(int x, vel& pa) {
if (pa[x] == -1) { return x; }
int ans = root(pa[x], pa); pa[x] = ans;
return ans;
}
bool mar(int x, int y, vel& pa) {
x = root(x, pa);
y = root(y, pa);
if (x != y) { pa[x] = y; }
return (x != y);
}
int gcd(int x, int y) {
if (x < y) { return gcd(y, x); }
if (y == 0) { return x; }
return gcd(y, x % y);
}
int lcm(int x, int y) {
x = abs(x); y = abs(y);
return x * (y / gcd(x, y));
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= m;
if (u < 0) u += m;
return u;
}
vel dijk(V<V<pin>> way, int st, int inf) {
int n = way.size();
vel dist(n, inf); dist[st] = 0;
priority_queue<pin, vector<pin>, greater<pin>> pq;
pq.push(mkp(0, st));
veb is_checked(n, false);
while (!pq.empty()) {
pin x = pq.top(); pq.pop();
int pot = x.second;
if (!is_checked[pot]) {
is_checked[pot] = true;
for (auto y : way[pot]) {
int nex_dist = x.first + y.second;
int nex_pot = y.first;
if (dist[nex_pot] > nex_dist) {
dist[nex_pot] = nex_dist;
pq.push(mkp(nex_dist, y.first));
}
}
}
}
return dist;
}
V<V<pin>> make_w(vvel v) {
int n = v.size();
V<V<pin>> ret(n);
rep(i, n) {
for (int x : v[i]) {
ret[i].push_back(mkp(x, 1));
}
}
return ret;
}
void make_tree(vvel& chi, vel& par, int n) {
V<V<pin>> way(n);
rep(i, n - 1) {
int a, b; cin >> a >> b; a--; b--;
way[a].push_back(mkp(b, 1));
way[b].push_back(mkp(a, 1));
}
vel dist = dijk(way, 0, n + 1);
par = vel(n, -1);
chi = vvel(n);
rep(i, n) {
for (auto nex : way[i]) {
int pot = nex.first;
if (dist[pot] > dist[i]) { chi[i].push_back(pot); }
else { par[i] = pot; }
}
}
}
void pri(vel& v) {
if (v.size() == 0) { return; }
cout << v[0];
rep(i, v.size() - 1) { cout << " " << v[i + 1]; }
cout << endl;
return;
}
vvel disj_min(vel& v) {
int n = v.size();
vvel ret(22, vel(n));
ret[0] = v;
rep(i, 21) {
rep(j, n) {
int nex = j + (1 << i);
if (nex < n) {
ret[i + 1][j] = min(ret[i][j], ret[i][nex]);
}
else {
ret[i + 1][j] = ret[i][j];
}
}
}
return ret;
}
int find_min(vvel& dv, int l, int r) {
int i = 21;
while (l + (1 << i) > r) {
i--;
}
while (i >= 0) {
if (dv[i][l] > dv[i][r - (1 << i)]) {
l = r - (1 << i);
}
else {
r = l + (1 << i);
}
i--;
}
return l;
}
V<V<pin>> dbl(V<pin>& v) {
V<V<pin>> ans(20, V<pin>(v));
int n = v.size();
rep(i, 19) {
rep(j, n) {
ans[i + 1][j].first = ans[i][ans[i][j].first].first;
ans[i + 1][j].second = max(ans[i][j].second, ans[i][ans[i][j].first].second);
}
}
return ans;
}
int lca(int s, int t, int diff, V<V<pin>>& pa) {
if (diff < 0) { return lca(t, s, -diff, pa); }
int ans = 0;
rep(i, 19) {
if ((diff & (1 << i)) != 0) {
mmax(ans, pa[i][s].second);
s = pa[i][s].first;
}
}
for (int i = 19; i >= 0; i--) {
if (pa[i][s] != pa[i][t]) {
mmax(ans, pa[i][s].second);
s = pa[i][s].first;
mmax(ans, pa[i][t].second);
t = pa[i][t].first;
}
}
if (s != t) {
mmax(ans, pa[0][s].second);
mmax(ans, pa[0][t].second);
}
return ans;
}
void alp(int n, vel& pr) {
for (int i = 2; i * i <= n; i++) {
if (n % i == 0) {
pr.push_back(i);
while (n % i == 0) { n /= i; }
}
}
if (n != 1) { pr.push_back(n); }
}
vel dx = { 0,0,-1,1,1,-1 };
vel dy = { 1,-1,0,0,1,1 };
#define all(a) a.begin(),a.end()
template<typename T>
void mk_uni(V<T>& a) {
std::sort(a.begin(), a.end());
a.erase(std::unique(a.begin(), a.end()), a.end());
}
/*#include <cstdint>
template <std::uint_fast64_t Modulus> class modint {
using u64 = std::uint_fast64_t;
public:
u64 a;
constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
constexpr u64& value() noexcept { return a; }
constexpr const u64& value() const noexcept { return a; }
constexpr modint operator+(const modint rhs) const noexcept {
return modint(*this) += rhs;
}
constexpr modint operator-(const modint rhs) const noexcept {
return modint(*this) -= rhs;
}
constexpr modint operator*(const modint rhs) const noexcept {
return modint(*this) *= rhs;
}
constexpr modint operator/(const modint rhs) const noexcept {
return modint(*this) /= rhs;
}
constexpr modint& operator+=(const modint rhs) noexcept {
a += rhs.a;
if (a >= Modulus) {
a -= Modulus;
}
return *this;
}
constexpr modint& operator-=(const modint rhs) noexcept {
if (a < rhs.a) {
a += Modulus;
}
a -= rhs.a;
return *this;
}
constexpr modint& operator*=(const modint rhs) noexcept {
a = a * rhs.a % Modulus;
return *this;
}
constexpr modint& operator/=(modint rhs) noexcept {
u64 exp = Modulus - 2;
while (exp) {
if (exp % 2) {
*this *= rhs;
}
rhs *= rhs;
exp /= 2;
}
return *this;
}
};*/
using mint = modint1000000007;
using vem = vector<mint>;
using vvem = vector<vem>;
#pragma region mint
mint mpow(mint a, int n) {
mint ans = 1;
while (n) {
if (n & 1) { ans *= a; }
a *= a; n /= 2;
}
return ans;
}
vem kai, inv_kai;
void make_kai(int n) {
kai = vem(n + 1, 1);
inv_kai = vem(n + 1, 1);
rep(i, n) { kai[i + 1] = kai[i] * (i + 1); }
inv_kai[n] = (mint)1 / kai[n];
for (int i = n; i > 0; i--) { inv_kai[i - 1] = inv_kai[i] * i; }
}
mint com(int n, int r) {
if (n < 0 || r < 0 || n < r) { return 0; }
return kai[n] * inv_kai[r] * inv_kai[n - r];
}
mint per(int n, int r) {
if (n < 0 || r < 0 || n < r) { return 0; }
return kai[n] * inv_kai[r];
}
#pragma endregion
string s;
int inf = 1e7;
pin f2(vel& x, vel& y) {
int sum = 0;
rep(i, 26) {
sum += x[i] + y[i];
x[i] *= 100; x[i] += i;
y[i] *= 100; y[i] += i;
}
sor(x); rev(x);
sor(y); rev(y);
int fi = sum - (x[0] / 100) - (y[0] / 100);
if (x[0] % 100 != y[0] % 100) { return mkp(fi, (int)0); }
x[0] /= 100; y[0] /= 100; x[1] /= 100; y[1] /= 100;
return mkp(sum - x[0] - y[0], min(x[0] - x[1], y[0] - y[1]));
}
int f1(vel& x) {
int sum = 0;
int mx = 0;
for (auto w : x) { sum += w; mmax(mx, w); }
return sum - mx;
}
int cnt[61];
bool sol(vvel& a, int x) {
veb exi(32, false);
exi[0] = true;
int n = a.size();
rep(i, n) {
int cnt = 0;
rep(j, 5) {
if (a[i][j] >= x) { cnt += (1 << j); }
}
exi[cnt] = true;
}
rep(i, 32) {
if (exi[i]) {
rep(j, 32) {
if (exi[j]) {
rep(k, 32) {
if (exi[k]) {
if ((i | j | k) == 31) {
return true;
}
}
}
}
}
}
}
return false;
}
int r, c;
int ind(int qr, int qc) { return qr * c + qc; }
signed main() {
int k; cin >> k;
int n,m; cin >> n>>m;
vel a(k);
V<pin> err(k);
vel ret(k);
int cnt = 0;
rep(i, k) {
cin >> a[i];
a[i] *= m;
err[i] = mkp(a[i] % n,i);
cnt += err[i].first;
ret[i] = a[i] / n;
}
cnt /= n;
V<pin> lis_err = err;lis_err.push_back(mkp(n + 10, n));
sor(lis_err); rev(lis_err);
rep(i, k) {
if (err[i] >= lis_err[cnt]) {
ret[i]++;
}
cout << ret[i] << " ";
}
cout << endl;
return 0;
}
提出情報
コンパイルエラー
./Main.cpp:23: warning: ignoring #pragma region define [-Wunknown-pragmas]
23 | #pragma region define
|
./Main.cpp:24: warning: "M_PI" redefined
24 | #define M_PI 3.141592653589793238
|
In file included from /usr/include/c++/9/cmath:45,
from ./Main.cpp:15:
/usr/include/math.h:777: note: this is the location of the previous definition
777 | # define M_PI 3.14159265358979323846 /* pi */
|
./Main.cpp:49: warning: ignoring #pragma endregion [-Wunknown-pragmas]
49 | #pragma endregion
|
./Main.cpp:50: warning: ignoring #pragma region Inner [-Wunknown-pragmas]
50 | #pragma region Inner Class
|
./Main.cpp:282: warning: ignoring #pragma region mint [-Wunknown-pragmas]
282 | #pragma region mint
|
./Main.cpp:307: warning: ignoring #pragma endregion [-Wunknown-pragmas]
307 | #pragma endregion
|
./Main.cpp: In function ‘void pri(std::vector<long long int>&)’:
./Main.cpp:30:31: warning: comparison of integer expressions of different signedness: ‘long long int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
30 | #define rep(i,n) for(int i=0;i<n;i++)
......
136 | rep(i, v.size() - 1) { cout << " " << v[i + 1]; }
| ~~~~~~~~~~~~~~~
./Main.cpp:136:2: note: in expansion of macro ‘rep’
136 | rep(i, v.size() - 1) { cout << " " << v[i + 1]; }
| ^~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
400 / 400 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 01_sample_04.txt |
| All |
01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 01_sample_04.txt, 02_rand_01.txt, 02_rand_02.txt, 02_rand_03.txt, 02_rand_04.txt, 02_rand_05.txt, 02_rand_06.txt, 02_rand_07.txt, 02_rand_08.txt, 02_rand_09.txt, 02_rand_10.txt, 02_rand_11.txt, 02_rand_12.txt, 02_rand_13.txt, 02_rand_14.txt, 02_rand_15.txt, 02_rand_16.txt, 02_rand_17.txt, 02_rand_18.txt, 02_rand_19.txt, 02_rand_20.txt, 03_small_N_01.txt, 03_small_N_02.txt, 03_small_N_03.txt, 03_small_N_04.txt, 03_small_N_05.txt, 03_small_N_06.txt, 03_small_N_07.txt, 03_small_N_08.txt, 03_small_N_09.txt, 03_small_N_10.txt, 04_small_M_01.txt, 04_small_M_02.txt, 04_small_M_03.txt, 04_small_M_04.txt, 04_small_M_05.txt, 04_small_M_06.txt, 04_small_M_07.txt, 04_small_M_08.txt, 04_small_M_09.txt, 04_small_M_10.txt, 05_small_NM_01.txt, 05_small_NM_02.txt, 05_small_NM_03.txt, 05_small_NM_04.txt, 05_small_NM_05.txt, 05_small_NM_06.txt, 05_small_NM_07.txt, 05_small_NM_08.txt, 05_small_NM_09.txt, 05_small_NM_10.txt, 06_numerical_error_01.txt, 06_numerical_error_02.txt, 06_numerical_error_03.txt, 06_numerical_error_04.txt, 06_numerical_error_05.txt, 07_handmade_01.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 01_sample_01.txt |
AC |
9 ms |
3612 KiB |
| 01_sample_02.txt |
AC |
3 ms |
3548 KiB |
| 01_sample_03.txt |
AC |
2 ms |
3544 KiB |
| 01_sample_04.txt |
AC |
4 ms |
3616 KiB |
| 02_rand_01.txt |
AC |
47 ms |
7852 KiB |
| 02_rand_02.txt |
AC |
37 ms |
6664 KiB |
| 02_rand_03.txt |
AC |
48 ms |
8512 KiB |
| 02_rand_04.txt |
AC |
49 ms |
8908 KiB |
| 02_rand_05.txt |
AC |
21 ms |
4660 KiB |
| 02_rand_06.txt |
AC |
26 ms |
5032 KiB |
| 02_rand_07.txt |
AC |
41 ms |
6916 KiB |
| 02_rand_08.txt |
AC |
33 ms |
5796 KiB |
| 02_rand_09.txt |
AC |
43 ms |
7712 KiB |
| 02_rand_10.txt |
AC |
36 ms |
7056 KiB |
| 02_rand_11.txt |
AC |
49 ms |
8764 KiB |
| 02_rand_12.txt |
AC |
8 ms |
3692 KiB |
| 02_rand_13.txt |
AC |
34 ms |
6740 KiB |
| 02_rand_14.txt |
AC |
50 ms |
9232 KiB |
| 02_rand_15.txt |
AC |
18 ms |
4420 KiB |
| 02_rand_16.txt |
AC |
22 ms |
5096 KiB |
| 02_rand_17.txt |
AC |
10 ms |
3860 KiB |
| 02_rand_18.txt |
AC |
24 ms |
5328 KiB |
| 02_rand_19.txt |
AC |
23 ms |
5424 KiB |
| 02_rand_20.txt |
AC |
16 ms |
4476 KiB |
| 03_small_N_01.txt |
AC |
41 ms |
8432 KiB |
| 03_small_N_02.txt |
AC |
29 ms |
5640 KiB |
| 03_small_N_03.txt |
AC |
23 ms |
5720 KiB |
| 03_small_N_04.txt |
AC |
22 ms |
5864 KiB |
| 03_small_N_05.txt |
AC |
40 ms |
8168 KiB |
| 03_small_N_06.txt |
AC |
41 ms |
8440 KiB |
| 03_small_N_07.txt |
AC |
29 ms |
5768 KiB |
| 03_small_N_08.txt |
AC |
41 ms |
8516 KiB |
| 03_small_N_09.txt |
AC |
42 ms |
8968 KiB |
| 03_small_N_10.txt |
AC |
26 ms |
5684 KiB |
| 04_small_M_01.txt |
AC |
24 ms |
5856 KiB |
| 04_small_M_02.txt |
AC |
29 ms |
5296 KiB |
| 04_small_M_03.txt |
AC |
16 ms |
4004 KiB |
| 04_small_M_04.txt |
AC |
40 ms |
7172 KiB |
| 04_small_M_05.txt |
AC |
15 ms |
4028 KiB |
| 04_small_M_06.txt |
AC |
8 ms |
4000 KiB |
| 04_small_M_07.txt |
AC |
41 ms |
7748 KiB |
| 04_small_M_08.txt |
AC |
52 ms |
9548 KiB |
| 04_small_M_09.txt |
AC |
9 ms |
3820 KiB |
| 04_small_M_10.txt |
AC |
20 ms |
4816 KiB |
| 05_small_NM_01.txt |
AC |
32 ms |
6856 KiB |
| 05_small_NM_02.txt |
AC |
14 ms |
4368 KiB |
| 05_small_NM_03.txt |
AC |
35 ms |
7532 KiB |
| 05_small_NM_04.txt |
AC |
9 ms |
4104 KiB |
| 05_small_NM_05.txt |
AC |
22 ms |
5360 KiB |
| 05_small_NM_06.txt |
AC |
36 ms |
7560 KiB |
| 05_small_NM_07.txt |
AC |
46 ms |
9204 KiB |
| 05_small_NM_08.txt |
AC |
43 ms |
8628 KiB |
| 05_small_NM_09.txt |
AC |
10 ms |
4100 KiB |
| 05_small_NM_10.txt |
AC |
10 ms |
3856 KiB |
| 06_numerical_error_01.txt |
AC |
26 ms |
6324 KiB |
| 06_numerical_error_02.txt |
AC |
8 ms |
3728 KiB |
| 06_numerical_error_03.txt |
AC |
23 ms |
5636 KiB |
| 06_numerical_error_04.txt |
AC |
25 ms |
6740 KiB |
| 06_numerical_error_05.txt |
AC |
18 ms |
5532 KiB |
| 07_handmade_01.txt |
AC |
2 ms |
3548 KiB |