Gordon-Freeman's blog

By Gordon-Freeman, history, 5 weeks ago, In English

I keep getting TLE on my solution and idk why can someone help me understand? problem: 1822G1 - Magic Triples (Easy Version) my sub:257235493

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Gordon-Freeman (previous revision, new revision, compare).

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

The problem is if(mp[v[i]]>0 ), if there is no v[i] in map, it will add v[i] to map, so your map will grow. Try to use if (mp.find(v[i])!=mp.end()) instead. Here is my submission, based on your code. 257242013