QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#268142#4582. Uniform MakerSorahISAAC ✓1ms3548kbC++207.3kb2023-11-28 09:35:302023-11-28 09:35:30

Judging History

你现在查看的是最新测评结果

  • [2023-11-28 09:35:30]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3548kb
  • [2023-11-28 09:35:30]
  • 提交

answer

#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA

void solve() {
    int N, M; cin >> N >> M;
    
    Vec<2, int> cnt(M, 26, 0);
    for (int i = 0; i < N; ++i) {
        string S; cin >> S;
        for (int j = 0; j < M; ++j) ++cnt[j][S[j] - 'a'];
    }
    
    int ans = 0;
    for (int j = 0; j < M; ++j) ans += (N - *max_element(ALL(cnt[j])));
    print(ans);
}

int32_t main() {
    fastIO();
    
    int t = 1; // cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
    
    return 0;
}

#else

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;

#define int int64_t
// #define double __float80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;

// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())

template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
    static_assert(D >= 1, "Vector dimension must be greater than zero!");
    template <typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(args...)) {}
};

template <typename T> struct Vec<1, T> : vector<T> {
    Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};

template <class F>
inline constexpr decltype(auto) lambda_fix(F&& f) {
    return [f = std::forward<F>(f)](auto&&... args) {
        return f(f, std::forward<decltype(args)>(args)...);
    };
}

#ifdef local
#define fastIO() void()
#define debug(...) \
    _color.emplace_back("\u001b[31m"), \
    fprintf(stderr, "%sAt [%s], line %d: (%s) = ", _color.back().c_str(), __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), _color.pop_back(), \
    fprintf(stderr, "%s", _color.back().c_str())
#define print(...) \
    fprintf(stdout, "%s", "\u001b[36m"), \
    _P(__VA_ARGS__), \
    fprintf(stdout, "%s", "\u001b[0m")

deque<string> _color{"\u001b[0m"};

template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
template <typename T> concept is_iterable = requires (T _t) {begin(_t);};

template <typename T> inline void _print_err(T &&_t);
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t);
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu);

inline void _do() {cerr << "\n";};
template <typename T> inline void _do(T &&_t) {_print_err(_t), cerr << "\n";}
template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) {_print_err(_t), cerr << ", ", _do(_u...);}
#else
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(...) void()
#define print(...) _P(__VA_ARGS__)
#endif

inline void _P() {cout << "\n";};
template <typename T> inline void _P(T &&_t) {cout << _t << "\n";}
template <typename T, typename ...U> inline void _P(T &&_t, U &&..._u) {cout << _t << " ", _P(_u...);}

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline int getRand(int L, int R) {
    if (L > R) swap(L, R);
    return (int)(rng() % ((uint64_t)R - L + 1) + L);
}

template <typename T, typename U> bool chmin(T &lhs, U rhs) {return lhs > rhs ? lhs = rhs, 1 : 0;}
template <typename T, typename U> bool chmax(T &lhs, U rhs) {return lhs < rhs ? lhs = rhs, 1 : 0;}

/// below are Fast I/O and _print_err templates ///

/*
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///

#include <unistd.h>

const int S = 65536;

int OP = 0;
char OB[S];

inline char RC() {
    static char buf[S], *p = buf, *q = buf;
    return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
}

inline int RI() {
    static char c;
    int a;
    while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
    if (c == '-') {
        a = 0;
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
    }
    else {
        a = c ^ '0';
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
    }
    return a;
}

inline void WI(int n, char c = '\n') {
    static char buf[20], p;
    if (n == 0) OB[OP++] = '0';
    p = 0;
    if (n < 0) {
        OB[OP++] = '-';
        while (n) buf[p++] = '0' - (n % 10), n /= 10;
    }
    else {
        while (n) buf[p++] = '0' + (n % 10), n /= 10;
    }
    for (--p; p >= 0; --p) OB[OP++] = buf[p];
    OB[OP++] = c;
    if (OP > S-20) write(1, OB, OP), OP = 0;
}

/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
*/

#ifdef local

template <typename T> inline void _print_err(T &&_t) {cerr << _t;}

template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "[";
    for (bool _first = true; auto &_x : _t) {
        if (!_first) cerr << ", ";
        _print_err(_x), _first = false;
    }
    cerr << "]" << (_color.pop_back(), _color.back());
}

