Coinisi.

2.1万

MARKZHANG
Tnot
ㅤ_169

mzyy
zerozjh

sacave
Fluent
Susanna

kzyz
こんにちは
2208114119
dushucheng0901
zzlhh
Plankton
Cfpl_Lmd

Coinisi.
2个月前
//这里填你的代码^^
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <unordered_map>
#include <unordered_set>

//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#define IOS std::ios::sync_with_stdio(false)
#define pb push_back
#define inf 0x3f3f3f3f
#define YES cout << "YES" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
#define int long long
#define x first
#define y second
#define cmp [&](PII a, PII b){ return a.y < b.y; }

const int N = 5e5+10, mod = 1e9+7, M = 1e6+5, K = 1e5+10, Z = 2e5+7, Q = 1e4+7;

using namespace std;
typedef long long LL;
typedef priority_queue<int> PQI;
typedef priority_queue <int, vector<int>, greater<>> PQGI;
typedef pair<int, int> PII;

int a[Z];

void solve()
{
int n; cin >> n;
memset(a, 0, sizeof a);
for(int i = 1; i <= n; i ++)
{
int x; cin >> x;
x = min(x, i);
int l = i - x + 1, r = i;
a[l] ++, a[r + 1] --;
}
for(int i = 1; i <= n; i ++) a[i] += a[i - 1];
for(int i = 1; i <= n; i ++)
if(a[i] >= 1) cout << 1 << ' ';
else cout << '0' << ' ';
cout << endl;
}

signed main()
{
int T = 1;
cin >> T;
while(T --) solve();
return 0;
}


Coinisi.
2个月前
2023年三月28日，Acwimg APP内测，第一次登录！

Coinisi.
2个月前
//这里填你的代码^^
#include <iostream>
#include <cmath>
#include <algorithm>
#define int long long
using namespace std;

const int N = 1e6 + 7;

int primes[N], cnt;
bool st[N];

void get_primes(int n)
{
for(int i = 2; i <= n; i ++)
{
if(st[i]) continue;
primes[cnt ++] = i;
for(int j = i + i; j <= n; j += i)
st[j] = true;
}
}

void solve(int u)
{
// cout << (int)sqrt(u) << "---" << st[(int)sqrt(u)] << "---" << endl;
if((int)sqrt(u) * (int)sqrt(u) == u && !st[(int)sqrt(u)]) cout << "YES" << endl;
else cout << "NO" << endl;
return;

}

signed main()
{
get_primes(N-7);
int n; cin >> n;
for(int i = 1; i <= n; i ++)
{
int x; cin >> x;
if(x == 1) {cout << "NO" << endl; continue;}
solve(x);
}
return 0;
}
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~


Coinisi.
2个月前
//这里填你的代码^^
#include <iostream>

using namespace std;

int main()
{
int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
cout << max(abs(x1 - x2), abs(y1 - y2)) << endl;
return 0;
}
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~


Coinisi.
2个月前
#include <iostream>

using namespace std;

int main()
{
int n, k; cin >> n >> k;

int t = n / k;

for(int i = t; ; i ++)
if(k * i > n) {cout << k * i << endl; return 0;}

return 0;
}


Coinisi.
2个月前
//这里填你的代码^^
#include <iostream>

using namespace std;

const int N = 100000 + 8;

int a[N], b[N];

void insert(int l, int r, int w)
{
b[l] = b[l] + w, b[r + 1] = b[r + 1] - w;
}

int main()
{
int n, m; cin >> n >> m;

for(int i = 1; i <= n; i ++)
cin >> a[i];

for(int i=1;i<=n;i++) insert(i,i,a[i]);

for(int i = 1; i <= m; i ++)
{
int l, r, c; cin >> l >> r >> c;
insert(l, r, c);
}
for(int i = 1; i <= n; i ++)
b[i] = b[i - 1] + b[i];

for(int i = 1; i <= n; i ++)
cout << b[i] << ' ';

cout << endl;
return 0;
}
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~


Coinisi.
3个月前
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <unordered_map>
#include <unordered_set>

//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#define IOS std::ios::sync_with_stdio(false)
#define pb push_back
#define inf 0x3f3f3f3f
#define YES cout << "YES" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
// #define int long long
//#define x first
//#define y second
#define cmp [&](PII a, PII b){ return a.y < b.y; }

