結果
問題 | No.421 しろくろチョコレート |
ユーザー |
![]() |
提出日時 | 2023-01-10 21:42:44 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 4,240 bytes |
コンパイル時間 | 3,712 ms |
コンパイル使用メモリ | 263,504 KB |
最終ジャッジ日時 | 2025-01-17 17:07:19 |
合計ジャッジ時間 | 4,725 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from /usr/include/c++/13/vector:63, from main.cpp:4: /usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/string:54, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/iomanip:42, from main.cpp:12: /usr/include/c++/13/bits/basic_string.h:181:14: note: called from here 181 | struct _Alloc_hider : allocator_type // TODO check __is_final | ^~~~~~~~~~~~
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <deque> #include <list> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <set> #include <map> #include <ctime> #include <stack> #include <functional> #include <cstdio> #include <string> #include <iostream> #include <limits> #include <stdexcept> #include <numeric> #include <fstream> #include <chrono> #include <utility> #include <cassert> #include <random> #include <time.h> using namespace std; // /* #include <atcoder/all> using namespace atcoder; using mint =modint998244353; //using mint =modint1000000009; //using mint =modint1000000007; #define ip(x) is_prime_constexpr(x) //istream &operator>>(istream &is, mint &a) { int v; cin >> v; a = v; return is; } //ostream &operator<<(ostream &os, const mint &a) { return os << a.val(); } // */ //template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; } //template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; } typedef long long ll; typedef unsigned long long ull; typedef long double LD; typedef double D; typedef pair<ll,ll> P; typedef map<ll,ll> M; void tatananonano() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(10); } #define LL(...) ll __VA_ARGS__; IN(__VA_ARGS__) #define STR(...) string __VA_ARGS__; IN(__VA_ARGS__) #define CHR(...) char __VA_ARGS__;IN(__VA_ARGS__) template <class T> void scan(T &a) { cin >> a; } void IN() {} template <class Head, class... Tail> void IN(Head &head, Tail &...tail) {scan(head);IN(tail...);} #define rep(i,n) for(ll i=0;i<n;i++) #define rrep(i,n) for(ll i=1;i<n;i++) #define jep(i, a, n)for (ll i =(ll)a; i<(ll)n;++i) #define drep2(i, m, n) for (int i = (n)-1; i >= (m); --i) #define drep(i, n) drep2(i,0,n) #define fore(i,a) for(const auto &i:a) #define all(x) (x).begin(),(x).end() #define pb push_back #define lb lower_bound #define ub upper_bound #define uni(x) sort(all(x));x.erase(unique(all(x)),x.end()) #define TFU(s) transform(all(s),begin(s),::toupper);//大文字にする #define TFL(s) transform(all(s),begin(s),::tolower);//小文字にする #define replace(s,a,A) replace(s,'a','A')//str(s)のaをAにする #define ROT(s,i) rotate(s.begin(),s.begin()+i,s.end())//sのi番目から後ろを前にする #define PQ priority_queue #define PQD PQ<P,vector<P>,greater<P>>//小さい順に吐く #define PQS PQ<ll,vec,greater<ll>>//小さい順に吐く #define fi first #define se second #define bit(n,k) ((n>>k)&1LL) #define printd(n,x) cout<<fixed<<setprecision(n)<<x<<endl #define cinv(a,n); rep(i,n){cin>>a[i];} #define popcount(n) __builtin_popcountll(n) template<class T> inline bool chmax(T& a,T b){if(a < b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T& a,T b){if(a > b){a=b;return 1;}return 0;} typedef vector<ll> vec; typedef vector<vec> mat; //const ll mod = 1000000009; const ll mod = 998244353; //const ll mod = 1000000007; const auto INF = (1LL<<(60)); ll modpow(ll a,ll n,ll mod){if(mod==1)return 0;ll ret=1;ll p=a%mod;while(n){if(n&1)ret=ret*p%mod;p=p*p%mod;n>>=1;}return ret; } M factor(ll n) {M ret;for(ll i=2;i*i<=n;i++){while(n%i==0){ret[i]++;n /= i;}}if(n != 1){ret[n]=1;}return ret;}//素因数分解 vec divisor(ll n){vec K;for(ll i=1;i*i<=n;i++){if(n%i==0){K.pb(i);if(i*i!=n)K.pb(n/i);}}sort(all(K));return K;}//約数列挙 ll dx[4]={0,1,0,-1},dy[4]={-1,0,1,0}; int main(){ //tatananonano(); LL(n,m); vector<string> s(n); rep(i,n){cin>>s[i];} vector<P> w,b; rep(i,n){ rep(j,m){ if(s[i][j]=='w'){w.pb({i,j});} if(s[i][j]=='b'){b.pb({i,j});} } } mf_graph<ll> mf(n*m+2); rep(i,w.size()){mf.add_edge(n*m,(w[i].fi*m)+w[i].se,1);} rep(i,b.size()){mf.add_edge((b[i].fi*m)+b[i].se,n*m+1,1);} rep(i,w.size()){ ll u=w[i].fi; ll v=w[i].se; rep(j,4){ if(0<=min(ll(u+dx[j]),ll(v+dy[j])) and ll(u+dx[j])<n and ll(v+dy[j])<m)if(s[u+dx[j]][v+dy[j]]=='b'){ mf.add_edge(u*m+v,(u+dx[j])*m+(v+dy[j]),1); } } } auto key=mf.flow(n*m,n*m+1); auto mx=max(w.size(),b.size()); auto mn=min(w.size(),b.size()); cout<<(key*100)+(mn-key)*10+(mx-mn)<<'\n'; }