Submission #833978

#TimeUsernameProblemLanguageResultExecution timeMemory
833978helloworld1705Bad Codes (CCO19_day2problem3)C++14
4 / 100
5 ms1876 KiB
/* _ _ | | (_) | |__ __ _ ___ _ ___ | '_ \ / _` / __| |/ __| | |_) | (_| \__ \ | (__ |_.__/ \__,_|___/_|\___| */ #include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e6 + 5; #define pii pair <int , int> #define fi first #define se second #define bit(a,b) ((a >> b) & 1ll) const int M = 1e3 + 3; const int inf = 1e18; const int mod = 1e9 + 7; int TEST = 0; void STEST(); /* -----------------[ MAIN CODE GOES HERE ]----------------- */ void init() { } string s[10001]; set <string> st; void solve() { int n , m; cin >> n >> m; for(int i = 0; i < n; i++) { cin >> s[i]; } int res = inf; for(int sz = 1; sz < 7; sz++) { for(int i = 0; i < (1 << (sz * 2)); i++) { string ans = ""; int x = i; for(int j = 0; j < sz; j++) { ans += s[x & 3]; x = (x >> 2); } if(st.find(ans) == st.end()) { st.insert(ans); continue; } int SIZE = ans.size(); res = min(res , SIZE); } } cout << (res == inf ? -1 : res) << '\n'; return; } main() { if (fopen("code.inp", "r")) { freopen("code.inp", "r", stdin); freopen("code.out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); STEST(); if(TEST) { int t; cin >> t; while(t-->0) { // your code down here // solve(); } } else { solve(); } return 0x0; } void STEST() { } // code by nothing //

Compilation message (stderr)

Main.cpp:66:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   66 | main() {
      | ^~~~
Main.cpp: In function 'int main()':
Main.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |         freopen("code.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:70:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   70 |         freopen("code.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...