제출 #162629

#제출 시각아이디문제언어결과실행 시간메모리
162629MvCPlus Minus (BOI17_plusminus)C++11
12 / 100
537 ms632 KiB
#pragma GCC target("avx2") #pragma GCC optimization("O3") #pragma GCC optimization("unroll-loops") #include <bits/stdc++.h> #define rc(x) return cout<<x<<endl,0 #define pb push_back #define mkp make_pair #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; typedef long double ld; const ll INF=0x3f3f3f3f3f3f3f3f; const ll llinf=(1LL<<62); const int inf=(1<<30); const int nmax=1e5+50; const int mod=1e9+7; using namespace std; int n,m,k,o[10],z[10],rs,i,x,y,b[10]; char c; void rec(int i) { if(i==n) { int bl=0,nr; for(int j=0;j<n-1;j++) { for(int t=0;t<m-1;t++) { nr=0; if(b[j]&(1<<t))nr++; if(b[j]&(1<<(t+1)))nr++; if(b[j+1]&(1<<t))nr++; if(b[j+1]&(1<<(t+1)))nr++; if(nr!=2) { bl=1; break; } } if(bl)break; } if(!bl) { rs++; /*for(int j=0;j<n;j++) { for(int t=0;t<m;t++) { if(b[j]&(1<<t))cout<<1; else cout<<0; } cout<<endl; } cout<<endl;*/ } return; } for(int j=0;j<(1<<m);j++) { if((o[i]&j)!=o[i] || (z[i]&j)!=0)continue; b[i]=j; rec(i+1); } } int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); cin>>n>>m>>k; for(i=1;i<=k;i++) { cin>>c>>x>>y; x--,y--; if(c=='+')o[x]|=(1<<y); else z[x]|=(1<<y); } rec(0); cout<<rs<<endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

plusminus.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
plusminus.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...