답안 #755981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
755981 2023-06-10T19:03:36 Z vjudge1 A Huge Tower (CEOI10_tower) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vl vector<long long>
#define vii vector<pair<int,int>>
#define vll vector<pair<long long,long long>>
#define pb push_back
#define ll long long
#define ld long double
#define nl '\n'
#define boost ios::sync_with_stdio(false)
#define mp make_pair
#define se second
#define fi first
#define fore(i, y) for(ll i = 0; i < y; i++)
#define forr(i,x,y) for(int i = x;i<=y;i++)
#define forn(i,y,x) for(ll i = y; i >= x; i--)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define clr(v,k) memset(v,k,sizeof(v))
#define rall(v) v.rbegin() , v.rend()
#define pii pair<int,int>
#define pll pair<ll , ll>

const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 1;

ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} // greatest common divisor (PGCD)
ll lcm(ll a , ll b) {return a * (b / gcd(a , b));} // least common multiple (PPCM)

// HERE IS THE SOLUTION
int query(string str);
string guess(int n , int s)
{
    string t = "";
    vector<char> let;
    fore(i , s+1)
    {
        string x = "";
        x+=(char)(i + 26);
        if(query(x) == 1)let.pb(i+26);
    }
    forr(i , 0 , sz(let) - 1)
    {
        string t = "  ";
        t[0] = let[i];
        forr(j , i + 1 , sz(let) - 1)
        {
            t[1] = let[j];
            if(query(t) == 1)
            {
                swap(let[i]  , let[j]);
            }
        }
    }
    string ans = "";
    for(auto c : let)
    {
        ans+=c;
    }
    return ans;
}


Compilation message

tower.cpp: In function 'std::string guess(int, int)':
tower.cpp:16:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | #define forr(i,x,y) for(int i = x;i<=y;i++)
......
   43 |     forr(i , 0 , sz(let) - 1)
      |          ~~~~~~~~~~~~~~~~~~~        
tower.cpp:43:5: note: in expansion of macro 'forr'
   43 |     forr(i , 0 , sz(let) - 1)
      |     ^~~~
tower.cpp:16:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | #define forr(i,x,y) for(int i = x;i<=y;i++)
......
   47 |         forr(j , i + 1 , sz(let) - 1)
      |              ~~~~~~~~~~~~~~~~~~~~~~~
tower.cpp:47:9: note: in expansion of macro 'forr'
   47 |         forr(j , i + 1 , sz(let) - 1)
      |         ^~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/ccbYV01y.o: in function `guess[abi:cxx11](int, int)':
tower.cpp:(.text+0x270): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: tower.cpp:(.text+0x386): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status