답안 #484376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484376 2021-11-03T04:38:02 Z Carmel_Ab1 Martian DNA (IOI16_dna) C++17
0 / 100
1000 ms 588 KB
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef vector<vector<int>>vvi;
typedef vector<ll>vl;
typedef vector<vl> vvl;
typedef pair<int,int>pi;
typedef pair<ll,ll> pl;
typedef vector<pl> vpl;
typedef vector<ld> vld;
typedef pair<ld,ld> pld;
typedef vector<pi> vpi;

//typedef tree<ll, null_type, less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<typename T> ostream& operator<<(ostream& os, vector<T>& a){os<<"[";for(int i=0; i<ll(a.size()); i++){os << a[i] << ((i!=ll(a.size()-1)?" ":""));}os << "]\n"; return os;}

#define all(x) x.begin(),x.end()
#define YES out("YES")
#define NO out("NO")
#define out(x){cout << x << "\n"; return;}
#define GLHF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define print(x){for(auto ait:x) cout << ait << " "; cout << "\n";}
#define pb push_back
#define umap unordered_map

//#include "grader.cpp"
#include "dna.h"
string analyse(int n, int t) {
    string ans="0";
    if(!make_test("0"))
        return string(n,'1');

    while(1) {
        while (ans.size() < n) {
            if (make_test(ans + "0"))
                ans += '0';
            else
                ans += "1";
        }

        int l = 1, r = n, sz = -1;
        while (l <= r) {
            int m = (l + r) / 2;
            if (make_test(ans.substr(0, m - 1)))
                sz = m - 1, l = m + 1;
            else
                r = m - 1;
        }

        char c='0';
        if(ans.size()!=n)
            c='0'+'1'-ans[sz+1];
        ans = ans.substr(0, sz);
        if(ans.size()==n)
            break;
        if(!make_test(ans+c))
            break;
    }
    while(1){
        if(make_test("0"+ans))
            ans="0"+ans;
        else if(make_test("1"+ans))
            ans="1"+ans;
        else
            break;
    }
    assert(ans.size()==n);
    return ans;

}

Compilation message

dna.cpp: In function 'std::string analyse(int, int)':
dna.cpp:42:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         while (ans.size() < n) {
      |                ~~~~~~~~~~~^~~
dna.cpp:59:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   59 |         if(ans.size()!=n)
      |            ~~~~~~~~~~^~~
dna.cpp:62:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   62 |         if(ans.size()==n)
      |            ~~~~~~~~~~^~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from dna.cpp:1:
dna.cpp:75:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   75 |     assert(ans.size()==n);
      |            ~~~~~~~~~~^~~
grader.cpp: In function 'bool make_test(std::string)':
grader.cpp:14:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for (int i = 0; i < p.size(); i++) {
      |                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i = 1; i <= ss.size(); i++) {
      |                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   if (pr[i] == p.size()) {
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1094 ms 204 KB Time limit exceeded
2 Correct 0 ms 204 KB Output is correct
3 Execution timed out 1092 ms 204 KB Time limit exceeded
4 Runtime error 1 ms 332 KB Execution killed with signal 6
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Execution timed out 1089 ms 204 KB Time limit exceeded
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Runtime error 1 ms 332 KB Execution killed with signal 6
13 Correct 0 ms 204 KB Output is correct
14 Execution timed out 1096 ms 204 KB Time limit exceeded
15 Correct 1 ms 204 KB Output is correct
16 Runtime error 1 ms 332 KB Execution killed with signal 6
17 Correct 0 ms 204 KB Output is correct
18 Runtime error 1 ms 332 KB Execution killed with signal 6
19 Execution timed out 1093 ms 204 KB Time limit exceeded
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Execution timed out 1080 ms 204 KB Time limit exceeded
23 Runtime error 1 ms 332 KB Execution killed with signal 6
24 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1087 ms 204 KB Time limit exceeded
2 Correct 1 ms 204 KB Output is correct
3 Execution timed out 1090 ms 204 KB Time limit exceeded
4 Runtime error 1 ms 460 KB Execution killed with signal 6
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Execution timed out 1087 ms 204 KB Time limit exceeded
10 Correct 0 ms 204 KB Output is correct
11 Runtime error 1 ms 332 KB Execution killed with signal 6
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 324 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Runtime error 1 ms 460 KB Execution killed with signal 6
23 Correct 0 ms 204 KB Output is correct
24 Execution timed out 1094 ms 204 KB Time limit exceeded
25 Correct 0 ms 204 KB Output is correct
26 Runtime error 1 ms 460 KB Execution killed with signal 6
27 Correct 0 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Runtime error 1 ms 460 KB Execution killed with signal 6
34 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1082 ms 204 KB Time limit exceeded
2 Correct 0 ms 204 KB Output is correct
3 Execution timed out 1085 ms 204 KB Time limit exceeded
4 Runtime error 1 ms 332 KB Execution killed with signal 6
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Execution timed out 1088 ms 204 KB Time limit exceeded
10 Correct 0 ms 204 KB Output is correct
11 Runtime error 1 ms 332 KB Execution killed with signal 6
12 Execution timed out 1092 ms 204 KB Time limit exceeded
13 Correct 0 ms 204 KB Output is correct
14 Execution timed out 1090 ms 204 KB Time limit exceeded
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Incorrect 10 ms 348 KB Too many tests
23 Incorrect 18 ms 376 KB Too many tests
24 Incorrect 21 ms 372 KB Too many tests
25 Incorrect 24 ms 376 KB Too many tests
26 Incorrect 21 ms 332 KB Too many tests
27 Runtime error 6 ms 500 KB Execution killed with signal 6
28 Correct 5 ms 332 KB Output is correct
29 Execution timed out 1091 ms 372 KB Time limit exceeded
30 Correct 1 ms 204 KB Output is correct
31 Runtime error 8 ms 588 KB Execution killed with signal 6
32 Correct 6 ms 368 KB Output is correct
33 Incorrect 14 ms 332 KB Too many tests
34 Incorrect 16 ms 380 KB Too many tests
35 Incorrect 10 ms 332 KB Too many tests
36 Incorrect 16 ms 376 KB Too many tests
37 Incorrect 16 ms 384 KB Too many tests
38 Runtime error 6 ms 588 KB Execution killed with signal 6
39 Incorrect 15 ms 332 KB Too many tests