제출 #1142828

#제출 시각아이디문제언어결과실행 시간메모리
1142828tkm_algorithmsHidden Sequence (info1cup18_hidden)C++20
100 / 100
2 ms416 KiB
/** * In the name of Allah * We are nothing and you're everything * author: najmuddin **/ #include <bits/stdc++.h> #include "grader.h" using namespace std; #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; //#define int ll const char nl = '\n'; const int N = 1e5+100; const int block = 317; const int cBlocks = N/block+5; //const int inf = 1e18; const int mod = 1e9+7; vector < int > findSequence (int n) { int one, zero; one = zero = 0; int k = n/2+1; //bool res; bool ok = 1; for (int i = 1; i <= 1000; ++i) { if (i > k){ok = 0; break;} vector<int> a; for (int j = 0; j < i; ++j)a.push_back(0); bool res = isSubsequence(a); if (res)zero = i; else break; } if (ok)one = n-zero; else { for (int i = 1; i <= 1000; ++i) { if (i > k){break;} vector<int> a; for (int j = 0; j < i; ++j)a.push_back(1); bool res = isSubsequence(a); if (res)one = i; else break; } zero = n-one; } vector<int> ans; int x, y; x = 0, y = 0; for (int j = 0; j < n; ++j) { if (x+1+(zero-y) <= k) { vector<int> a; for (int i = 0; i < x+1; ++i)a.push_back(1); for (int i = 0; i < zero-y; ++i)a.push_back(0); bool res = isSubsequence(a); if (res)ans.push_back(1), x++; else ans.push_back(0), y++; } else { vector<int> a; for (int i = 0; i < y+1; ++i)a.push_back(0); for (int i = 0; i < one-x; ++i)a.push_back(1); bool res = isSubsequence(a); if (res)ans.push_back(0), y++; else ans.push_back(1), x++; } } return ans; //11001101 //z o //3 5 //5 //1000 //11000 //0111 //00111 //1110 //11110 //0001 //00001 }

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

grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   28 |     fprintf (fifo_out, "%d\n", ans.size ());
      |                         ~^     ~~~~~~~~~~~
      |                          |              |
      |                          int            std::vector<int>::size_type {aka long unsigned int}
      |                         %ld
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...