template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu) {
    string _tmp_color = _color.back();
    ++_tmp_color[3], _color.emplace_back(_tmp_color);
    cerr << _color.back() << "(";
    _print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
    cerr << ")" << (_color.pop_back(), _color.back());
    return os;
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
    if (!I) {
        string _tmp_color = _color.back();
        ++_tmp_color[3], _color.emplace_back(_tmp_color);
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

#endif

#endif

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3372kb

input:

6 4
calf
palm
book
icpc
ball
room

output:

14

result:

ok single line: '14'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

3 11
goodluckfor
icpcjakarta
contestants

output:

19

result:

ok single line: '19'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

5 14
helpiamtrapped
inanincfactory
forthreemonths
withoutfoodand
drinkandshower

output:

49

result:

ok single line: '49'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3364kb

input:

2 1
o
o

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3428kb

input:

40 6
xscwqh
djjjit
rguenl
hhxvjg
tnoyfq
ownyjt
asdzdz
slsbph
rdlksd
jpcjyx
bzaozh
dpgxfk
pozhhl
zkagxn
sihjxn
atqiiy
zwebxg
ilxcnj
ntkrnq
ysxfri
qrowho
dhwaqs
haljan
oxjcnk
dalixq
ahzfrd
cphsor
sykafq
lpzpvz
xarslv
rnqiau
xcolzn
jsuclf
vkoqxx
wqidkz
owqnjx
oodyrv
hzbxda
ceikgy
ohxepx

output:

214

result:

ok single line: '214'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3472kb

input:

61 45
gxpedrilqbjsxgwblbnbmxetlxersnnhizajpmqjazzer
ihrfbypimkhqgxnljylpilzpdjcriqpvrkkazzjlsyqrv
gzoxytcshicdtbagdlgnwueyldicppytywbypzxkujfdt
rerxwaccmqpjgcezwxbhmmdmlnzzlcwbdmhlkgkbrdiws
kqjkaljprbqvxqrsinicvkukhisaotkcnpcsrqayxcrwx
aanykynujzejawnuvsjqfhcnchfacagdbnbfwjeboxuxl
xdifsllnhjbuktkyea...

output:

2485

result:

ok single line: '2485'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3440kb

input:

72 49
mppvddwntczohpfodjzwuietolkuduevzrhtyubtlkdfazogc
zscsvefyvsbhwsktyiqjnjoqnxderweavrbkyudsembqdnovj
mynjgypbhfpveeegkjlpgkdgbmanhzmrsemtxzadeeicphwsj
igcbqvujkorzpaqdkumuvupnczaknpobvkssfguyqrghntgcs
zhbmyxgztyaugdtmnzcjkejeooravumkkfdhuusakuntrceva
eidpemasnvjmddwwnojtnsvzehwspjqkpffieymhjggp...

output:

3207

result:

ok single line: '3207'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

33 22
bsilkickfqgjfnjbdrtdie
dspzexblehklsoqgasuaiy
rsawkiayvzeerohwdbyupa
xrhcvcyhkjxnibikzyymfz
vyihzvwjxqoihffpnwrytg
ernvlffnoxhwnafqxqizpr
doqehgyvkbpafpwruvgnxv
bvtklcvtmzbwfqzcipeaup
bvbthqbdzervnpunrfelfp
wqisltkqbesoobrphzkgfk
khqoybrznukqcvmfewpzsq
yohlkqerwovtujbvoqgide
umflnhnpfamibqaawo...

output:

635

result:

ok single line: '635'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

79 90
ksmlllnmnthxulpmivvwbqxsteprtcpsueyllhaclavyjhdxrurfkpdzwaxaemavmgghuyoeevrqkumavmynjfxutv
leavuqnmltcuojumimqwdmxskessutzsquvlyhacntvnjsduhqrzrpdppixvemjemxgtnkoeqncqydiwcynsjviuts
ksmlhnpmntgpulwrnjqfdqhstisrynpmquuhliaqrtohyhecrizzjnipazlvmddvaxxtnylfcsjqkxpwcyqvdrxzyc
lelruqpmntglujwznvqfc...

output:

4765

result:

ok single line: '4765'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

80 86
mznirypdgjejjgdebcsqnfmwjakrecfanoqxkeasdjcxikjrznhfjnxigmgzkmswgrujgquxrnazusqdfqjozg
pywehnxkqyefeqtevxynsqjejfedglkgsomnsefzlfgdkqidsnhgqjxiaohofagjzjwjmiubdjfjhjcurhuchl
yvatruoklfeueoinmmsczhvgdfovgqpxveyxkexqiyxkiqidqihgrryoxmhgtpealzmtgqnydjmwuzdbahjxyw
glxkryteuyemfqddgmwknkjwdrjigwfhv...

output:

5700

result:

ok single line: '5700'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3388kb

input:

68 97
tvwqmgmylvewycfkyuzhjurughmljtldcvpruvwfoixbaorptjbqszvthrkbphoxnyqvyliqgkbgaujxxqlgfuinhhzzjngfm
blazjgnimsfzcpfzsgsgnmojszmxlufcapejiuxcxcoqichvwvwzknstqjwlvfzeuztbdnudvisjejswcgagfynnbjwnopiff
tqzctklohhxxcdhkkkshhfzpovwsozkobdstcipcnsesdppgoyqhryfwdbqlrhbrotuhuxstigohjiwqhircfaqndmiyjbqhf
...

output:

5738

result:

ok single line: '5738'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

70 90
olkfdsmscwiudgkrpcbyeueodkgzzsmuzlsjofikpjcnkytvewxhbstpttfcjlexegrnykzrevbtwshgmnuowlkevi
iirotttercrqsjcpljzmoibiebsuwebxmpxsofoxbooxmnfcemnvkapnejjzllvpykvhjwqnlyaoyluddcjoqpuila
owwgfhfrscjmiwkjbrbulkququggzlbvykijefxttzupgusctilhfltoktcxlnsxmgzhgvdvtxifadqkzcdzpfibix
jwrsfsanswddticrbctai...

output:

5235

result:

ok single line: '5235'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

100 100
ababaabbbbaababbbbaaabaabaaaaabbaabbabbabbbbaaabbbbbaaabaaabababababaaabbabbbbbaaaababaaaaaaabaaabaa
aabbbabbabababbabababaaaabaabbaabbababbbabbbbbaaabbbbaababbabbbaabaaabbabaabbabbbaabbbaaabaabaabbaab
bbabababaaababbabbaaababbaabababbbabaabbbbbaaababbaaabbabaaabaaaaababbaaababababaaaabbabab...

output:

4578

result:

ok single line: '4578'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

100 100
dftpeaalqzhuzuoxrkkhbyaqndxzortumgjmjdojaoskobvsdugktgerdoprqjtqwkaohhakthlqweypmpqvmtfaipmczbkvlgst
xzyzpsmokvfetzmfzsqbpddftllfatehxjbrgapygjigfukjljchxcjskpyzxqxaymhauiyniyoawzpxtrxcmznobapvifjhjpwd
iysrdibtmwkvypfuwetqcjqhpdobbaxwtrprdpgjwjlhfijscmwthclmzklapeqcfjwsuqspimocrojfywefnvsooj...

output:

9171

result:

ok single line: '9171'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

2 1
s
u

output:

1

result:

ok single line: '1'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

100 100
xescvdcxudqumidmdgmnqfbxfviejvftmqviopofscbjyzkiabytowlqsquyhkqhrhpbbabbefvbjtviysgjfgaiucyhcthcbzos
ydnjpfxymdnavjdyoubnffjqukxrzvnrivcjiycfewvbzduwbnywgggweajqurovufxyuuwremmavxhkrvixgkcbicyhrnhvtgqm
lzxuvuvnnvcikhrlbemgqoonynsxozaxavdiunotmkqcfzyywcwtmywcqaerirugbgciwezpnudnjlkiyyaautsjgw...

output:

7883

result:

ok single line: '7883'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

100 100
axdiqbkcxgwawvubkmufqocdphkwviishvdmmoqnxjpzkdjukmxzdokrwhxucksfmprqukxtqzjoagiuuxkmgcpxcmuktrqmfowk
azafqbkwjgqxwvubkaufqxtiwlkmvisshfdeqttfbjpkddjuemenvokrmhjhyiqfyprqekyzqzjoskgbuxkmbgpwkmukksmkkowl
awdiqbkwrgwxwvujuaugqociwlkmkpiyhnsmquvnbvpwuhevymeedokrwhxuzkqwmprsukyzqojmakoumfkrdcpxkm...

output:

2976

result:

ok single line: '2976'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3520kb

input:

100 100
cbhpdvssjrpqjmavmejyvuujnhfmuvorrysrcwjaupwvcdcpscxfitcfshkpzrxecfleylgxrifofqqgobsrjddnppzxnsajvuvi
cdhpdvsbfrpijmavmfjyvuujnhfmuvyhrysccwjwdpwvadcpscbeitcfshkphqxehfleylgtrifofqdgobsrfddeppzxgfgjvuvi
cbhpdvsbjrpijmamsfjyvuujnhfmuvohrssrcvmadhwkadzpxcbgitcfshkpzrxecfleylgtrkfofqqgobspfddncp...

output:

1013

result:

ok single line: '1013'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3396kb

input:

100 100
rrjtosvogmeeroxcuwcqfeokysmojwaqykozyowbzshirekmzmihvwfvofmcwsoggamybhfkctfdsutistyfrfwkmbqdvzeukerl
rrjtosvogmeeroxcuwcqfeokysmojwaqykozyowbzshirekmzmiuvwfvofmcwsoggamybhfkctfdsubistyfrfwkmbqdvkeukerl
rrjtosvogmeeroxcuwcqfeokysmojwaqykozyowbzshirekmzmiuvwfvofmcwsoggamybhfkctfdsutistyfrfwkmb...

output:

106

result:

ok single line: '106'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3400kb

input:

100 100
nzebhdezrjnhrjxhhwqmjftcoxhsevtmobtlaaehhgpwxfyzieoujqsllvfacacroiwwaonefqftvoskhcuianvsgoxilyqhjwbn
nzebhdezrjnhrjxhhwqmjftcoxhsevtmobtlaaehhgpwxfyzieoujqsllvfacacroiwwaonefqftvoskhcuianvsgoxilyqhjwbn
nzebhdezrjnhrjxhhwqmjftcoxhsevtmobtlaaehhgpwxfyzieoujqsllvfacacroiwwaonefqftvoskhcuianvsgo...

output:

0

result:

ok single line: '0'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

100 100
bomfenhyqlngsltnxklncetcdmifzltzbsxfhkvdfdtcdaltonyauxdwxpjupetfpggncddbtvsxobfosfequlptqcpinqaxtqgu
fyiqiadjkflwmnielpjpvaonmdhaoycbfyeqdnmjlbhffdzbeflnttefhtgegwqdkurfumvlfpnoprxhzeobddsveiluxfxysnas
mqcrdvfbnqwevgbzwidatimstssdkxrdwoakyxrnsejgazpxxscwwjwbfgahzvnefsdrxvhpanitchysmxjfkgflag...

output:

9600

result:

ok single line: '9600'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

3 2
xy
uy
ux

output:

2

result:

ok single line: '2'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

10 5
ccded
ececd
dbcbe
aebbc
deccc
beeab
adabe
edaee
ecdec
cddad

output:

35

result:

ok single line: '35'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

2 100
qpdnytnckmgeutlfodaiqdpfqkyxrljplxscbzrqrefjdtipjioalqzycqfqezqpgkmmgqeicrridufyjrvacqvrczzwmnzbplta
blhzdjhmdriwkxbfsoowgnnxcxocyhiarvdqsvhgekpoaevjadrohsthzlgtokpxoqfxyrllwzsdhtvkkrwgpiwzspsrnnyfqklq

output:

97

result:

ok single line: '97'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3448kb

input:

2 100
ecvdqsgbmmqakcalgandcuvooxraxthgjhdjdgtghjtowcwcbkvnqxusafauizhcwzjojlyrtepmiqroadkhbkbwrkrnxtaxhmuk
ecvdqsfgmmqawfalqlndcuvgoxgaxthgjhdjdvsmhjfowcwabkvyqyusafhurpxbwzjojlyitepmihroadkhplbwnkrnptaxhmuk

output:

26

result:

ok single line: '26'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3460kb

input:

100 1
y
m
y
s
u
m
q
s
w
m
h
v
w
f
q
u
a
z
j
w
d
u
z
z
m
t
m
a
q
h
j
k
d
l
v
h
e
k
n
d
f
z
c
k
w
o
z
i
y
u
x
k
u
j
i
k
c
h
k
u
g
y
d
i
b
y
s
a
a
n
u
h
d
w
c
g
c
r
r
v
g
l
k
t
o
v
w
j
s
c
h
g
d
p
b
m
h
m
g
l

output:

93

result:

ok single line: '93'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

100 1
y
c
y
c
k
x
y
x
k
u
y
c
u
u
c
c
x
c
k
c
c
x
u
x
u
y
u
x
k
x
u
u
c
y
k
u
c
c
y
u
y
y
k
x
y
y
y
k
u
c
y
u
c
y
y
y
u
y
u
c
c
x
y
u
x
x
u
k
u
u
u
k
y
y
u
y
k
k
u
y
k
c
k
x
u
k
y
c
y
c
y
x
c
c
u
c
c
x
c
u

output:

75

result:

ok single line: '75'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3388kb

input:

2 80
iyglnpywolcyqowvexzvcecqqkybyllgswtahydjljkanevknyrcpycwclbicggpvananlqbogafpgud
jamdzqgzjzbkievqumqzjbiuuhbgrrjgqrynwlmolhvstkljzvjykbtgljyvgzjzsxxhdzggfcmyxgjr

output:

77

result:

ok single line: '77'