Submission #633657

# Submission time Handle Problem Language Result Execution time Memory
633657 2022-08-23T01:11:31 Z iee Sajam (COCI18_sajam) C++17
90 / 90
139 ms 3236 KB
// iee
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using db = double;
using ld = long double;
#define py puts("YES")
#define pn puts("NO")
#define pf puts("-1")
#define hh puts("")
#define fi first
#define se second
#define mkp make_pair
#define re =RD()
#define rd RD()
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define ep emplace
#define ci const int
#define vi vector<int>
#define fn for(int i=1;i<=n;++i)
#define rept(t) for(int I=t;I-->0;)
#define rep(stO,a,b) for(int stO=(a);stO<=(b);stO++)
#define Rep(stO,a,b) for(int stO=(a);stO<(b);stO++)
#define per(Orz,a,b) for(int Orz=(a);Orz>=(b);Orz--)
#define ina int n,a[N];
#define rna n=RD();fn a[i]=RD();
using namespace std;
void big(int &x,int y){if(y>x)x=y;}void sml(int &x,int y){if(y<x)x=y;}
int qpow(int a, int b, int p) { int res = 1 % p; while (b) { if (b % 2) res = 1ll * res * a % p; a = 1ll * a * a % p; b /= 2; } return res; }
int RD() { int x = 0, f = 1, ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + (ch - '0'); ch = getchar(); } return x * f; }
//ci p = 998244353 1000000007; int fac[N], inv[N], ifac[N]; int binom(int x, int y, int MOD = p) { if (x < y) return 0; return 1ll * fac[x] * ifac[y] % p * ifac[x - y] % p; } void init(int LIM = N - 1, int MOD = p) { fac[0] = ifac[0] = inv[1] = 1; rep(i, 1, LIM) fac[i] = 1ll * fac[i - 1] * i % MOD; rep(i, 2, LIM) inv[i] = 1ll * (MOD - MOD / i) * inv[MOD % i] % MOD; rep(i, 1, LIM) ifac[i] = 1ll * ifac[i - 1] * inv[i] % MOD; }
void work(int);

signed main() { int CASINPUT = 1;
  string op = R"(
                 )";if (op.size() == 19) cin >> CASINPUT; rep(CUR, 1, CASINPUT) work(CUR); }
ci N = 1005;
int n, k;
bool a[N][N];
char s[N][N];
void work(int CASE) {
 n re, k re;
 rep(i,1,n) {
  scanf("%s",s[i] + 1);
  rep(j,1,n) a[i][j] = (s[i][j] == 'o');
 }
 rept(100){
  rep(i,1,n) {
   int s = 0;
   rep(j,1,n)s += a[i][j];
   if(s*2 > n){
    rep(j,1,n) a[i][j] ^= 1;
   }
  }
  rep(j,1,n) {
   int s = 0;
   rep(i,1,n)s += a[i][j];
   if(s*2 > n) {
    rep(i,1,n)a[i][j] ^= 1;
   }
  }
  int tot = 0;
  rep(i,1,n) rep(j,1,n) tot += a[i][j];
  if (tot <= k)return (void)puts("DA");
 }
 puts("NE");
}

Compilation message

sajam.cpp: In function 'void work(int)':
sajam.cpp:51:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |   scanf("%s",s[i] + 1);
      |   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 2 ms 1236 KB Output is correct
3 Correct 3 ms 1500 KB Output is correct
4 Correct 6 ms 2876 KB Output is correct
5 Correct 3 ms 1492 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 28 ms 1520 KB Output is correct
8 Correct 115 ms 2960 KB Output is correct
9 Correct 6 ms 724 KB Output is correct
10 Correct 123 ms 3000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 440 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2244 KB Output is correct
2 Correct 6 ms 2620 KB Output is correct
3 Correct 4 ms 2004 KB Output is correct
4 Correct 4 ms 1876 KB Output is correct
5 Correct 7 ms 2772 KB Output is correct
6 Correct 32 ms 1616 KB Output is correct
7 Correct 76 ms 2280 KB Output is correct
8 Correct 83 ms 2400 KB Output is correct
9 Correct 17 ms 1236 KB Output is correct
10 Correct 137 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2684 KB Output is correct
2 Correct 5 ms 2624 KB Output is correct
3 Correct 3 ms 1980 KB Output is correct
4 Correct 4 ms 2228 KB Output is correct
5 Correct 5 ms 2348 KB Output is correct
6 Correct 130 ms 3100 KB Output is correct
7 Correct 28 ms 1436 KB Output is correct
8 Correct 74 ms 2132 KB Output is correct
9 Correct 78 ms 2260 KB Output is correct
10 Correct 139 ms 3088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1968 KB Output is correct
2 Correct 4 ms 2004 KB Output is correct
3 Correct 7 ms 3136 KB Output is correct
4 Correct 2 ms 1604 KB Output is correct
5 Correct 3 ms 2004 KB Output is correct
6 Correct 129 ms 3028 KB Output is correct
7 Correct 30 ms 1616 KB Output is correct
8 Correct 37 ms 1592 KB Output is correct
9 Correct 40 ms 1748 KB Output is correct
10 Correct 41 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 3236 KB Output is correct
2 Correct 7 ms 3156 KB Output is correct
3 Correct 7 ms 2904 KB Output is correct
4 Correct 5 ms 2132 KB Output is correct
5 Correct 4 ms 2180 KB Output is correct
6 Correct 83 ms 2324 KB Output is correct
7 Correct 33 ms 1636 KB Output is correct
8 Correct 106 ms 2772 KB Output is correct
9 Correct 57 ms 1876 KB Output is correct
10 Correct 125 ms 3068 KB Output is correct