Submission #399756

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3997562021-05-06 14:34:48Sorting Martian DNA (BOI18_dna)C++17
100 / 100
39 ms2720 KiB
#include <bits/stdc++.h>
using namespace std;
template<typename T> void check_min(T &a, const T &b){ a = (a < b) ? a : b; }
template<typename T> void check_max(T &a, const T &b){ a = (a > b) ? a : b; }
typedef long long ll;
#define all(x) (x).begin(), (x).end()
int read_int();
const int N = 2e5 + 3;
int n, k, r, a[N];
int mn[N], cnt[N], cnt_ok;
void add(int x){
++cnt[x];
if(cnt[x] == mn[x]) ++cnt_ok;
}
void rem(int x){
if(cnt[x] == mn[x]) --cnt_ok;
--cnt[x];
}
bool check(int mid){
fill(cnt, cnt + k, 0);
cnt_ok = k - r;
for(int i = 0; i < mid; ++i)
add(a[i]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

dna.cpp: In function 'void next_char()':
dna.cpp:68:39: warning: ignoring return value of 'size_t fread(void*, size_t, size_t, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   68 | void next_char(){ if(++ptr == N) fread(buff, 1, N, stdin), ptr = 0; }
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...