Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
using namespace std; int m ,k; int n; long long x; class node{ public: node *a, *b; long long bitmask; node(){ a = NULL; b = NULL; bitmask = 0; } }; int ret; string curr; void rek(int at, int depth, node *tmp){ tmp -> bitmask |= x; int popcount = __builtin_popcount(tmp -> bitmask); if(popcount == n && depth > ret){ ret = depth; } if(at == (int)curr.size() || depth > 60){ return; } if(curr[at] == 'a'){ if(tmp -> a == NULL){ tmp -> a = new node(); } rek(at + 1, depth + 1, tmp -> a); } else{ if(tmp -> b == NULL){ tmp -> b = new node(); } rek(at + 1, depth + 1, tmp -> b); } } int main(int argc, const char * argv[]) { ios_base::sync_with_stdio(false); cin >> n; string s[6]; node *root = new node(); for(int i =0; i < n; i ++){ cin >> s[i]; } for(int i =0; i < n; i ++){ curr = s[i]; x = (1 << i); for(int j =0; j < s[i].size(); j ++){ rek(j, 0, root); } } cout << ret << endl; return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)