답안 #573231

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573231 2022-06-06T09:37:49 Z Sho10 저장 (Saveit) (IOI10_saveit) C++17
50 / 100
347 ms 15696 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "grader.h"
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=6700417;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<ll>g[1005];
ll d[1005],ans[1005][1005],sum=0;
string calc(ll x){
    string res="";
for(ll i=0;i<10;i++)
{
    if((1ll<<i)&x){
        res+='1';
    }else res+='0';
}
reverse(res.begin(),res.end());
return res;
}
void encode(int n, int h, int m, int *v1, int *v2){
for(ll i=0;i<m;i++)
{
    g[v1[i]].pb(v2[i]);
g[v2[i]].pb(v1[i]);
}
for(ll i=0;i<h;i++)
{
    for(ll j=0;j<=n;j++)
    {
        d[j]=LINF;
    }
    queue<ll>q;
    q.push(i);
    d[i]=0;
    while(!q.empty()){
ll x=q.front();
ans[i][x]=d[x];
q.pop();
for(auto it : g[x]){
    if(d[it]==LINF){
        d[it]=d[x]+1;
        q.push(it);
    }
}
    }
}
for(ll i=0;i<h;i++)
{
    for(ll j=0;j<n;j++)
    {
        string s1=calc(ans[i][j]);
        while(s1.size()<10){
            s1=" "+s1;
        }
        for(auto it : s1){
            encode_bit(it-'0');
        }
    }
   // cout<<endl;
}
}
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "grader.h"
#include "decoder.h"
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=6700417;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll ans[1005][1005];
void decode(int n,int h){
for(ll i=0;i<h;i++)
{
    for(ll j=0;j<n;j++)
    {
        string s="";
for(ll k=0;k<10;k++)
{
    ll x=decode_bit();
    s+=(x+'0');
}
    reverse(s.begin(),s.end());
    ll pw=0;
    ll val=0;
    for(ll k=0;k<s.size();k++)
    {
        if(s[k]=='1'){
            val+=(1ll<<pw);
        }
        pw++;
    }
    hops(i,j,val);
}
}
}

Compilation message

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:37:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(ll k=0;k<s.size();k++)
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 347 ms 15696 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 65 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 71 ms 7896 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 72 ms 8100 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 78 ms 8640 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 77 ms 7840 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 80 ms 7888 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 8184 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 73 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8976 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 7904 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 81 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 95 ms 8700 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 87 ms 8760 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 92 ms 9112 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 77 ms 8496 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 106 ms 9652 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 9788 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 103 ms 8948 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 130 ms 10244 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 347 ms 15696 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 65 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 71 ms 7896 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 72 ms 8100 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 78 ms 8640 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 77 ms 7840 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 80 ms 7888 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 8184 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 73 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8976 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 7904 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 81 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 95 ms 8700 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 87 ms 8760 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 92 ms 9112 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 77 ms 8496 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 106 ms 9652 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 9788 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 103 ms 8948 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 130 ms 10244 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 347 ms 15696 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 65 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 71 ms 7896 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 72 ms 8100 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 78 ms 8640 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 77 ms 7840 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 80 ms 7888 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 8184 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 73 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8976 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 7904 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 81 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 95 ms 8700 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 87 ms 8760 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 92 ms 9112 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 77 ms 8496 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 106 ms 9652 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 9788 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 103 ms 8948 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 130 ms 10244 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 347 ms 15696 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 65 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 71 ms 7896 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 72 ms 8100 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 78 ms 8640 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 77 ms 7840 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 80 ms 7888 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 8184 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 73 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8976 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 7904 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 81 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 95 ms 8700 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 87 ms 8760 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 92 ms 9112 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 77 ms 8496 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 106 ms 9652 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 9788 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 103 ms 8948 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 130 ms 10244 KB Output is partially correct - 360000 call(s) of encode_bit()