Submission #565034

#TimeUsernameProblemLanguageResultExecution timeMemory
565034almothana05Saveit (IOI10_saveit)C++14
50 / 100
1026 ms13360 KiB
#include "grader.h" #include "encoder.h" #include<bits/stdc++.h> using namespace std; int gr[1001][1001]; string bi(int x){ string cmp; while(x){ if(x % 2 ==0){ cmp += '0'; } else{ cmp += '1'; } x /= 2; } while(cmp.size() < 10){ cmp += '0'; } return cmp; } void encode(int nv, int nh, int ne, int *v1, int *v2){ string s; for(int i = 0 ; i < 1001 ; i++){ for(int j = 0 ; j< 1001 ; j++){ gr[i][j] = 3000; } } for(int i = 0 ; i < ne ; i++){ gr[v1[i]][v2[i]] = 1; gr[v2[i]][v1[i]] = 1; } for(int k = 0 ; k < 1001 ; k++){ for(int i = 0 ; i < 1001 ; i++ ){ for(int j = 0 ; j < 1001 ; j++){ if(i == j){ gr[i][j] = 0; continue; } if(gr[i][j] > gr[i][k] + gr[k][j]){ gr[i][j] = gr[i][k] + gr[k][j]; } } } } for(int i = 0 ; i < nh ; i++){ for(int j = 0 ; j < nv ; j++){ s = bi(gr[i][j]); for(int k = 0 ; k < s.size() ; k++){ encode_bit(s[k] - '0'); } } } // encode_bit(1); // encode_bit(0); return; }
#include "grader.h" #include "encoder.h" #include<bits/stdc++.h> using namespace std; void decode(int nv, int nh) { int rechner = 0; for(int i = 0 ; i < nh ; i++){ for(int j = 0 ; j < nv ; j++){ rechner = 0; for(int k = 1; k < 1024 ; k *= 2){ rechner += k *decode_bit(); } hops(i , j , rechner); } } // hops(0,0,0); // hops(1,2,3); }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:49:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |       for(int k = 0 ; k < s.size() ; k++){
      |                       ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...