제출 #372221

#제출 시각아이디문제언어결과실행 시간메모리
372221cpp219Painting Squares (IOI20_squares)C++14
0 / 100
1 ms328 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> #define ll int #define ld long double #define fs first #define sc second using namespace std; typedef pair<ll,ll> LL; const ll N = 2e3 + 9; const ll mod = 1e9 + 7; vector<ll> g[N]; deque<ll> ans; ll b[N],pow2[N],p1,p2; void process(){ p1 = p2 = 0; for (ll i = 0;i < 9;i++) p1 += pow2[9 - i - 1]*b[i]; for (ll i = 1;i <= 9;i++) p2 += pow2[9 - i]*b[i]; g[p1].push_back(p2); } void f(ll i){ if (i > 9){ process(); return; } b[i] = 1; f(i + 1); b[i] = 0; f(i + 1); } void dfs(ll u){ while(g[u].size()){ ll v = g[u].back(); g[u].pop_back(); dfs(v); } ans.push_back(u%2); } void Init(ll n){ pow2[0] = 1; for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0); dfs(0); reverse(ans.begin(),ans.end()); for (ll i = 0;i < 8;i++) ans.push_front(0); while(ans.size() > n) ans.pop_back(); } vector<ll> paint(ll n){ vector<ll> a; if (!ans.size()) Init(n); for (auto i : ans) a.push_back(i); a.push_back(10); return a; } bool coincide(vector<ll> &c,ll l,ll r){ for (ll i = l;i <= r;i++) if (c[i - l] != ans[i]) return 0; return 1; } ll find_location(ll n,vector<ll> c){ if (!ans.size()) Init(n); for (ll i = 0;i < 10;i++) if (c[i] == -1) return n - i; for (ll i = 0;i < n - 10 + 1;i++){ if (coincide(c,i,i + 10 - 1)) return i; } } vector<ll> v; /* int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "tst" if (fopen(task".INP","r")){ freopen(task".INP","r",stdin); //freopen(task".OUT","w",stdout); } cin>>n; paint(n); /// 00000000001000000001 v.push_back(0); v.push_back(1); while(v.size() < 10) v.push_back(-1); cout<<find_location(n,v); } */

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

squares.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
squares.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
squares.cpp: In function 'void Init(int)':
squares.cpp:44:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   44 |     for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0);
      |     ^~~
squares.cpp:44:57: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   44 |     for (ll i = 1;i <= 10;i++) pow2[i] = pow2[i - 1]*2; f(0);
      |                                                         ^
squares.cpp:47:22: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |     while(ans.size() > n) ans.pop_back();
      |           ~~~~~~~~~~~^~~
squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   53 |     for (auto i : ans) a.push_back(i); a.push_back(10);
      |     ^~~
squares.cpp:53:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   53 |     for (auto i : ans) a.push_back(i); a.push_back(10);
      |                                        ^
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:68:1: warning: control reaches end of non-void function [-Wreturn-type]
   68 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...