const int N = 5e5+10, mod = 1e9+7, M = 1e6+5, K = 1e5+10, Z = 2e5+7, Q = 1e4+7;

using namespace std;
typedef long long LL;
typedef priority_queue<int> PQI;
typedef priority_queue <int, vector<int>, greater<>> PQGI;
typedef pair<int, int> PII;

int a[5002][5002];

void solve()
{
int n, r; cin >> n >> r;
r = min(r, 5001);
for(int i = 1; i <= n; i ++)
{
int x, y, w;
cin >> x >> y >> w;
x ++, y ++;
// a[x + 1][y + 1] += w;
a[x][y] += w;
}

for(int i = 1; i <= 5001; i ++)
for(int j = 1; j <= 5001; j ++)
a[i][j] = a[i][j] + a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];

int max_prize = 0;
for(int i = r; i <= 5001; i ++)
for(int j = r; j <= 5001; j ++)
max_prize = max(max_prize, a[i][j] - a[i - r][j] - a[i][j - r] + a[i - r][j - r]);

cout << max_prize << endl;
}

signed main()
{
IOS; cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
// cin >> T;
while( T -- ) solve();
return 0;
}
//这里填你的代码^^
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~


Coinisi.
3个月前
//这里填你的代码^^
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <unordered_map>
#include <unordered_set>

//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#define IOS std::ios::sync_with_stdio(false)
#define pb push_back
#define inf 0x3f3f3f3f
#define YES cout << "YES" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
#define int long long
#define x first
#define y second
#define cmp [&](PII a, PII b){ return a.y < b.y; }

const int N = 5e5+10, mod = 1e9+7, M = 1e6+5, K = 1e5+10, Z = 2e5+7;

using namespace std;
typedef long long LL;
typedef priority_queue<int> PQI;
typedef priority_queue <int, vector<int>, greater<>> PQGI;
typedef pair<int, int> PII;

int a[K], s[K];
int modd[K];

void solve()
{
int n, k; cin >> n >> k;
modd[0] = 1;
for(int i = 1; i <= n; i ++)
{
cin >> a[i];
s[i] = (s[i - 1] % k + a[i] % k) % k;
modd[s[i]] ++;
}

int cnt = 0;
for(int i = 0; i <= k - 1; i ++)
cnt = cnt + modd[i] * (modd[i] - 1) / 2;

cout << cnt << endl;
return;
}

signed main()
{
IOS; cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
// cin >> T;
while( T -- ) solve();
return 0;
}
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~


Coinisi.
3个月前
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <unordered_map>
#include <unordered_set>

//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#define IOS std::ios::sync_with_stdio(false)
#define pb push_back
#define inf 0x3f3f3f3f
#define YES cout << "YES" << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
#define int long long
#define x first
#define y second
#define cmp [&](PII a, PII b){ return a.y < b.y; }

const int N = 5e5+10, mod = 1e9+7, M = 1e6+5, K = 1e5+10, Z = 2e5+7;

using namespace std;
typedef long long LL;
typedef priority_queue<int> PQI;
typedef priority_queue <int, vector<int>, greater<>> PQGI;
typedef pair<int, int> PII;

int a[K], s[K];
int modd[K];

void solve()
{
int n, k; cin >> n >> k;
modd[0] = 1;
for(int i = 1; i <= n; i ++)
{
cin >> a[i];
s[i] = (s[i - 1] % k + a[i] % k) % k;
modd[s[i]] ++;
}

int cnt = 0;
for(int i = 0; i <= k - 1; i ++)
cnt = cnt + modd[i] * (modd[i] - 1) / 2;

cout << cnt << endl;
return;
}

signed main()
{
IOS; cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
// cin >> T;
while( T -- ) solve();
return 0;
}


Coinisi.
3个月前
//这里填你的代码^^
//注意代码要放在两组三个点之间，才可以正确显示代码高亮哦~
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstring>

#define IOS std::ios::sync_with_stdio(false)
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

const int N = 1010;

int n, m, q;
int a[N][N];

signed main()
{
IOS; cin >> n >> m >> q;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
cin >> a[i][j];

for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
a[i][j] = a[i][j] + a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];

while(q -- )
{
int x1, x2, y1, y2; cin >> x1 >> y1 >> x2 >> y2;
cout << a[x2][y2] - a[x1 - 1][y2] - a[x2][y1 - 1] + a[x1 - 1][y1 - 1] << endl;
}

return 0;
}